# Solve a differential equation using series expansions.

Given an ODE such as $$y''+x^2y'+y=0$$ Is it possible to get sage to display the solution in the from (at least the first few terms of the expansion) $$y=a_o\left(c_0+c_1x+c_2x^2+\dots\right) + a_1\left(d_0+d_1x+d_2x^2+\dots\right)$$

my attempts:

EDIT: I have made some progress, functional but it is not pretty. second attempt

edit retag close merge delete

Sort by ยป oldest newest most voted

You can use the ore_algebra package as follows.

First, you need to install the latest version (not the packaged one which is not up-to-date), from the shell, just type:

sage -pip install --upgrade --user git+https://github.com/mkauers/ore_algebra.git

Then, in Sage:

sage: from ore_algebra import *
sage: R.<x> = PolynomialRing(ZZ); A.<Dx> = OreAlgebra(R)
sage: O = Dx^2 + x^2*Dx + 1
sage: O
Dx^2 + x^2*Dx + 1
sage: O.power_series_solutions(n=10)
[x - 1/6*x^3 - 1/12*x^4 + 1/120*x^5 + 7/360*x^6 + 13/1680*x^7 - 11/10080*x^8 - 209/120960*x^9 + O(x^10),
1 - 1/2*x^2 + 1/24*x^4 + 1/20*x^5 - 1/720*x^6 - 13/2520*x^7 - 179/40320*x^8 + 17/90720*x^9 + O(x^10)]
more

Hello :) Is there any way that we can solve the differential equation in a series solution in SageMathCell? Also, how could we solve for the initial value? How could we adjust the default center 0(x0=0) to another value? Thank you!

( 2023-03-09 02:20:13 +0200 )edit

## Stats

Seen: 275 times

Last updated: Apr 21 '18