python - Differential equation using dynamicsymbols in Sympy -
in sympy, tried solve differential equation this:
from sympy import * sympy.physics.vector import dynamicsymbols x = dynamicsymbols('x') diffeq = eq(x(t).diff(t), x(t)) dsolve(diffeq, x(t))
but returns
typeerror traceback (most recent call last) <ipython-input-10-8a45d7148b24> in <module>() 1 x = dynamicsymbols('x') ----> 2 diffeq = eq(x(t).diff(t), x(t)) 3 dsolve(diffeq, x(t)) typeerror: 'x' object not callable
as far understand, dynamicsymbols
creates function of t, how use in differential equation?
sympy docs bit confusing output of
print(x)
is in fact
x(t)
however doesn't mean supposed call x(t)
:
from sympy import * sympy.physics.vector import dynamicsymbols x = dynamicsymbols('x') diffeq = eq(diff(x, symbol('t')), x) dsolve(diffeq, x) # eq(x(t), c1*exp(t))
Comments
Post a Comment