1
$\begingroup$
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.

$\endgroup$
8
  • 2
    $\begingroup$ I can't reproduce your problems, but I do get the same input as output. $\endgroup$
    – Sektor
    May 22, 2015 at 11:02
  • $\begingroup$ Are you using mathematica 10? $\endgroup$
    – lyna
    May 22, 2015 at 11:02
  • $\begingroup$ Yes, and I am running v.9 - same output $\endgroup$
    – Sektor
    May 22, 2015 at 11:03
  • $\begingroup$ Can you add some initial conditions ? $\endgroup$
    – Sektor
    May 22, 2015 at 11:09
  • $\begingroup$ 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[Times[<<2>>]]\y[\ n]))/Sqrt[Plus[<<2>>]^2+Plus[<<2>>]^2],y[n]+(10(-g[n]\Sin[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 $\endgroup$
    – lyna
    May 22, 2015 at 11:12

1 Answer 1

4
$\begingroup$

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"}]

enter image description here

Apologies for any transcription errors of your recursive relations.

$\endgroup$
2
  • $\begingroup$ 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 $\endgroup$
    – lyna
    May 22, 2015 at 11:57
  • $\begingroup$ @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. $\endgroup$
    – Sektor
    May 22, 2015 at 12:20

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.