Discussion on supporting Pow instances for mrv function
So the case overall from sympy's gruntz.py looks like
elif e.is_Pow and e.base != S.Exp1:
e1 = S.One
while e.is_Pow:
b1 = e.base
e1 *= e.exp
e = b1
if b1 == 1:
return SubsSet(), b1
if e1.has(x):
if limitinf(b1, x) is S.One:
if limitinf(e1, x).is_infinite is False:
return mrv(exp(e1*(b1 - 1)), x)
return mrv(exp(e1*log(b1)), x)
else:
s, expr = mrv(b1, x)
return s, expr**e1
I think we have like to have
- [ ]
e1 = S.One(which is basically introducing a constant 1, I think we have support through symengine for this) . TheS.Oneconstant is being used thrice so we would want that. - [ ]
.is_infinitecan also be supported through SymEngine - [ ] The only thing that I'm not sure how it should be supported is the
limitinffunction. We aren't supporting limits for now and not sure is SymEngine's C API has any kind of support for it.
EDIT : Even for the first TODO we have the SymbolicInteger Intrinsic function node, so we can delay introducing S.One for a while
So basically I see 2-3 conditional statements and we can address all except one
Remove this:
if limitinf(b1, x) is S.One:
if limitinf(e1, x).is_infinite is False:
return mrv(exp(e1*(b1 - 1)), x)
or throw an exception.
The last two TODO items thus don't apply.
As for S.One, we can support it and just do S(1), or we can rewrite the code to just do S(1). I would actually not support S.One at all, it seems hackish and I think the only advantage is that it is faster in SymPy, but in LPython there is no speed advantage, just duplicate syntax, so I would just stick to S(1).