Reputation: 177
I'm trying to manipulate with differential equation system using sympy:
from sympy import symbols, Function
t = symbols('t')
x_2 = Function('x_2')
x_3 = Function('x_3')
eq = x_3(t).diff(t) + x_2(t).diff(t)
eq1 = eq.subs(x_2(t), x_3(t) + x_3(t).diff(t))
and the answer is:
but I need result in form:
I try to use
eq1.simplify()
but result is same.
How can i get this? Thanks.
Upvotes: 2
Views: 111
Reputation: 14500
You can use doit:
In [2]: eq1
Out[2]:
d ⎛ d ⎞ d
──⎜x₃(t) + ──(x₃(t))⎟ + ──(x₃(t))
dt⎝ dt ⎠ dt
In [3]: eq1.doit()
Out[3]:
2
d d
2⋅──(x₃(t)) + ───(x₃(t))
dt 2
dt
Upvotes: 1