I would like to have first several coefficients of formal power series defined implicitly by a differential equation.
Example.
import sympy as sp
sp.init_printing() # math as latex
from IPython.display import display
z = sp.Symbol('z')
F = sp.Function('F')(z)
F_ = sp.Derivative(F, z)
equation = sp.Eq(F**2 + 1 - F_, 0)
display(equation)
solution = sp.dsolve(equation)
display(solution)
sp.series(sp.tan(z), n = 8)
Question. How to compute formal power series solution of ODE without explicitly solving it in terms of elementary functions?
Sidenote. Some differential equations (even linear) have solutions in divergent power series only, for example an equation
L = z^2 + z^2 L + z^4 L'
. It is interesting to know whethersympy
supports such equations along with usual ones.
Related.
The current question is a sequel of a more easy question.
Sympy: how to solve algebraic equation in formal power series?