2
$\begingroup$

When I evaluate the following RecurrenceTable expression

RecurrenceTable[
  {x[n + 1] == x[n] + 0.1 y[n], 
   y[n + 1] == y[n] + 0.1 z[n],
   z[n] == x[n] + 1,
   x[1] == 2., y[1] == 3.}, 
  {x, y, z}, {n, 1, 10}]

it does what I expect. However, if I change the x[n] + 1 into x[n]^2, it no longer works, despite the fact that there is no circularity in the table. I don't see why it would make a difference what z is as a function of x.

What's the reason for this behavior? Is it documented?

$\endgroup$
  • 1
    $\begingroup$ The Scope - Difference-Algebraic Equations section of the reference page for RecurrenceTable gives an example of "a linear difference-algebraic equation with constant coefficients". Maybe a nonlinear one is outside the scope? In your example, you could define z[n_] := x[n]^2 outside the RecurrenceTable I think. $\endgroup$ – Chris K Mar 25 '18 at 1:02
6
$\begingroup$

Eliminating the decimal points fixes the problem

N[RecurrenceTable[
{x[n + 1] == x[n] + 1/10 y[n], 
y[n + 1] == y[n] + 1/10z[n],
z[n] == x[n]^2,
x[1] == 2, y[1] == 3}, {x, y, z}, {n, 1, 10}]]

gives

{{2.,3.,4.},{2.3,3.4,5.29},{2.64,3.929,6.9696},{3.0329,4.62596,9.19848}, 
{3.4955,5.54581,12.2185},{4.05008,6.76766,16.4031},{4.72684,8.40797,22.343}, 
{5.56764,10.6423,30.9986},{6.63187,13.7421,43.9817}, 
{8.00608,18.1403,64.0973}}

Perhaps it is a pattern matching problem fighting inexact decimals

| improve this answer | |
$\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.