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

V/R

Scott
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to