[sympy] evalf behaves differently for E**x and exp(x)

2015-04-04 Thread G B
Hi-- exp() doesn't seem to evalf its arguments when evalf is called on it. This is probably a bug, and if so I'll file an issue. In the mean time, is there an easy way to get sympy to convert exp(x) expressions to E**x expressions? exp(t*sqrt(5)).n() -> exp(t*sqrt(5)) E**(t*sqrt(5)).n() -

Re: [sympy] evalf behaves differently for E**x and exp(x)

2015-04-04 Thread Aaron Meurer
Seems like another thing that https://github.com/sympy/sympy/issues/4898 would fix. I think the only way to create E**x is to use Pow(E, x, evaluate=False). The lambdify thing might be a separate bug. Aaron Meurer On Sat, Apr 4, 2015 at 5:04 PM, G B wrote: > Hi-- > > exp() doesn't seem to evalf

Re: [sympy] evalf behaves differently for E**x and exp(x)

2015-04-04 Thread G B
If I'm understanding my problem correctly, I think I actually want it to evaluate... Is there a way to ask sympy to find all occurrences of exp() in an expression and replace them with Pow(E,...) or E**? I've tried messing with replace, but I'm not sure I've got the syntax right... Alternativ

Re: [sympy] evalf behaves differently for E**x and exp(x)

2015-04-04 Thread Aaron Meurer
You have to do evaluate=False because Pow(E, x) is automatically converted to exp() otherwise. You can use something like expr.replace(exp, lambda x: Pow(E, x, evaluate=False)). Aaron Meurer On Sat, Apr 4, 2015 at 11:36 PM, G B wrote: > If I'm understanding my problem correctly, I think I actua

Re: [sympy] evalf behaves differently for E**x and exp(x)

2015-04-20 Thread G B
Hey Aaron-- This bug came up to bite me again, so I tried your work around. The replace you suggested doesn't work (I get the same result back). What does seem to work is expr.replace(exp, lambda x: Pow(E, N(x))) That forces the evaluation of the argument to exp, and then carries on. Thanks