Simplifying Derivative(0,t)?

24 views
Skip to first unread message

gomire...@gmail.com

unread,
Jan 28, 2015, 11:43:53 PM1/28/15
to sy...@googlegroups.com
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

Aaron Meurer

unread,
Jan 29, 2015, 1:00:42 AM1/29/15
to sy...@googlegroups.com
Use expr2.doit().

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 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.
For more options, visit https://groups.google.com/d/optout.

gomire...@gmail.com

unread,
Jan 29, 2015, 2:38:47 AM1/29/15
to sy...@googlegroups.com
Thanks.

Since I was using a matrix, I had to apply doit() to every element, like:
    doit = lambda x: x.doit()
    mat.applyfunc(doit)

However, mat.doit() did not work.


2015年1月29日木曜日 15時00分42秒 UTC+9 Aaron Meurer:
Reply all
Reply to author
Forward
0 new messages