On Sun, Oct 19, 2008 at 8:05 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
> 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]
You need to put here this line to introduce the "s" variable:
In [9]: var("s")
Out[9]: s
>
> In [11]: diff((z*zdot).subs(xdot, s), s)
> Out[11]: 1/2*x(t)**3
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
-~----------~----~----~----~------~----~------~--~---