Hunt for exact solutions of second order ordinary differential equations with varying coefficients.

Let $$a,a_1,a_2,b \in {\mathbb R}$$.

Being inspired by the answer to Solve $y''(x)=[a(x^2-1)^2+b]y(x)$ we found solutions of the following second order ODE : $$$$\frac{d^2 y(x)}{d x^2} + \left( a x^4 + a_1 x^2 + a_2 x + b\right) y(x)=0$$$$ Indeed if we write: $$$$y(x) = \exp\left( -\imath \frac{\sqrt{a}}{3} x^3 - \imath \frac{a_1}{2 \sqrt{a}} x\right) \cdot v(x)$$$$ the function $$v(x)$$ satisfies the triconfluent Heun equation https://dlmf.nist.gov/31.12. We have: $$$$\frac{d^2 v(u)}{d u^2} + u(u+\gamma) \frac{d v(u)}{d u} + (\alpha u - q) v(u)=0$$$$ where $$\begin{eqnarray} \gamma &=& \sqrt[3]{-1} 2^{5/6} \sqrt[6]{a} \sqrt{\frac{a_1}{a}}\\ \alpha &=& 1+\frac{\imath a_2}{2\sqrt{a}} \\ q &=& -\left( \frac{\sqrt[3]{-1} \left(4 \sqrt{2} a^{3/2} \sqrt{\frac{a_1}{a}}+2 i \sqrt{2} a a_2 \sqrt{\frac{a_1}{a}}+4 a b-a_1^2\right)}{4\ 2^{2/3} a^{4/3}}\right) \end{eqnarray}$$ and $$$$u:=\frac{(-1)^{1/6}}{2^{1/3} a^{1/6}}\left(x - \imath \sqrt{\frac{a_1}{(2 a)})}\right)$$$$

Here is a code snippet that verifies our claim:

a =.; a0 =.; a1 =.; a2 =.; b =.; m =.; n = -I Sqrt[a]/
3; Clear[y]; Clear[u]; Clear[v];
y[x_] = Exp[n x^3] u[x];
myeqn = Collect[(D[
y[x], {x, 2}] + (a x^4 + a1 x^2 + a2 x + b) y[
x]) Exp[-n x^3], {u[x], u'[x], u''[x]}, Simplify];
u[x_] = Exp[m x] v[x]; m = -I a1/(2 Sqrt[a]);
myeqn1 = Collect[Simplify[myeqn Exp[-m x]], {v[x], v'[x], v''[x]},
Simplify];
myeqn2 = Collect[
myeqn1 /. x :> u + I Sqrt[a1/(2 a)] /. v[u + A_] :> v[u] /.
Derivative[1][v][u + A_] :> Derivative[1][v][u] /.
Derivative[2][v][u + A_] :> Derivative[2][v][u], {u[x], u'[x],
u''[x]}, Simplify];
Ab = (-1)^(1/6)/(2^(1/3) a^(1/6));
subst = {u :> Ab u, Derivative[1][v][u] :> 1/Ab Derivative[1][v][u],
Derivative[2][v][u] :> 1/(Ab)^2 Derivative[2][v][u]};
Collect[Expand[(Ab^2 myeqn2)] /. subst /. v[Ab u] :> v[u], {v[u],
v'[u], v''[u], u^_}, Simplify]


Update: Now let $$a$$,$$a_0$$,$$a_1$$,$$a_2$$ and $$b$$ be real numbers.

Likewise consider another second order ODE. We have: $$$$\frac{d^2 y(x)}{d x^2} + \left( \frac{a}{x^4} + \frac{a_0}{x^3} + \frac{a_1}{x^2} + \frac{a_2}{x} +b\right) y(x)=0$$$$ Then by writing : $$$$y(x)= x^{1+\frac{a_0}{2 \imath \sqrt{a}}} \exp\left[\imath \left(\frac{\sqrt{a}}{x} + \sqrt{b} x \right)\right] \cdot v(x)$$$$ The function $$v$$ satisfies the doubly-confluent Heun equation. We have: $$$$\frac{d^2 v(u)}{d u^2} + \left( \frac{\delta}{u^2} + \frac{\gamma}{u} + 1\right) \frac{d v(u)}{d u} + \frac{\alpha u-q}{u^2} v(u) = 0$$$$ where: $$\begin{eqnarray} \delta &=& 4 \sqrt{a b}\\ \gamma &=&2 - \frac{\imath a_0}{\sqrt{a}}\\ \alpha &=& 1-\frac{\imath a_0}{2 \sqrt{a}} - \frac{\imath a_2}{2 \sqrt{b}}\\ q &=& \frac{\imath a_0}{2 \sqrt{a}} + \frac{a_0^2}{4 a}-a_1-2 \sqrt{a b} \end{eqnarray}$$ and $$u:=x/(2 \imath \sqrt{b})$$.

The following Mathematica code snippet provides the "proof". We have:

a =.; a1 =.; a2 =.; b =.; a0 =.; m =.; n =.; p =.; Clear[y]; \
Clear[v]; Clear[m]; x =.;
m[x_] = x^(1 + a0/(2 I Sqrt[a])) Exp[I (Sqrt[a]/x + Sqrt[b] x)] ;
y[x_] = m[x] v[x];
myeqn = Collect[
Simplify[(D[
y[x], {x, 2}] + (a /x^4 + a0 /x^3 + a1 /x^2 + a2 /x + b) y[
x])/m[x]], {v[x], v'[x], v''[x]}, Simplify];
myeqn = Collect[Simplify[myeqn ], {v[x], v'[x], v''[x], x^_},
Simplify];
Ab = 1/(2 I Sqrt[b]);
subst = {x :> Ab x, Derivative[1][v][x] :> 1/Ab Derivative[1][v][x],
Derivative[2][v][x] :> 1/(Ab)^2 Derivative[2][v][x]};
Collect[Expand[(Ab^2 myeqn)] /. subst /. v[Ab x] :> v[x], {v[x],
v'[x], v''[x], x^_}, Simplify]


Finally let $$a$$,$$a_0$$,$$a_1$$,$$a_2$$ and $$b$$ be real numbers. Consider the following ODE. We have: $$$$\frac{d^2 y(x)}{d x^2} + \left( a x^2 + a_0 x + a_1 + \frac{a_2}{x} +\frac{b}{x^2}\right) y(x)=0$$$$ Then by writing: $$$$y(x)=\exp\left( -\frac{\imath}{2\sqrt{a}} x(a_0+a x)\right) \cdot x^{\frac{1}{2}(1+\sqrt{1-4 b})} \cdot v(x)$$$$ the function $$v$$ satisfies the biconfluent Heun equation. We have: $$$$\frac{d^2 v(u)}{d u^2} -\left( \frac{\gamma}{u} + \delta + u\right)\frac{d v(u)}{d u} + \frac{\alpha u - q}{u} v(u) = 0$$$$ where

$$\begin{eqnarray} \delta &=& -\frac{1}{2}\left( 1-\imath \right) \frac{a_0}{a^{3/4}}\\ \gamma &=& - 1-\sqrt{1-4 b}\\ \alpha &=& \frac{4 a^{3/2} \left(\sqrt{1-4 b}+2\right)+4 \imath a a_1-\imath a_0^2}{8 a^{3/2}}\\ q &=& -\frac{(2+2 \imath) \sqrt{a} a_2+(1-i) a_0 \left(\sqrt{1-4 b}+1\right)}{4 a^{3/4}} \end{eqnarray}$$ and $$u:=(-1)^{1/4} x/(\sqrt{2} a^{1/4})$$.

Again we used Mathematica to verify the result:

Clear[v]; Clear[y]; a =.; a0 =.; a1 =.; a2 =.; b =.; A =.; d =.; \
Clear[m]; Clear[y]; Clear[v];

m[x_] = E^(-((I x (a0 + a x))/(2 Sqrt[a]))) x^(
1/2 (1 + Sqrt[1 - 4 b]));
y[x_] = m[x] v[x];
ll = Collect[
Simplify[(D[
y[x], {x, 2}] + (a x^2 + a0 x + a1 + a2/x + b/x^2) y[x])/
m[x]], {v[x], v'[x], v''[x]}, Simplify];
ll = Collect[
Simplify[ll/Coefficient[ll, v''[x]]], {v[x], v'[x], v''[x], x^_},
Simplify];
Ab = (-1)^(1/4)/(Sqrt[2] a^(1/4));
subst = {x :> Ab x, Derivative[1][v][x] :> 1/Ab Derivative[1][v][x],
Derivative[2][v][x] :> 1/(Ab)^2 Derivative[2][v][x]};
ll1 = Collect[
Ab^2 (ll /. subst /. v[Ab x] :> v[x]), {v[x], v'[x], v''[x], x^_},
Simplify]


Now my question would be twofold.

Firstly, is there any mathematical software which can handle confluent Heun functions (just as Mathematica handles hypergeometric functions for example). Secondly, can we actually find similar solutions (i.e. map our ODE onto hte Heun equation) in the case when the coefficient at the function $$y(x)$$ in the ODE is an arbitrary polynomial of order strictly bigger than two ?

• Does MATLAB also helpful of transforming ODEs with applying specific change of variable? Commented Oct 17, 2020 at 10:57
• Honestly I never really used Matlab for those purposes. Yet having said that I do know that symbolic calculations are available in Matlab. Why are you asking ? Commented Oct 19, 2020 at 12:08

$$1.$$ ODE of the form $$\dfrac{d^2y}{dx^2}+(a_4x^4+a_3x^3+a_2x^2+a_1x+a_0)y=0$$ , $$a_4\neq0$$ can first convert to $$\dfrac{d^2y}{dt^2}+(b_4t^4+b_2t^2+b_1t+b_0)y=0$$ and then relates to Heun's Triconfluent Equation as above. The case of $$a_4=0$$ and $$a_3\neq0$$ is a big headache.
$$2.$$ ODE of the form $$(x+a)^2(x+b)^2\dfrac{d^2y}{dx^2}+(c_3x^3+c_2x^2+c_1x+c_0)y=0$$ , $$c_3\neq0$$ can convert to Heun's Confluent Equation by letting $$y=(x+a)^p(x+b)^qu$$ with choosing suitable values of $$p$$ and $$q$$ similar to Differential equation with nasty coefficients $$x^2(1-x)^2 y'' + (Ax + b)y = 0$$.