Hi Friedrich,

I think I made the question even more misleading by giving the previous
example. In fact, please look into this
equation<http://upload.wikimedia.org/math/c/7/e/c7eedcd0e22198adaf3ef62741edc769.png>.
Basically, T is a function of qi and qi_dot, which can be derived. qi is a
function of time, but the function is unknown. The purpose is to derive the
expression for Qi.

So I define qi_dot as:
>>> qi_dot=diff(qi,t)
I've no problem get diff(T,qi). But I cannot derive diff(T,qi_dot)

Best,

Aaron

On Sun, Dec 14, 2008 at 5:33 AM, Friedrich Hagedorn <[email protected]>wrote:

>
> On Sat, Dec 13, 2008 at 08:59:08AM -0800, Aaron wrote:
> >
> > I'm a newbie to sympy. The problem is, I do not know whether it is
> > possible to get the derivative with respect to a function, not a
> > symbol. The code is like this:
> >
> > t = Symbol("t")
> > f = Function("f")
> >
> > theta = f(t)
> > theta_dot = diff(theta,t,1)
> > x = theta*theta_dot
> > y = diff(x,theta_dot,1)
> >
> > Then the output is
> > D(f(t)*D(f(t), t), D(f(t), t))
> >
> > However, my expected output should be "theta" or "f(t)" instead.
>
> Now, I have this idea:
>
> % isympy
> In [1]: var('t xDot')
> Out[1]: (t, xDot)
>
> In [2]: g = lambdify((x, xDot), x*xDot)
>
> In [3]: g(x, xDot)
> Out[3]: x*xDot
>
> In [4]: g(f(t), diff(f(t), t))
> Out[4]:
>     d
> f(t)*──(f(t))
>     dt
>
> In [5]: gDot = lambdify((x, xDot), diff(g(x, xDot), xDot))
>
> In [6]: gDot(f(t), diff(f(t), t))
> Out[6]: f(t)
>
> By,
>
>  Friedrich
>
> >
>

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