Anutosh Bhat
Anutosh Bhat
What works ``` from lpython import S from sympy import Symbol, log, E, Pow, exp, pi def mmrv(e: S, x: S) -> list[S]: if e.args[0] != E: e1: S =...
Also something similar which works ``` def mmrv(e: S, x: S) -> list[S]: if e.args[0] != E: a: S = E b: S = pi e1: S = a *...
Smallest failing example ``` from lpython import S from sympy import Symbol, E def mmrv(e: S) -> S: if False: print(E) else: return e def test_mrv(): x: S = Symbol("x")...
One approach that comes to my mind is the following, i) We can maybe introduce a function in symengine's cwrapper.h (and it's corresponding implementation in cwrapper.cpp) ``` int basic_has_allocated_stack(basic s);...
I think we can go for the first approach, I've raise a pr to symengine (https://github.com/symengine/symengine/pull/2011) for the same.
cc @certik
We can demonstrate the sample case that sympy use in their documentation which is `limit(sin(x)/x, x, 0)` or something even simpler `limit(sin(x), x, 0)` . The breakdown for the following...
Internally `mrv_leadterm` depends on `mrv` , `rewrite` and `leadterm` ``` mrv_leadterm(sin(1/x), x) 1) exps = mrv(sin(1/x), x) = sin(1/x) 2) w = Dummy("w", positive=True) f, logw = rewrite(exps, Omega, x,...
A slightly more involved example would be this ``` In [1]: limit(sin(x)/x, x, 0) limitinf(_x*sin(1/_x), _x) = 1 +-mrv_leadterm(_x*sin(1/_x), _x) = (1, 0) | +-mrv(_x*sin(1/_x), _x) = set([_x]) | |...
The current implementation can be simplified quite a bit 1) limitinf technically depends on - `mrv_leadterm` : To calculate leadterm of most rapidly varying subexpression - `sign` : To compute...