You can also use logcombine(force=True). I'd say this is better than posify() because it will work even if the argument to the log() is not a basic Symbol.
Aaron Meurer On Sat, Jul 18, 2015 at 9:10 AM, Chris Smith <[email protected]> wrote: > With the right assumptions this will simplify: > > >>> e=S('A + exp(B*log(C) + D) ') > >>> simplify(posify(e)) > (_C**_B*exp(_D) + _A, {_A: A, _B: B, _C: C, _D: D}) > >>> _[0].subs(_[1]) > A + C**B*exp(D) > > /c > > On Saturday, July 18, 2015 at 6:12:37 AM UTC-5, Carsten Knoll wrote: >> >> Hi, >> >> due to various substitutions I have a bulky expression of the following >> structure >> >> A + exp(B*log(C) + D) >> >> I want sympy to simplify this to >> >> A + C**B*exp(D) >> >> I think it boils down to the simplification of >> >> exp(B*log(C)) >> >> >> which I also can't perform: >> >> from sympy import exp, log, expand_power_exp >> from sympy.abc import B, C >> >> term = exp(B*log(C)) >> >> print term.simplify() >> print term.expand() >> print expand_power_exp(term) >> >> >> # results >> exp(B*log(C)) >> exp(B*log(C)) >> exp(B*log(C)) >> >> I think a possible way would be the following: >> >> exp(B*log(C) + D) = exp(B*log(C))*exp(D) = exp(log(C))**B*exp(D) >> = C**B*exp(D) >> >> >> But how can I tell sympy to "see" that? >> >> Carsten >> >> >> -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/7c41a10c-3d5c-4dba-aa6e-8db85a2bf12b%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/7c41a10c-3d5c-4dba-aa6e-8db85a2bf12b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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 [email protected]. To post to this group, send email to [email protected]. 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/CAKgW%3D6%2B90sH6ca30tYNh%3DMHQ442ZC6n7Sn3tCjRsK4S4P%3DXOcQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
