3
$\begingroup$

The relationship between the known sum and the general term is as follows:

s[n] == a[n]^2 + 1/2 a[n] - 14

How to find the general term formula a [n]

RSolve[{s[n] == a[n]^2 + 1/2 a[n] - 14, a[n] == s[n] - s[n - 1]}, 
 a[n], n]

RSolve::overdet: There are fewer dependent variables than equations, so the system is overdetermined.

$\endgroup$
0

3 Answers 3

1
$\begingroup$

We solve s[n] at first. (we replace a[n] with s[n] - s[n - 1] and set s[0]==0)

sol = RSolve[{s[n] == (s[n] - s[n - 1])^2 + 1/2 (s[n] - s[n - 1]) - 
     14, s[0] == 0}, s, n]
a[n_] = s[n] - s[n - 1] /. sol[[1]] // Simplify
s[n] == a[n]^2 + 1/2 a[n] - 14 /. sol[[1]] // Simplify

1/2 (-8 + n).

a[n_] = s[n] - s[n - 1] /. sol[[2]] // Simplify
s[n] == a[n]^2 + 1/2 a[n] - 14 /. sol[[2]] // Simplify

(7 + n)/2.

$\endgroup$
4
  • $\begingroup$ Does your answer contradict the result of RSolve[{s[n] == a[n]^2 + 1/2 a[n] - 14, a[n] == s[n] - s[n - 1]}, {a[n], s[n]}, n] which is {}? $\endgroup$
    – user64494
    Apr 29, 2023 at 16:11
  • $\begingroup$ You actually missed 2 solutions, please check my answer. $\endgroup$
    – yarchik
    Apr 29, 2023 at 16:19
  • $\begingroup$ @yarchik: I prefer arguments over empty words. s[n]==(7 + n)/2 implies a[n]==1/2, but think of s[n] == a[n]^2 + 1/2 a[n] - 14 $\endgroup$
    – user64494
    Apr 29, 2023 at 16:36
  • 1
    $\begingroup$ @user64494 My comment was not directed to you. $\endgroup$
    – yarchik
    Apr 29, 2023 at 16:55
4
$\begingroup$

Without loss of generality we can set $s(0)=0$ and search for a sequence $a(n)$, where $n\ge1$. Using $$ a(n)=s(n)-s(n-1),\quad n\ge1 $$

we obtain

RSolve[a[n]^2 + 1/2 a[n] - (a[n - 1]^2 + 1/2 a[n - 1]) == a[n], a[n], n]
    (*{{a[n] -> (-1)^(-1 + n) C[1]}, {a[n] -> n/2 + C[1]}}*)

It remains to determine the constant C[1].

Case 1. $$a(n)=(-1)^{(n-1)} C[1].$$ Let us tabulate a few values of $n$ and find the constant that fulfills all equations

y[n_] := (-1)^(-1 + n) C[1]
Solve[Table[Sum[y[k], {k, n}] == -14 + 
   1/2 (-1)^(-1 + n) C[1] + (-1)^(-2 + 2 n) C[1]^2, {n, 5}]]
(*{{C[1] -> -(7/2)}, {C[1] -> 4}}*)

Thus $$a_1(n)=-4(-1)^{n};\\ a_2(n)=\frac{7}{2}(-1)^{n}. $$

Case 2. $$ a(n)=\frac{n}{2}+C[1]. $$

Here we can proceed similarly

x[n_] := n/2 + C[1]
SolveAlways[Sum[x[k], {k, n}] == x[n]^2 + 1/2 x[n] - 14, n]
(*{{C[1] -> -4}, {C[1] -> 7/2}}*)

$$a_3(n)=\frac{n}{2}-4;\\ a_4(n)=\frac{n}{2}+\frac72. $$

Thus, there are 4 solutions.

Verification.

a[1, n_] := -4 (-1)^n
a[2, n_] := 7/2 (-1)^n
a[3, n_] := n/2 + 7/2
a[4, n_] := n/2 - 4
Do[
 Print[AllTrue[
   Table[Sum[a[i, k], {k, n}] == a[i, n]^2 + a[i, n]/2 - 14, {n, 1, 13}], Identity]], {i, 4}]
(*
True
True
True
True
*)
$\endgroup$
3
  • 1
    $\begingroup$ Does your answer contradict the result of RSolve[{s[n] == a[n]^2 + 1/2 a[n] - 14, a[n] == s[n] - s[n - 1]}, {a[n], s[n]}, n] which is {}? $\endgroup$
    – user64494
    Apr 29, 2023 at 16:13
  • $\begingroup$ @user64494 Yes, looks like that. $\endgroup$
    – yarchik
    Apr 29, 2023 at 16:22
  • 1
    $\begingroup$ Nice. It seems RSolve cannot handle a "difference-algebraic equation". Here's a way, perhaps not great: raiseorder = {s[n] == a[n]^2 + 1/2 a[n] - 14, a[n] == s[n] - s[n - 1]} /. {{n -> n}, {n -> n - 1}} // Flatten // Eliminate[#, Union@Cases[#, _[n - 2], Infinity]] &; rsol0 = RSolve[Eliminate[raiseorder, {s[n], s[n - 1]}], {a[n]}, n]; Transpose@{rsol0, First@Solve[Eliminate[raiseorder, {a[n - 1], s[n - 1]}], s[n]] /. rsol0} $\endgroup$
    – Michael E2
    Apr 30, 2023 at 19:01
0
$\begingroup$
RSolve[{s[n] == a[n]^2 + 1/2 a[n] - 14,    a[n] == s[n] - s[n - 1]}, {a[n], s[n]},n]

{}

No solution.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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