Thanks Friedrich The test file you sent guided me through how to format the data going to lambdify. My formulas are now easily modified and shockingly fast, pseudo code follows.
from sympy import * vars('U dt') In [16]: s1(dof) Out[16]: [h1, theta1, v_h1, v_theta1] In [17]: del_0(dof) Out[17]: [delta_h, delta_theta, delta_v_h, delta_v_theta] f0= -delta_v_h/2 - delta_v_theta/20 + dt*(-2*h1/25 - delta_h/25 - 3*U*v_theta1/50 - 3*U*delta_v_theta/100 - U*v_h1/20 - U*delta_v_h/40 - theta1*U**2/20 - delta_theta*U**2/40) args=list(tuple(s1(dof))+tuple(del_0(dof))+(U,dt)) for i in range(len(args)):args[i]=var(str(args[i])) f0=lambdify(args,f0) def F0(dof,d_dof,U,dt): args = tuple(dof) + tuple(d_dof) + (U, dt) return f0(*args) On Dec 4, 3:28 pm, Friedrich Hagedorn <[EMAIL PROTECTED]> wrote: > On Thu, Dec 04, 2008 at 04:08:15AM -0800, Scott wrote: > > > How can I translate a formula output by sympy into one that is scipy > > friendly? > > Here is my attempt with the attached file: > > In [1]: run test.py > > In [2]: F0?? > [...] > def F0(dof,d_dof,U,dt): > args = tuple(dof) + tuple(d_dof) + (U, dt) > return f0(*args) > > In [3]: F0([1,2,3,4], [5,6,7,8], 9, 10) > Out[3]: -281.64999999999998 > > In [4]: %timeit F0([1,2,3,4], [5,6,7,8], 9, 10) > 100000 loops, best of 3: 11.2 µs per loop > > I hope that helps. > > By, > > Friedrich > > test.py > < 1KViewDownload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---