2
$\begingroup$

When I use RSolve to solve the recurrence: $S(n)=\dfrac{1}{-S(n-1)-2},S(1)=-2/3$, it gives an empty solution:

however the solution should be:$S(n)=-\dfrac{n+1}{n+2}$

Did I do something wrong?

$\endgroup$
  • 2
    $\begingroup$ FindSequenceFunction[ RecurrenceTable[{s[n] == 1/(-2 - s[n - 1]), s[1] == -2/3}, s, {n, 1, 10}], n] finds the solution $-(n+1)/(n+2)`. $\endgroup$ – kglr May 29 at 13:33
  • $\begingroup$ @kglr I know this method, but how Mathematica gives an empty solution? $\endgroup$ – FFjet May 29 at 13:42
  • 1
    $\begingroup$ Because,Mathematica is not a magic box that'll spit out a solution to any problem. $\endgroup$ – Mariusz Iwaniuk May 29 at 15:12
3
$\begingroup$

This seems to be a "feature" of RSolve[]. Notice the following code

RSolve[{s[n] == 1/(-2 - s[n - 1])}, s[n], n] // Simplify

returns {{s[n] -> -1}} and this does satisfy the recursion equation, but not the intial condition which is why it returned no solutions in your attempt. However, as you found out, there is a parametrized family of solutions given by

s[ n_] := -(n + k)/(n + k + 1);

which apparently RSolve does not find. You should be aware that the capabilities of RSolve and other *Solve functions are limited and subject to change. Perhaps in a later version of Mathematica it will be able to find this family of solutions.

Also, as user 'kgir' mentioned in a comment, it is possible to use

FindSequenceFunction[ RecurrenceTable[
  {s[n] == 1/(-2 - s[n - 1]), s[1] == -2/3}, s, {n, 1, 10}], n ]]

to find the solution you are looking for. Both of these functions also have limititations on their capabilities but they can be a good alternative.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.