# Solving a nonlinear system of recurrence equations

I am having two problems regarding Mathematica, and both of them are happening because it does not accept such inputs:

RSolve[ g[n + 1] == g[n]^2 + 2*f[n]^2, f[n + 1] == 2f[n]*g[n]]


and

RSolve[ g[n + 1] == g[n]^2 + sum[ f[n - 1, i], i = 0..n-1], f[n,x]== (n!)/((x!)*(n-x)!)]


And I have no idea how to provide the correct input for such equations that Mathematica understands.

• You are missing an n argument. There are examples in help reference.wolfram.com/mathematica/ref/RSolve.html – Nasser Nov 16 '13 at 12:46
• Also, the correct syntax for Sum is Sum[expr,{i,0,n-1}] – Peltio Nov 16 '13 at 12:48
• If you wish getting helpful answers you should provide a bit more constructive question. First improve it by rewriting the code involving acceptable syntax. However in the case of your equations I suggest to start playing with RecurrenceTable or imposing appropriate initial/boundary conditions e.g. f == 1/3 && g == 1/2. – Artes Nov 16 '13 at 13:51
• @lkn2993 You should correct the syntax in the question, then perhaps someone finds your problem interesting to solve it. I suggested to try finding appropriate initial conditions as well. – Artes Nov 16 '13 at 15:26
• From my reading of the documentation RSolve will not accept nonlinear equations in two or more variables. What little experimentation I've done tends to confirm this. – m_goldberg Nov 17 '13 at 0:19

EDIT

In the following the role of f and g have been inadvertently exchanged,i.e.

$f(n)=f(n-1)^2+2 g(n-1)^2$ and $g(n)=2 f(n-1)g(n-1)$

Therefore, just exchange.

The values can be obtained by defining the recursive functions with suitable starting values for f and g. I present alternatives.

It is relatively straightforward to uncouple the relations: $h(n)=f(n)+\sqrt{2}g(n)$ and $j(n)=f(n)-\sqrt{2}g(n)$ the recurrence then becomes:

$h(n)=h(n-1)^2$

$j(n)=j(n-1)^2$

then the solutions are:

$h(n)=(h(0))^{2^n}$

$j(n)=(j(0))^{2^n}$

then solving by back substitution.

For example, f(0)=g(0)=1 yields (for $n\geq1$:

$f(n)= (1+\sqrt{2})^{2^n}+(1-\sqrt{2})^{2^n}$

$g(n)= \frac{(1+\sqrt{2})^{2^n}-(1-\sqrt{2})^{2^n}}{2\sqrt{2}}$

You can also solve and tabulate as follows:

matf={{1,0},{0,2}};
matg={{0,2},{0,0}};
r[n_]:=NestList[{#.matf.#,#.matg.#}&,{1,1},n];


To tabulate first 5 results (and initial conditions):

TableForm[r, TableHeadings -> {Range - 1, {f[n], g[n]}}] 