Hi Scott!

On Sat, Oct 18, 2008 at 5:34 PM, Scott <[EMAIL PROTECTED]> wrote:
>
> What is the sympy translation of the following Mathematica syntax?
> When I try to code this in sage or sympy xdot and zdot remain as a
> diff object and I cannot us them in symbolic manifulations.  My sympy
> version is 5.15 (ubuntu 8.10) or whatever is  embedded in sage 3.1.2.
>
> V/R
>
> Scott
>
> x=q[t];
> z=1/2 *x^2;
> xdot=D[x,t];
> zdot=D[z,t];

The above four lines would be translated as:

In [1]: from sympy import *

In [2]: var("t")
Out[2]: t

In [3]: x = Function("x")(t)

In [4]: z = x**2/2

In [5]: xdot = diff(x, t)

In [6]: zdot = diff(z, t)

In [7]: xdot
Out[7]: D(x(t), t)

In [8]: zdot
Out[8]: x(t)*D(x(t), t)



> D[z*zdot,xdot]

In [11]: diff((z*zdot).subs(xdot, s), s)
Out[11]: 1/2*x(t)**3

Currently our diff can only differentiate with respect to a symbol, so
you need to use the substitution above. We should enhance that.

>
> out: 1/2 q[t]^3

This agrees.

Let us know if you have further questions.

Ondrej

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