How do I define the following recurrence relation in Mathematica?
$$ q_0 = \sqrt{w + 2 \epsilon J},\ q_n = \frac{\epsilon\left(J_n q_0 + \sum\limits_{m=1}^{n-1} \left(J_{n-m} + J_{n+m}\right)q_m\right)}{\epsilon\left(2J - J_{2n}\right) +w}, n \geq 1 $$
where $J_n := |n|^{1+\alpha}$ and $J = 1$ and $\epsilon = 1$ and $w = 1$.
Attempt:
J[n_, m_, \[Alpha]_] := 1/(n - m)^(1 + \[Alpha]);
q[n_, \[Epsilon]_, \[Alpha]_,
w_] := \[Epsilon] (J[n, 0, \[Alpha]]*q[0] +
Sum[(J[n, m, \[Alpha]] + J[n, -m, \[Alpha]])*q[m], {m, 1,
n - 1}])/(\[Epsilon] (2*1 - J[2*n, 0, \[Alpha]]) + w)
q[0, 1, 1, 1] = Sqrt[w + 2 \[Epsilon]];
However, this syntax is not correct. For example,
q[5, 1, 1, 1]
yields $\frac{100}{299} \left(\frac{13 q(1)}{144}+\frac{58 q(2)}{441}+\frac{17 q(3)}{64}+\frac{82 q(4)}{81}+\frac{1}{25} \sqrt{w+2 \epsilon }\right)$. This should be a number, but instead the symbolic representation is given. Why are the $q(i)$ not numbers?
Update: New relation. Mimicking the method in the Answer provided below, I obtain a sequence I do not expect.
$$ g_0 = g_1= \sqrt{w+\epsilon(2J - J_1)},\ g_n = \frac{\epsilon\sum\limits_{m=1}^{n-1} \left(J_{n-m} + J_{n+m-1}\right)g_m}{\epsilon\left(2J - J_{2n-1}\right) + w}, n \geq 2$$
LatticeEndIndex = 10;
g[0, \[Epsilon]_, \[Alpha]_, w_] :=
Sqrt[w + \[Epsilon] (2 J[0, \[Alpha]] - J[1, \[Alpha]])]
g[1, \[Epsilon]_, \[Alpha]_, w_] :=
Sqrt[w + \[Epsilon] (2 J[0, \[Alpha]] - J[1, \[Alpha]])]
g[n_Integer?Positive, \[Epsilon]_, \[Alpha]_, w_] :=
g[n, \[Epsilon], \[Alpha],
w] = \[Epsilon] Sum[(J[n - m, \[Alpha]] + J[n + m - 1, \[Alpha]])*
g[m, \[Epsilon], \[Alpha], w], {m, 1,
n - 1}]/(\[Epsilon] (2*J[0, \[Alpha]] -
J[2*n - 1, \[Alpha]]) + w) // Simplify
offsiteSequence = g[#, 1, 1, 1] & /@ Range[0, LatticeEndIndex ]
This yields $$\left\{\sqrt{2},0,0,0,0,0,0,0,0,0,0\right\}$$ However, I expected this to be a sequence of non-zero values. In particular, since $g_0 = g_1$, then why is the second slot of the sequence vanishing?
onsiteSequenceyou usedqwhere you presumably intended to useg$\endgroup$Clearcommand to get rid of some interfering variables. $\endgroup$