# Trying to solve recursion using rsolve

I'm new to Mathematica, and I'm trying to use RSolve to solve an equation I couldn't do in Matlab, as I got errors there too. This is the system I'm trying to solve:

M = 1000;
Z = 1;
LB = 0.72;
n = 0.01;
a = 0.5;
k = 1;

R = n^(-1/3)*a;
h = (R - a)/M;
Element[j, integers];

r[j_] := a + j*h;

RSolve[{f[r[j]] == ((k^2)*
Sinh[f[r[j - 1]]] + (2*f[r[j - 1]] - f[r[j - 2]])/(h^2) +
f[r[j - 2]]/(h*(r[j - 1])))/(1/(h^2) + 1/(h*(r[j - 1]))),
f[a] == p0,
f[a + h] ==
p0 - Z*LB*h/(a^2)},
f[r[j]], {j, 2, M}]


Am I using RSolve right? I even tried using something like integer values for f[r[j]], but it just keeps returning the input.

The equations come from a second order differential equation phi''+(2/r) phi'=k^2 sinh(phi), which I want to solve with the expressions I found for the differences.

• This recursion probably does not have a closed-form solution. Also, {j, 2, M} should be replaced by j. Finally, f[r[j]] etc. may confuse RSolve. Using f[j] might be better. – bbgodfrey Apr 19 at 1:47