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:
> Use expr2.doit().
>
> Aaron Meurer
>
> On Wed, Jan 28, 2015 at 10:43 PM, <[email protected] <javascript:>>
> 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] <javascript:>.
>> To post to this group, send email to [email protected] <javascript:>
>> .
>> 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/d83d0ccb-936d-4a31-8fa5-ad161418dcae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.