On Wed, Sep 28, 2011 at 1:21 PM, Chris Smith <[email protected]> wrote: > Here's an example where the 2*C2 remains after constantsimp (and > doesn't go away even after a second pass because constantsimp isn't > expecting something about this situation) along with a comparison of > times taken: > > ```python >>>> def ns(s): > ... return numbered_symbols(s,start=1) > ... >>>> def reps(eq): > ... return zip(eq.free_symbols - set([x]),ns('C')) > ... >>>> eq=3*y + 2*z*(y + 3) + 2*z*(x*y + 3) + 9 + exp(x + 2*y)/(x + y + 1) >>>> constant_renumber(constantsimp(eq.subs(reps(eq)),x,1),'C',1,1000) > C1 + 2*C2*(C3*x + 3) + C4*exp(x)/(C5 + x) >>>> model(eq,x) > C0 + C1*exp(x)/(C2 + x) + C3*(C4*x + 3) >>>> from time import time >>>> t=time();jnk=[constant_renumber(constantsimp(eq.subs(reps(eq)),x,1),'C',1,10 > 00) for i in xrange(100)];print time()-t > 41.0169999599 >>>> t=time();jnk=[model(eq,x) for i in xrange(100)];print time()-t > 2.31999993324 > ``` > > ode's constantsimp handles it's domain of problems ok, but it was > written for results from dsolve, not for the general equation. >
Well, I would consider this to be a bug. We should make constantsimp() work for a more general case of constants and move it to the general namespace. Aaron Meurer > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
