One of the goals of the project I am working on is to make it easy to apply these kinds of manipulations automatically. The translation you did can be automated using the cse() function. collect() is also useful. Another good one for polynomial evaluation is horner(), which rewrites polynomial expressions into their most numerically efficient to evaluate form.
Aaron Meurer On Tue, Feb 2, 2016 at 11:42 AM, <[email protected]> wrote: > Hi! > > I calculated a Taylor Series expansion using SymPy. I want to evaluate > this expansion at a lot of points. Now, the expansion (specifcally the > derivatives at the development point) contain sin(x),cos(x) x and powers > thereof. Hence, I made a substitution subs(sin(x),a) and subs(cos(x),b), > where a and b are just real symbols. Then I call T*(x,sin(x),cos(x)) > instead of T(x), where T is the Taylor expansion, which gives a huge boost > and speed, because the sin and cos terms are not always re-evaluated. > Do you know other such hacks? For example, clever use of collect() should > be pretty helpful in many cases. > > Cheers, > Wolfgang > > -- > 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 https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/2a8340fc-66ff-43e4-a87f-91381aa976b0%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/2a8340fc-66ff-43e4-a87f-91381aa976b0%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 https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Jgz%3DT%2BPVWBUfM%2BY4nzOJPa-wwkOVycJ%2BjBMgoDUFgWFw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
