This is a follow-up of the question Finding a function/differential equation from a 2nd order recurrence relation, I asked yesterday. The reason why I didn't edit the original question was that in case it could have closed form solution, I would like to update the post. This one however is focused on numerics.
Let's say I have two polynomial sequences parameterised by m: $A_n(m;z)$ and $B_n(m;z)$
They are defined as follows(following @Mariusz Iwaniuk's approach):
k=1;
f[z_, m_, k_, inf_] :=
Last@RecurrenceTable[{A[n + 2] == (n (n + m + 1/2) + z) A[n + 1] +
k^2 n (n - 1/2) A[n], A[1] == 1, A[2] == z}, A[n], {n, 1, inf}];
g[z_, m_, k_, inf_] :=
Last@RecurrenceTable[{B[n + 2] == (n (n + m + 1/2) + z) B[n + 1] +
k^2 n (n - 1/2) B[n],
B[1] == 0, B[2] == 1}, B[n], {n, 1, inf}];
Note that the form of the recurrence relations for the two are exactly same, except for the starting values.
Following are two problems I am facing:
Finding the zeros of the ratio of $f$ and $g$
I want to find the roots of $$h(m;z)\equiv \lim_{n\to \infty}\frac{A_n(m;z)}{B_n(m;z)}=\frac{f(m;z)}{g(m;z)}$$
The problem is that as the polynomials are growing extremely rapidly I am not able to just say:
Table[{m,
z /. NSolve[f[z, m, 1, 20]/g[z,m,1,20] == 0 && RealAbs[z] < 500, z,
Reals]}, {m, -1000, 1000, 1}];
to find all the zeros of $h(m;z)$ with $m=0,\pm1,\pm2,...,\pm1000$ and $|z|<500$ as it takes forever to calculate zeros for just one value of m.
The numerator($f(m;z)$) and denominator($g(m;z)$) are similar and so its necessary to see if they have common roots, in which case, the no of roots of the ratio will be less than the roots of just $f(m;z)$.
- Probing the pattern in the zeros by varying $inf$, polynomial order that approximates the otherwise infinite series
Also, I want to understand pattern in the roots. The zeros of both the numerator and the denominator seem to have an interesting pattern:
tab = Table[{m,
z /. NSolve[f[z, m, 1, 20] == 0 && RealAbs[z] < 500, z,
Reals]}, {m, -1000, 1000, 1}];
ListPlot[FlattenAt[#, 1] &@(Tuples[{{#[[1]]}, #[[2]]}] & /@ tab)]
Will this pattern stay for the ratio($h(m;z)$)?
Help will be appreciated.
Edit:
I managed to get the zeros of the ratio for:
tab = Table[{m,
z /. NSolve[
f[z, m, 1, 10]/g[z, m, 1, 10] == 0 && RealAbs[z] < 500, z,
Reals]}, {m, -100, 100, 1}];
ListPlot[FlattenAt[#, 1] &@(Tuples[{{#[[1]]}, #[[2]]}] & /@ tab)]
I need to further confirm whether the pattern stay if I start cranking up the value of inf
from a mere 10.