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

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