Use expr2.doit().

Aaron Meurer

On Wed, Jan 28, 2015 at 10:43 PM, <[email protected]> wrote:

> How do I get Derivative(0,t) simplified? In my code below, I used subs to
> substitute 0 for b(t) in a formula,
>     a(t)*Derivative(b(t), t) + Derivative(a(t), t)
>
> Then I got
>
>     a(t)*Derivative(0, t) + Derivative(a(t), t)
>
>
> whereas the answer I want is:
>
>     Derivative(a(t), t)
>
>
> ------------
>
> from sympy import *
> from sympy.physics.vector import *
> from sympy.physics.mechanics import *
>
> a=dynamicsymbols('a')
> a_d=dynamicsymbols('a',1)
> b=dynamicsymbols('b')
> b_d=dynamicsymbols('b',1)
>
> expr = a*b_d + a_d
> print expr
> expr2 = expr.subs(b, 0)
> print expr2
> print simplify(expr2)
> ------------
>
> Thank you,
> Iai
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/9670822f-1eb8-4946-96e1-4361de271b93%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/9670822f-1eb8-4946-96e1-4361de271b93%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6Jq7k-UtotVS%2BKR1C6TuU7%2B%2B%3DSJdCvQuuhu%3Dns0v4WpXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to