3
$\begingroup$

I have an ordinary differential equation and want to solve it using power series as ψ[x_] = Sum[Subscript[a, n] x^n, {n, 0, ∞}] to obtain the recurrence relation for coefficients $a_n$ like $A \, a_{n+1}+B \, a_{n-1}+C \, a_{n}=0$. Is Mathematica able to do that?

x^2 ψ''[x] + (b x^2 + c x + d) ψ'[x] + (f x + g) ψ[x] == 0

$\endgroup$
4
  • 2
    $\begingroup$ This is the classic "Method Of Frobenius", for which ResourceFunction["FrobeniusDSolveFormula"] appears to do what you need. $\endgroup$ Commented Feb 2 at 17:16
  • $\begingroup$ @StephenLuttrell Thank you very much for the comment. This is exactly what I wanted; it works! $\endgroup$
    – PhysFan
    Commented Feb 2 at 22:45
  • $\begingroup$ @StephenLuttrell According to the discussion of Frobenius method in en.wikipedia.org/wiki/Frobenius_method, d = 0 is required to apply it to the present ODE. This is consistent with my answer below, which suggests that the ODE's symbolic solution has an essential singularity at x = 0. $\endgroup$
    – bbgodfrey
    Commented Feb 3 at 0:35
  • $\begingroup$ @bbgodfrey I agree, and so does my (very) old "Mathematical Methods for the Physical Sciences" (K F Riley) textbook. Thank you for pointing that out. $\endgroup$ Commented Feb 3 at 15:33

2 Answers 2

5
$\begingroup$

Yes, Mathematica is able to do that.

n = 5;
zero = x^2 \[Psi]''[x] + (b x^2 + c x + d) \[Psi]'[x] + (f x + g) \[Psi][x] /. \[Psi] ->Function[x, Sum[ a[k] x^k, {k, 0, n}]]
eqn = CoefficientList[zero, x]

Solve[eqn[[;; 5]] == 0, Table[a[k], {k, 1, 5}]] // Simplify
(*{a[1] -> -((g a[0])/d), 
a[2] -> ((-d f + g (c + g)) a[0])/(2 d^2), 
a[3] ->...}*)
$\endgroup$
2
  • $\begingroup$ Thank you. That is great. But I meant a general three-term recurrence relation over the coefficients $a_n$. As can be seen for any fixed $n$, there should be a relation like $A \, a_{n+1}+B \, a_{n-1}+C \, a_{n}=0$; maybe, this is impossible for Mathematica? $\endgroup$
    – PhysFan
    Commented Feb 1 at 23:11
  • $\begingroup$ @PhysFan This is a difficult task because the coefficients A,B,C depnd on n too! $\endgroup$ Commented Feb 2 at 10:20
1
$\begingroup$

Why not just solve the ODE symbolically by

DSolve[x^2  \[Psi]''[x] + (b  x^2 + c  x + d)  \[Psi]'[x] + 
    (f  x + g)  \[Psi][x] == 0, \[Psi][x], x] // Flatten

(* {\[Psi][x] -> E^(d/x - b x) x^(2 - c) C[2] HeunD[-2 + c - g, -2 b + f, -d, 4 - c, -b, x]
    + C[1] HeunD[-g, f, d, c, b, x]} *)
$\endgroup$
1
  • $\begingroup$ Thanks. I did not know this ability of Mathematica that can give results in terms of Heun functions. But I need the mentioned recurrence relation for the coefficients $a_n$ in the polynomial solution $\psi$. $\endgroup$
    – PhysFan
    Commented Feb 2 at 22:28

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