Message Boards Message Boards

0
|
5893 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Mathematica Problem for ODE's

Posted 11 years ago
Hi guys, Aaron the short here and I have a long problem  with ODE's,
I formed 3 equations dealing with 3 generalized coordinates for a lagrangian and the code is as below.
  {A, L, p, mu, MM, MP, rm, rp, Eo, n} = {62.83*10^-6, 10000, 1140,
  
     3.9877848*10^14, 5000, 1000, 0.5, 0.5, 5*10^9, 5};
  
  rt = Sqrt[(A/\[Pi])];
  
  
  
  T1 = 0;
 
 R[t] = 6728000;
 
 R'[t] = 0;
 
 R''[t] = 0;
 
 \[Theta]'[t] = Sqrt[(mu/R[t]^3)];
 
 \[Theta][t] = \[Theta]'[t]*t;
 
 \[Theta]''[t] = 0;
 
 
 
 
 
 eqnq2 = (\[CurlyPhi]^\[Prime]\[Prime])[
 
      t] ((2 A L^2 p)/\[Pi] + A L p q1[t]) + (3 A Eo \[Pi]^4 q2[t])/(
 
    16 L^3) - (3 A Eo \[Pi]^4 q1[t]^2 q2[t])/(4 L^3) +
 
    A L p  (q2^\[Prime]\[Prime])[t] + (\[Pi]^2 q2[t] T1)/L + (
 
    3 \[Pi]^4 q1[t]^2 q2[t] T1)/(4 L^3) + (3 \[Pi]^4 q2[t]^3 T1)/(
 
    8 L^3) -
 
    2 A L p  Derivative[1][\[CurlyPhi]][t] q2[t] Derivative[
 
      1][\[Theta]][t] +
 
    2 A L p Derivative[1][q1][t] (
 
      Derivative[1][\[CurlyPhi]][t] + Derivative[1][\[Theta]][t]) -
 
    A L p q2[t] (
 
      Derivative[1][\[CurlyPhi]][t]^2 +
 
       Derivative[1][\[Theta]][t]^2) + ((2 A L^2 p)/\[Pi] +
 
       A L p q1[t])  (\[Theta]^\[Prime]\[Prime])[t];
 
 
 
 
 
 eqnq1 = (A Eo \[Pi]^2 q1[t])/L + A L p (q1^\[Prime]\[Prime])[t] -
 
    A L p  (\[CurlyPhi]^\[Prime]\[Prime])[t] q2[t] - (
 
    3 A Eo \[Pi]^4 q1[t] q2[t]^2)/(4 L^3) + (15 \[Pi]^4 q1[t]^3 T1)/(
 
    8 L^3) + (3 \[Pi]^4 q1[t] q2[t]^2 T1)/(4 L^3) -
 
    Derivative[1][\[CurlyPhi]][
 
      t] ((4 A L^2 p)/\[Pi] + 2 A L p q1[t])  Derivative[1][\[Theta]][
 
      t] - 2 A L p Derivative[1][q2][t] (
 
      Derivative[1][\[CurlyPhi]][t] + Derivative[1][\[Theta]][t]) - ((
 
       2 A L^2 p)/\[Pi] + A L p q1[t]) (
 
      Derivative[1][\[CurlyPhi]][t]^2 + Derivative[1][\[Theta]][t]^2) -
 
     A L p q2[t] (\[Theta]^\[Prime]\[Prime])[t];
 
 
 
 
 
 
 
 
 
 eqnpsi = 2 L^2 MP  (\[CurlyPhi]^\[Prime]\[Prime])[t] +
 
    5/6 A L^3 p  (\[CurlyPhi]^\[Prime]\[Prime])[t] + (
 
    4 A L^2 p  (\[CurlyPhi]^\[Prime]\[Prime])[t] q1[t])/\[Pi] +
 
    A L p  (\[CurlyPhi]^\[Prime]\[Prime])[t] q1[t]^2 + (
 
    4 A L^2 p  Derivative[1][\[CurlyPhi]][t] Derivative[1][q1][
 
      t])/\[Pi] +

   2 A L p  Derivative[1][\[CurlyPhi]][t] q1[t] Derivative[1][q1][t] -

    A L p (q1^\[Prime]\[Prime])[t] q2[t] +

   A L p  (\[CurlyPhi]^\[Prime]\[Prime])[t] q2[t]^2 +

   2 A L p  Derivative[1][\[CurlyPhi]][t] q2[t] Derivative[1][q2][

     t] + (2 A L^2 p  (q2^\[Prime]\[Prime])[t])/\[Pi] +

   A L p q1[t] (q2^\[Prime]\[Prime])[t] +

   1/2 MM  (\[CurlyPhi]^\[Prime]\[Prime])[t] rm^2 +

   MP  (\[CurlyPhi]^\[Prime]\[Prime])[t] rp^2 +

   1/2 A L p  (\[CurlyPhi]^\[Prime]\[Prime])[t] rt^2 + (

   4 A L^2 p Derivative[1][q1][t]  Derivative[1][\[Theta]][

     t])/\[Pi] +

   2 A L p q1[t] Derivative[1][q1][t]  Derivative[1][\[Theta]][t] +

   2 A L p q2[t] Derivative[1][q2][t]  Derivative[1][\[Theta]][t] +

   2 L^2 MP  (\[Theta]^\[Prime]\[Prime])[t] +

   5/6 A L^3 p  (\[Theta]^\[Prime]\[Prime])[t] + (

   4 A L^2 p q1[t] (\[Theta]^\[Prime]\[Prime])[t])/\[Pi] +

   A L p q1[t]^2 (\[Theta]^\[Prime]\[Prime])[t] +

   A L p q2[t]^2 (\[Theta]^\[Prime]\[Prime])[t] +

   1/2 MM rm^2  (\[Theta]^\[Prime]\[Prime])[t] +

   MP rp^2  (\[Theta]^\[Prime]\[Prime])[t] +

   1/2 A L p rt^2  (\[Theta]^\[Prime]\[Prime])[t] + (

   L M2 mu R[t] Sin[\[CurlyPhi][t]])/(L^2 + R[t]^2 -

     2 L R[t] Cos[\[CurlyPhi][t]])^(3/2) - (

   L M1 mu R[t] Sin[\[CurlyPhi][t]])/(L^2 + R[t]^2 +

     2 L R[t] Cos[\[CurlyPhi][t]])^(3/2) + \!\(

\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(n\)]

\*FractionBox[\(A\ \((\(-2\) + 4\ i)\)\

\*SuperscriptBox[\(L\), \(2\)]\ mu\ p\ R[

       t]\ Sin[\[CurlyPhi][t]]\), \(4\

\*SuperscriptBox[\(n\), \(2\)]\

\*SuperscriptBox[\((

\*FractionBox[\(

\*SuperscriptBox[\((\(-1\) + 2\ i)\), \(2\)]\

\*SuperscriptBox[\(L\), \(2\)]\), \(4\

\*SuperscriptBox[\(n\), \(2\)]\)] + \

\*SuperscriptBox[\(R[t]\), \(2\)] -

\*FractionBox[\(\((\(-2\) + 4\ i)\)\ L\ R[

            t]\ Cos[\[CurlyPhi][t]]\), \(2\ n\)])\), \(3/

        2\)]\)]\) - \!\(

\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(n\)]

\*FractionBox[\(A\ \((\(-2\) + 4\ i)\)\

\*SuperscriptBox[\(L\), \(2\)]\ mu\ p\ R[

       t]\ Sin[\[CurlyPhi][t]]\), \(4\

\*SuperscriptBox[\(n\), \(2\)]\

\*SuperscriptBox[\((

\*FractionBox[\(

\*SuperscriptBox[\((\(-1\) + 2\ i)\), \(2\)]\

\*SuperscriptBox[\(L\), \(2\)]\), \(4\

\*SuperscriptBox[\(n\), \(2\)]\)] + \

\*SuperscriptBox[\(R[t]\), \(2\)] +

\*FractionBox[\(\((\(-2\) + 4\ i)\)\ L\ R[

            t]\ Cos[\[CurlyPhi][t]]\), \(2\ n\)])\), \(3/2\)]\)]\);









system1 =

  NDSolve[{eqnq2 == 0, eqnq1 == 0, eqnpsi == 0, q2[0] == 0.01, 

    Derivative[1][q2][0] == 0.01, q1[0] == 0.01,

    Derivative[1][q1][0] ==

     0.01, \[CurlyPhi][0] == -0.9, \[CurlyPhi]'[0] == 0.01}, { q2,

    q1, \[CurlyPhi]}, {t, 0, 54908.9}, MaxSteps -> Infinity];

Plot[Evaluate[ \[CurlyPhi][t] /. system1], {t, 0, 54908.9},

Frame -> True, LabelStyle -> Directive[12],

FrameTicks -> {{All,

    None}, {All, {{0, "0"}, {10981.8, "2"}, {21963.6, "4"}, {32945.4,

      "6"}, {43927.1, "8"}, {54908.9, "10"}}}},

FrameLabel -> {{"Angular Displacement (rad)", None}, {"time (s)",

    "Number of Orbits"}}]

when I run it , there's an error " stating try to give initial conditions for both values and derivatives of the functions.

How do I go about doing so ? Thank a lot. Appreciate your effort in even readin this. Cheers.

-Aaron Aw -
POSTED BY: Aaron Aw
2 Replies
Is your equation elliptic?  Or better, is it an evolution equation?

There is a huge difference in numerically solving an evolution equation and a nonevolution equation. NDSolve solves evolution equations. 

The first step is to create the simplest possible version of the kind of equation you are trying to solve and  then to try solving that.
POSTED BY: Sean Clarke
Here's an example from the documentation
s = NDSolve[{y''[x] + Sin[y[x]] y[x] == 0, y[0] == 1, y'[0] == 0},
  y, {x, 0, 30}]
http://reference.wolfram.com/mathematica/ref/NDSolve.html
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract