2
$\begingroup$

I am trying to understand how to compute a recursive equation backward say n = 10 to n = 1. I am trying to solve a PDE for which the solution is only known in at some future time and that future value can be used to find a value at an earlier time. Can you please help me understand how I can get following series of multiples of 7 starting from 10th element which is 7. I tried the following code, but it did not work.

RecurrenceTable[a[n - 1] == 3 a[n], a[10] == 7, a, {n, 10, 1, -1}]
$\endgroup$
  • $\begingroup$ You could do a forward recurrence with a[1]==x and then solve for x at the end. $\endgroup$ – b.gates.you.know.what May 2 '15 at 9:13
  • $\begingroup$ did you suggest RecurrenceTable[{a[n + 1] == 3 a[n], a[1] == x[1], a[10] == 7}, {a, x}, {n, 1, 10}]. I get a error "RecurrenceTable::underdet: There are more dependent variables than equations, so the system is underdetermined" $\endgroup$ – Kausik May 2 '15 at 9:24
  • $\begingroup$ Try aux = RecurrenceTable[{a[n - 1] == 3 a[n], a[1] == x}, a, {n, 1, 10}]; aux /. Solve[Last[aux] == 7, x]. $\endgroup$ – b.gates.you.know.what May 2 '15 at 11:31
  • $\begingroup$ Many thanks for that. I will use it solve FDE $\endgroup$ – Kausik May 2 '15 at 11:38
5
$\begingroup$

b.gatessucks solution given in a comment should be recorded answer.

aux = RecurrenceTable[{a[n - 1] == 3 a[n], a[1] == x}, a, {n, 10}]
{x, x/3, x/9, x/27, x/81, x/243, x/729, x/2187, x/6561, x/19683}
First[aux /. Solve[Last[aux] == 7, x]]
{137781, 45927, 15309, 5103, 1701, 567, 189, 63, 21, 7}

But, of course, in this simple case there is

Reverse @ NestList[3 # &, 7, 9]
$\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.