# RSolve: Recursive function is not a valid variable

RSolve[{
g[n + 1] == g[n] + 10*(g[n]*Cos[-10 Degree] – y[n]*Sin[-10 Degree])/
Sqrt[(g[n]*Cos[-10 Degree] – y[n]*Sin[-10 Degree])^2 + (g[n]*Sin[-10 Degree] +
y[n]*Cos[-10 Degree])^2],
y[n + 1] == y[n] + 10*(g[n]*Sin[-10 Degree] + y[n]*Cos[-10 Degree])/
Sqrt[(g[n]*Cos[-10 Degree] – y[n]*Sin[-10 Degree])^2 + (g[n]*Sin[-10 Degree] +
y[n]*Cos[-10 Degree])^2],
g[0] == 100,
y[0] == 100}, {g[n], y[n]}, n]

When I run it I get the following error

Solve::ivar: “g[n]+(10(Cos[10]\g[n]+Sin[10]\y[n]))/Sqrt[(-g[<<1>>] Sin[<<1>>]+Cos[<<1>>] y[<<1>>])^2+(Cos[<<1>>] g[<<1>>]+Sin[<<1>>] y[<<1>>])^2] is not a valid variable.”

I believe that it might be an error with my syntax, but I have no idea what it is.

=================

2

I can’t reproduce your problems, but I do get the same input as output.
– Sektor
May 22 ’15 at 11:02

Are you using mathematica 10?
– lyna
May 22 ’15 at 11:02

Yes, and I am running v.9 – same output
– Sektor
May 22 ’15 at 11:03

Can you add some initial conditions ?
– Sektor
May 22 ’15 at 11:09

To the code I added “, g[0] == 100, y[0] == 100” after the ^2]. “Equation or list of equations expected instead of True in the first \ argument {g[n]+(10(Cos[10]\g[n]+Sin[10]\y[n]))/Sqrt[Plus[<<2>>]^2‌​+\ Plus[<<2>>]^2]==g[n]+(10(Cos[Times[<<2>>]]\g[n]+Sin[Time‌​s[<<2>>]]\y[\ n]))/Sqrt[Plus[<<2>>]^2+Plus[<<2>>]^2],y[n]+(10(-g[n]\Si‌​n[10]+Cos[10]\ \y[n]))/Sqrt[Plus[<<2>>]^2+Plus[<<2>>]^2]==y[n]+(10(-g[n‌​]\Sin[Times[<\ <2>>]]+Cos[Times[<<2>>]]\y[n]))/Sqrt[Plus[<<2>>]^2+Plus[<<2>‌​>]^2],\ True,True}” is the new error
– lyna
May 22 ’15 at 11:12

=================

1

=================

If you are not seeking an analytic solution you could numericize:

f[u_, v_] := With[{c = -10 Degree},
N@{u + 10 (u Cos[c] – v Sin[c])/
Sqrt[(u Cos[c] – v Sin[c])^2 + (u Sin[c] + v Cos[c])^2],
v + 10 (u Sin[c] + v Cos[c])/
Sqrt[(u Cos[c] – v Sin[c])^2 + (u Sin[c] + v Cos[c])^2]
}]
s[n_, a_, b_] := Nest[f @@ # &, {a, b}, n]

Visualizing:

Manipulate[
ListPlot[Table[s[j, p[[1]], p[[2]]], {j, 0, 20}], Frame -> True,
FrameLabel -> {“g(n)”, “y(n)”},
Epilog -> {Red, PointSize[0.02], Point[p]}], {{p, {100, 100}}, {1,
1}, {200, 200}, Appearance -> “Labeled”}]

Apologies for any transcription errors of your recursive relations.

I think this well help me quite a bit, I will go work on it for a bit and then let you know my result :3
– lyna
May 22 ’15 at 11:57

@lyna You can upvote this answer if you find it helpful using the arrows and you can accept it if you think it answers your question.
– Sektor
May 22 ’15 at 12:20