# 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)
|