0
$\begingroup$

I was trying to verify my solution to this ode using power series method. The expansion point is x=0. This ode has removable singularity, so Frobenius series and not standard power series has to be used.

Mathematica gives the correct series when no IC are given. But when IC are given (which must be at a point other that x=0 since x=0 is singularity, then the series solution does not look correct, since it does not satisfy initial conditions. I used 8 terms in the following, which is more than enough to show the problem.

First, the solution with no IC

Clear["Global`*"]
ode = x^2*(-x^2 + 2)*y''[x] - x*(4*x^2 + 3)*y'[x] + (-2*x^2 + 2)*y[x] == 0;
sol = AsymptoticDSolveValue[ode, y[x], {x, 0, 8}]

Mathematica graphics

The above is correct, it matches exactly my hand solution. Next, added IC

Clear["Global`*"]
ode = x^2*(-x^2 + 2)*y''[x] - x*(4*x^2 + 3)*y'[x] + (-2*x^2 + 2)*y[x] == 0;
ic = {y[1] == 1, y'[1] == 0}
sol = AsymptoticDSolveValue[{ode, ic}, y[x], {x, 0, 8}]

Now it gives

enter image description here

This looks too complicated. I do not know where all these Gamma functions came from, as the series solution without IC is just a power series. So one would expect the solution with IC to be also a power series.

But lets check if it agrees with IC.

N[sol /. x -> 1]

Mathematica graphics

No where close to 1. Same for derivative

 N[D[sol, x] /. x -> 1]

Mathematica graphics

No where close to 0.

Then I asked Maple for the series solution using same number of terms and for same IC. Maple's solution does satisfy the IC.

ode:=x^2*(-x^2+2)*diff(diff(y(x),x),x)-x*(4*x^2+3)*diff(y(x),x)+(-2*x^2+2)*y(x) = 0;
ic:=y(1)=1,D(y)(1)=0;
Order:=8;
dsolve([ode,ic],y(x),series,point=0);

enter image description here

Copied the above over to Mathematica and did

mapleSol = 1 + 2/3*(x - 1)^3 + 4/3*(x - 1)^4 + 25/6*(x - 1)^5 + 133/12*(x - 1)^6 + 629/21*(x - 1)^7;

Now

mapleSol /. x -> 1

Mathematica graphics

And

D[mapleSol, x] /. x -> 1

Mathematica graphics

For an ordinary expansion point, (i.e. using normal power series), AsymptoticDSolveValue had no problem generating correct series with or without IC.

Am I doing something wrong in the above? Why the series generated does not seem to match the IC given?

V 12.3.1 on windows 10

$\endgroup$
1
$\begingroup$

Not an answer, only a pragmatic observation:

The problem seems to come from slow convergence rate of the series expansion!

I tried workaround

Y = DSolveValue[{ode, ic}, y , x ] 

which gives the correct solution

{Y[1],Y'[1]}//N
(*{1., 1.33227*10^-15}*)

But the series expansion only fullfills the ic's if you increase the order

Normal[Series[Y[x], {x, 0, 8} ]] /. x -> 1.
(*0.148093*) 
Normal[Series[Y[x], {x, 0, 30} ]] /. x -> 1.
(*0.998895*) 

The rate of convergence is very slow. Although maples series expansion indicates increasing coefficients in the series expansion!

Increase expansion order in AsymptoticDSolveValue!

Hope it helps!

$\endgroup$
2
  • $\begingroup$ Thanks for your time to answer this. I think it was a user error on my end. $\endgroup$
    – Nasser
    Oct 10 at 19:52
  • $\begingroup$ You're welcome. $\endgroup$ Oct 10 at 21:24
1
$\begingroup$

It was my error. The initial conditions must be specified at the expansion point. I had an error in Maple, where I wrote point=0. It should be x=the_point. When I did this, it showed my error.

When I corrected this in Mathematica, it now gives same answer as Maple

Clear["Global`*"]
ode = x^2*(-x^2 + 2)*y''[x] - x*(4*x^2 + 3)*y'[x] + (-2*x^2 + 2)*y[x] == 0;
ic = {y[1] == 1, y'[1] == 0}
sol = AsymptoticDSolveValue[{ode, ic}, y[x], {x, 1, 8}]

enter image description here

Notice above, {x, 1, 8} and not {x, 0, 8} as before, so that the expansion point is same where initial conditions are.

In Maple

ode:=x^2*(-x^2+2)*diff(diff(y(x),x),x)-x*(4*x^2+3)*diff(y(x),x)+(-2*x^2+2)*y(x) = 0;
ic:=y(1)=1,D(y)(1)=0;
Order:=8;
dsolve([ode,ic],y(x),series,x=1);

enter image description here

Notice the correct Maple syntax. it is x=1 and not point=1. Maple have deficiency in that it does not verify options passed to its functions. There is no point= option. Yet, it accepted it before, but it was ignored. I complained before to Maple about this. Because a user can have misspelled option given, and no error is generated, and they will not know. Mathematica does a better job at this, as it verifies all option passed are valid. That is why I did not notice this.

Case closed. Mathematica works correctly. Sorry about this confusion.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.