# Heun functions and boundary conditions

Using the Mathematica Heun functions, is there are simple way to get the solution of the same equation satisfied by HeunG[z], but with the boundary condition $$f(z=0)=0$$ instead of $$f(z=0)=1$$?

• Please include code as well. I am not sure that I understand your question yet. Dec 21 '21 at 19:00
• Roberto, can you briefly explain why you need a solution to the Heun equation satisfying that particular initial condition? Dec 23 '21 at 10:51

eqn = z (z - 1) (z - a) y''[
z] + ((z - 1) (z - a) γ + z (z - a) δ +
z (z - 1) (1 + α + β - γ - δ)) y'[
z] + (α β z - q) y[z] == 0;

sol = DSolve[eqn, y, z][[1]]

(* {y -> Function[{z},
C[1] HeunG[a, q, α, β, γ, δ, z] +
z^(1 - γ) C[2] HeunG[a,
q - (-1 + γ) (1 + α + β - γ + (-1 + a) δ),
1 + β - γ, 1 + α - γ, 2 - γ, δ, z]]} *)


Verifying the solution,

eqn /. sol // Simplify

(* True *)


Evaluating for z == 0

y[z] /. sol /. z -> 0

(* C[1] + 0^(1 - γ) C[2] *)


For z == 0, the function is 1 for {C[1] -> 1, C[2] -> 0}

sol1 = y[z] /. sol /. {C[1] -> 1, C[2] -> 0}

(* HeunG[a, q, α, β, γ, δ, z] *)


Verifying,

sol1 /. z -> 0

(* 1 *)


The function is 0 in the limit for {C[1] -> 0, C[2] -> 1}

sol0 = y[z] /. sol /. {C[1] -> 0, C[2] -> 1}

(* z^(1 - γ) HeunG[a,
q - (-1 + γ) (1 + α + β - γ + (-1 + a) δ),
1 + β - γ, 1 + α - γ, 2 - γ, δ, z] *)


Verifying,

(lim = Limit[sol0, z -> 0]) // InputForm

(* ConditionalExpression[0,
Element[(-q + (-1 + γ)*(1 + α + β - γ +
(-1 + a)*δ))/a, Reals] && γ < 1] *)


The requested solution is then

(sol = ConditionalExpression[sol0, lim[[-1]]]) //
InputForm

(* ConditionalExpression[
z^(1 - γ)*HeunG[a,
q - (-1 + γ)*(1 + α + β - γ + (-1 + a)*δ),
1 + β - γ, 1 + α - γ, 2 - γ, δ, z],
Element[(-q + (-1 + γ)*(1 + α + β - γ +
(-1 + a)*δ))/a, Reals] && γ < 1] *)

• Nice analysis @bob-hanlon! And generally speaking Mathematica's DSolve is able to solve boundary problem like this: DSolve[{eqn, y[0] == 0, y[1/2] == 1/2}, y, z] where the eqn is the equation from your comment. However, one should be very-very careful working with solutions of ODE's at singular points (z=0 is singular for the general Heun's ODE as well as for the Hypergeometric2F1's ODE) as the output of DSolve might be not what was expected. @roberto-merlin could you please develop further the discussion? Dec 23 '21 at 8:40

This is an interesting question. Generally speaking z = 0 is a regular singular point for the general Heun ODE. And in this point the Peano existence theorem fails (as well as at z = 1, a, ∞).

DSolve is able to solve the boundary value problem:

eqHeunG = z (z - 1) (z - a) y''[
z] + ((z - 1) (z - a) γ + z (z - a) δ +
z (z - 1) (1 + α + β - γ - δ)) y'[
z] + (α β z - q) y[z] == 0;

DSolve[{eqHeunG, y[0] == 0, y[1/2] == 1/2}, y, z]


However, one should be very careful with the boundary points to get a solution (for example taking {y[0] == 0, y[1] == C[2]} will not lead to solution).