Examples Lynch book
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

12 lines
332 B

# Program 02d: Power series solution of a second order ODE;
# example 8, chapter 2
from sympy import Function, dsolve, pprint
from sympy.abc import t
x = Function('x')
dxdt2 = x(t).diff(t, 2)
dxdt = x(t).diff(t)
ode = dxdt2+2*t**2*dxdt+x(t)
sol = dsolve(ode, hint='2nd_power_series_ordinary', n=6)
print('Solution:\n')
pprint(sol)