MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

NDSolve problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101657] NDSolve problem
  • From: Haibo Min <haibo.min at gmail.com>
  • Date: Sun, 12 Jul 2009 06:58:23 -0400 (EDT)

Hi, there.
These days, I am using mathematica to conduct a simulation which is composed
of a set of matrix ODEs. Maybe there is something wrong in my function
definition or the usage of NDSolve, when implementing the NDSolve function,
it always tells me that some part of my variables do not exist! I am really
puzzled by this. Since the simulation program is pretty short. I paste the
code here, thanks for your time and hints in advance.


S[Px_] := ( {
    {0, -Px[[3]], Px[[2]]},
    {Px[[3]], 0, -Px[[1]]},
    {-Px[[2]], Px[[1]], 0}
   } );
EE[err_] := 1/2 ( {
     {err[[2]], err[[3]], err[[4]]},
     {1 - err[[1]], -err[[4]], err[[3]]},
     {err[[4]], 1 - err[[1]], -err[[2]]},
     {-err[[3]], err[[2]], 1 - err[[1]]}
    } );
G[e_] := 1/2 ( {
      {1 - e[[1]], -e[[4]], e[[3]]},
      {e[[4]], 1 - e[[1]], -e[[2]]},
      {-e[[3]], e[[2]], 1 - e[[1]]}
     } ) - 1/4 IdentityMatrix[3];
J = ( {
    {4.35, 0, 0},
    {0, 4.337, 0},
    {0, 0, 3.664}
   } );
T = 5000; c = \[Pi]/T;
\[Omega][t_] := 1/5 {-5 cSin[2 ct], 8 cSin[4 ct], 4 cSin[2 ct]};
kq = 1.2; komega = 4; a = 5; b = 20;

NDSolve[{J.e2'[t] == -kq Transpose[EE[e1[t]]].e1[t] -
    komega (IdentityMatrix[3] + 4 Transpose[G[e1[t]]]).\[CurlyTheta][
       t] - (J.S[e2[t] + \[Omega][t]].(e2[t] + \[Omega][t]) +
      S[e2[t] + \[Omega][t]].J.(e2[t] + \[Omega][t])), \[CurlyTheta]'[
    t] == -a \[CurlyTheta][t] +
    b (1/4 IdentityMatrix[3] + G[e1[t]]).e2[t],
  e1'[t] == EE[e1[t]].e2[t],
  e1[0] == {1 + 0.3772, -0.4329, 0.6645, 0.4783}, \[CurlyTheta][
    0] == {0.3, 0.4, 0.2},
  e2[0] == {0.1, 0.2, 0.3}}, {e1, \[CurlyTheta], e2}, {t, 0, 500}]


When evaluating the above code, error occurs:
Part::partw: Part 2 of e1[t] does not exist. >>
Part::partw: Part 3 of e1[t] does not exist. >>
Part::partw: Part 4 of e1[t] does not exist. >>

It seems that mathematica does not know what e1 is since e1 is also a
parameter of EE and G, which are included in the ODE equation. Does that
mean that I have to give a definition of e1? But if so, it still doesn't
make sense in the NDSolve function...


Any suggestion will be appreciated.

Best regards,

Haibo



  • Prev by Date: Spell Check on a Mac
  • Next by Date: Mathematica Special Interest Group (Washington DC Area)
  • Previous by thread: Re: Spell Check on a Mac
  • Next by thread: Re: NDSolve problem