Parametric vector function

19 views
Skip to first unread message

Poul Riis

unread,
Jun 28, 2016, 5:24:21 PM6/28/16
to sympy
The example below works but I would like to do something like
fvec=vector([tt*sin(tt),tt*cos(tt),sqrt(tt)])
in stead of
fvecx=tt*sin(tt)
fvecy=tt*cos(tt)
fvecz=sqrt(tt)
Is that possible? If yes, how?


Poul Riis




from math import *
from sympy import *


tt=Symbol('tt')
fvecx=tt*sin(tt)
fvecy=tt*cos(tt)
fvecz=sqrt(tt)
fvecxlambdified = lambdify(tt, fvecx)
fvecylambdified = lambdify(tt, fvecy)
fveczlambdified = lambdify(tt, fvecz)
fvecxdiff=fvecx.diff(tt)
fvecxdifflambdified=lambdify(tt,fvecxdiff)
fvecydiff=fvecy.diff(tt)
fvecydifflambdified=lambdify(tt,fvecydiff)
fveczdiff=fvecz.diff(tt)
fveczdifflambdified=lambdify(tt,fveczdiff)


print("fx(1)=",fvecxlambdified(1))
print("fy(1)=",fvecylambdified(1))
print("fz(1)=",fveczlambdified(1))


print("fx'(1)=",fvecxdifflambdified(1))
print("fy'(1)=",fvecydifflambdified(1))
print("fz'(1)=",fveczdifflambdified(1))

Aaron Meurer

unread,
Jun 29, 2016, 2:58:26 PM6/29/16
to sy...@googlegroups.com
You can pass a list to lambdify and it will create a function that
returns a list, like

lambdify(tt, [fvecx, fvecy, fvecz])

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/9050bf01-19e2-423a-8467-f2175e21275f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages