# Obtaining numerical value from Recurrence Table

I'm trying to analyze the following sequence of numbers:

$$a_1 = 2 \quad \text{ s.t } \quad a_n = 4\sum_{i=1}^{n}a_i$$ I wrote the following code for creating a Recurrence Table for this sequence of numbers:

rt = RecurrenceTable[{a[n + 1] == 4 Sum[a[n], {1, n}], a == 2}, a, {n, 1, 10}]


But, I'm facing the following issue, when I try to evaluate the actual numerical value, I'm getting the following format as output:

$$rt[] = 4 \times \sum_{1}^{1}2$$

Even when I run

N[rt[]


The output is

4. NSum[2, {1, 1}]


The ouput for the FullForm is:

\!$$TagBox[ StyleBox[ RowBox[{"Times", "[", RowBox[{"4", ",", RowBox[{"Sum", "[", RowBox[{"2", ",", RowBox[{"List", "[", RowBox[{"1", ",", "1"}], "]"}]}], "]"}]}], "]"}], ShowSpecialCharacters->False, ShowStringCharacters->True, NumberMarks->True], FullForm]$$


Any tips on how to get the numerical values? Is the error in the actual function for the definition of the Recurrence Table?

• Já tentou usar LaTex? Oct 14, 2020 at 20:07

a = 2;
a[n_] := a[n] = 4 Sum[a[i], {i, n - 1}]

Table[a[n], {n, 1, 10}]


{2, 8, 40, 200, 1000, 5000, 25000, 125000, 625000, 3125000}

• Thanks for the answer! Do you know what is wrong with my code? Why I can't get the numerical value? Sep 12, 2020 at 23:45

You can introduce a memory variable b[n] and solve for both a[n] and b[n].

RecurrenceTable[{a[n + 1] == 4 b[n], b[n] == b[n - 1] + a[n],
a == b == 2}, {a, b}, {n, 1, 10}][[All, 1]]

(*   {2, 8, 40, 200, 1000, 5000, 25000, 125000, 625000, 3125000}   *)

Clear["Global*"]


In your code, you have the wrong syntax for the Sum. However, even with the correct syntax

rt = RecurrenceTable[{a[n + 1] == 4 Sum[a[i], {i, 1, n}], a == 2},
a, {n, 1, 10}] As stated in the error message, all instances of a[_] must have arguments of the form n + integer

Amplifying on the answer by Suba Thomas

a = 2;
a[n_] := a[n] = 4 Sum[a[i], {i, n - 1}]

seq = Table[a[n], {n, 1, 10}]

(* {2, 8, 40, 200, 1000, 5000, 25000, 125000, 625000, 3125000} *)


You can use FindSequenceFunction to generalize from the sequence

y[n_] = FindSequenceFunction[seq, n] a == y

(* True *)
`
• This FindSequenceFunction is pretty neat! Thanks for showing. Sep 13, 2020 at 1:58