I am using RSolve to solve for a function defined recursively, with two boundary conditions:
- First boundary condition describes the relationship between $f(1)$ and $f(0)$
- Second boundary condition describes the relationship between $f(S)$ and $f(S-1)$
This way the function should be defined between $0$ and $S$, and for all $0<s<S$ it should follow the recursive relationship. Here is my code:
Clear[f, g, s, \[Sigma], \[Theta], \[Delta], \[Beta], S]
eq1 = f[s - 1]*\[Sigma]*\[Theta] +
f[s + 1]*\[Delta]*(s +
1) - (\[Sigma]*\[Theta] + \[Delta]*s + \[Beta]) f[s] == 0;
eq2 = f[1]*\[Delta] - f[0]*\[Sigma]*\[Theta] + \[Beta]*(1 - f[0]) == 0;
eq3 = f[S - 1]*\[Sigma]*\[Theta] - (\[Delta]*S + \[Beta]) f[S] == 0;
sols = RSolveValue[{eq1, eq2, eq3}, {f[s]}, s]
$RecursionLimit = 100000;
newfn[s_] := Evaluate[sols];
c1 = Solve[Sum[newfn[s], {s, 0, Infinity}] == 1, {C[1]}][[1]];
newfn[s] /. c1
After solving for the function I ideally want to impose the condition that $\sum_{s\geq 0} f(s) = 1 $ to pin down the constant $c_1$. However, when I run the code above
sols = RSolveValue[{eq1, eq2, eq3}, {f[s]}, s]
part does not run: outputting me the evaluation for the input.
Any help or tips would be greatly appreciated! Thanks.