On Thursday 04 December 2008 19:52:45 Scott wrote:
> 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

Hello Scott,
it isn't that what you are looking for?

In [1]: from numpy import array

In [2]: dof = array((1,2,3))

In [3]: f = lambdify((x,y,z),dof[0]*x+dof[1]*y+dof[2]*z,"numpy")

In [4]: f(1,2,3)
Out[4]: 14

In [5]: f(1,1,1)
Out[5]: 6

In [6]: f(3,2,1)
Out[6]: 10

Remember that dof values are immutable inside the lambdified function.

In [7]: dof[1] = 100

In [8]: f(3,2,1)
Out[8]: 10

Cheers,
Riccardo

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

Reply via email to