s[n_] = n^2 - 2 n + 3
RSolve[a[n + 1] == s[n + 1] - s[n], a[n], n]
The above example shows that the general term formula of the sequence should be in a piecewise form. When n==1, a 1==s 1=2, when n is greater than or equal to 2, a [n]=2n-3
The above code calculation result reported an error
For some branches of the general solution, the given boundary
conditions lead to an empty solution
According to the characteristics of the summation formula. It is a quadratic function with constant term 3. So its general term formula must be in the form of subsection, that is, when n=1, its first term a 1==1, which can be calculated by a 1==s 1. When n is greater than or equal to 2, a [n]=2n-3 is calculated by a [n]==s [n] - s [n-1]. Obviously, when n=1, 2 * 1-3=- 1<>a 1, so finally a [n] should write its general term formula in the form of subsection.
The format in the picture is the final result I want
RSolve
expects a recurrence, and this is not in fact a recurrence. ThoughRSolve
could give a more informative message I guess. $\endgroup$