I am trying to numerically solve the recurrence relation for:(adsbygoogle = window.adsbygoogle || []).push({});

$$ T[n]=\frac{sm}{2\hbar^2i k_n}(T[n-1]+T[n+1]) \\

k_n=(\frac{2m(E-\hbar \omega n)}{\hbar^2})^{1/2}$$

My code is:

Taking all the constants to be 1, except E which I have plugged to be zero, to ensure non negative root.Code (Text):

RecurrenceTable[{Tn[

n] == (s*

m/(2*\[HBar]^2*

I*(2*m*(En - \[HBar]*\[Omega]*n)/\[HBar]^2)^(1/2)))*(Tn[

n - 1] + Tn[n + 1]), Tn[-2] == 1, Tn[2] == 1}, Tn, {n, -2, 2}]

I think I need my seed values to be $$T_{-2}$$ and $$T_{2} (=1)$$ so it's at the end of the boundary but I keep getting the error that the recursion depth of 1024 has been exceeded and I've tried "Block" and set it as high as possible without crashing the kernel to no avail. If I plug $$T_{-2}=T_{-1}=1$$ I actually get an answer but if I use interpolating to see what this looks like it's blowing up exponentially (I'm taking the Abs of it as complex). I was told to look for convergence but to me, this seems like divergence, which may be due to not being able to set the end points.

How can I actually plug end points in to get a reasonable answer?

Thanks in advance, and apologies for my lack of coding ability, I'm very new to Mathematica.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica Numerically solve recurrence relation

Have something to add?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**