Plotting with NestList[]

So I want to use the NestList[] function, but i'm not sure how to achieve this for a system of equations like I have here $P_{n+1} = (rP_n +sQ_n)(1 - \frac{P_n + Q_n}{100}), \; Q_{n+1} = P_n$. Does anyone know how to do this?

I have (where x is P and y is Q)

PP[s_, x_, y_] := (rx + s y) (1 - (x + y)/100)
QQ[x_] := x


where r is a constant and s is a variable. This means the equilibrium of this system will depend on s.

but don't know how to set up the NestList[] function for this. If this was one function I would do something like NestList[f,x,5]. So in the end I want to have a list of coordinates.

As another example of what I want, see the first example in this

• What do you mean by (where x is P and y is Q)? – Dr. belisarius Mar 21 '16 at 15:18
• @Dr.belisarius Sorry, it seems I had neglected to include the original system I was given. I meant that I am using the symbol $x$ instead of $P$ and the symbol $y$ instead of $Q$ for my Mathematica code. It doesn't really matter I suppose. – Ozera Mar 21 '16 at 15:21
• I'm not sure I understand your question @JasonB. The QQ[] function represents the $Q_{n+1} = P_n$ equation. – Ozera Mar 21 '16 at 15:30

You have a recurrence relation, so use RecurrenceTable

RecurrenceTable[{Q[n + 1] == P[n],
P[n + 1] == (r P[n] + s Q[n]) (1 - (P[n] + Q[n])/100),
P[0] == 1,
Q[0] == 1}, {P, Q}, {n, 2}]

(* {{1, 1}, {(49 (r + s))/50, 1},
{(s + 49/50 r (r + s)) (1 + 1/100 (-1 - (49 (r + s))/50)), (49 (r + s))/50}} *)

• Very neat! I didn't know about the RecurrenceTable command. It seems like what you wrote gives the exact same output as what @Dr.Belisarius wrote. – Ozera Mar 21 '16 at 15:39
• @Ozera Next time ask what you want. And if you don't know what you want, say it. – Dr. belisarius Mar 21 '16 at 15:50
NestList[Function[{p, q}, {(r p + s q) (1 - (p + q)/100), p}][Sequence @@ #] &,
{1, 1}, 2]

(* {{1, 1}, {(49 (r + s))/50, 1},
{(s + 49/50 r (r + s)) (1 + 1/100 (-1 - (49 (r + s))/50)), (49 (r + s))/50}}*)

• Thank you for answering! Do you mind explaining what [Sequence @@ #] & does? I am not familiar with it. – Ozera Mar 21 '16 at 15:31
mat[r_, s_, n_, i_] :=
With[{mx = {{r, s}, {1, 0}} - {{1/100, 1/100}, {0, 0}}},
MatrixPower[mx, n].i]


e.g.

With[{n = Range[0, 4]},
TableForm[Expand@mat[r, s, #, {1, 1}] & /@ n,
TableHeadings -> {n, {"P", "Q"}}, TableAlignments -> Center]]


or

DiscretePlot[Evaluate@mat[1, 1, x, {1, 1}], {x, 0, 5},
PlotLegends -> {"P", "Q"}]


Apologies for any errors or misunderstanding.