In spite of my best efforts I cannot get lambdify to cope with array/ list inputs. All the lambdify examples have 1D inputs. Can you pass in x= x1,x2 ? dof and d_dof are both 4*1 lists
I am also have trouble with lambdify seeing list if length 4 as on input rather thab as 4 inputs, Iam using veversion .6.3 Cheers Scott def F0(dof,d_dof,U,dt): > > h1=dof[0];theta1=dof[1];v_h1=dof[2];v_theta1=dof[3] > > delta_h=d_dof[0];delta_theta=d_dof[1];delta_v_h=d_dof > > [2];delta_v_theta=d_dof[3] > > res=-delta_v_h/2 - delta_v_theta/20 + dt*(-2*h1/25 - delta_h/25 - > > 3*U* > > (v_theta1 + delta_v_theta/2)/50 - U*(v_h1 + delta_v_h/2)/20 - U**2* > > (theta1 + delta_theta/2)/20)#qs > > return res On Dec 4, 7:15 am, "Ondrej Certik" <[EMAIL PROTECTED]> wrote: > On Thu, Dec 4, 2008 at 1:08 PM, Scott <[EMAIL PROTECTED]> wrote: > > > How can I translate a formula output by sympy into one that is scipy > > friendly? > > > Given the following formula how can I automate turning the formula > > into a fast funtion. > > > f0=-delta_v_h/2 - delta_v_theta/20 + dt*(-2*h1/25 - delta_h/25 - 3*U* > > (v_theta1 + delta_v_theta/2)/50 - U*(v_h1 + delta_v_h/2)/20 - U**2* > > (theta1 + delta_theta/2)/20) > > > This first function is an order fo magnitude slower than the second > > when I solve it and its 3 sister nonlinear algebraic equations with > > scipy.optimize.fsolve > > > def F0(dof1,ddof,U,dt):return f0.subs(dict(zip(s1(dof),dof1))).subs > > (dict(zip(del_0(dof),ddof))).subs('dt',dt).subs('U',U) > > > def F0(dof,d_dof,U,dt): > > h1=dof[0];theta1=dof[1];v_h1=dof[2];v_theta1=dof[3] > > delta_h=d_dof[0];delta_theta=d_dof[1];delta_v_h=d_dof > > [2];delta_v_theta=d_dof[3] > > res=-delta_v_h/2 - delta_v_theta/20 + dt*(-2*h1/25 - delta_h/25 - > > 3*U* > > (v_theta1 + delta_v_theta/2)/50 - U*(v_h1 + delta_v_h/2)/20 - U**2* > > (theta1 + delta_theta/2)/20)#qs > > return res > > Try lambdify and read it's docstring, I think it should do exactly > what you want. > > Ondrej- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---