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-- On Saturday, April 4, 2015 at 11:36:57 PM UTC-7, Aaron Meurer wrote: > > 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 <g.c.b....@gmail.com <javascript:>> > wrote: > > 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... > > > > Alternatively, can I force evalf to drill down into the exp() arguments? > > > > On Saturday, April 4, 2015 at 5:37:24 PM UTC-7, Aaron Meurer wrote: > >> > >> 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 <g.c.b....@gmail.com> wrote: > >> > 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() -> E**(2.23606797749979*t) > >> > > >> > I think this is causing me some trouble when converting complex > >> > expressions > >> > to numpy via lambdify. I'm trying to lambdify a result from dsolve > that > >> > includes square roots of very large integers (not sure where those > large > >> > integers are coming from). When I try to execute the result, I get > >> > "AttributeError: 'int' object has no attribute 'sqrt'". > >> > > >> > I'll see if I can get the lambdify to trip up with a simple set of > >> > inputs. > >> > Right now this is the culmination of a 100 cell IPython notebook... > >> > > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "sympy" group. > >> > To unsubscribe from this group and stop receiving emails from it, > send > >> > an > >> > email to sympy+un...@googlegroups.com. > >> > To post to this group, send email to sy...@googlegroups.com. > >> > Visit this group at http://groups.google.com/group/sympy. > >> > To view this discussion on the web visit > >> > > >> > > https://groups.google.com/d/msgid/sympy/e312e981-3e7b-4e6f-ae69-984c7e7ad9fc%40googlegroups.com. > > > >> > For more options, visit https://groups.google.com/d/optout. > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to sympy+un...@googlegroups.com <javascript:>. > > To post to this group, send email to sy...@googlegroups.com > <javascript:>. > > Visit this group at http://groups.google.com/group/sympy. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/sympy/20ecfb7f-0284-4f69-9d0e-4bd8cb21dbbe%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/fd89cc36-cd6e-4261-8f8f-6a2a6f096046%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.