MathGroup Archive 2009

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

Search the Archive

Problems with NDSolve and SymplecticPartitionedRungeKutta method

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102124] Problems with NDSolve and SymplecticPartitionedRungeKutta method
  • From: James <titch.jones at gmail.com>
  • Date: Thu, 30 Jul 2009 05:31:22 -0400 (EDT)

Hi,

I am trying to solve a set of differential equations, using
Mathematica's NDSolve function. I would like to produce a symplectic
solution, and so am trying to solve the problem using the NDSolve
method SymplecticPartitionedRungeKutta. However, I receive an error,
that I do not understand, using this method. Using the other Runge
Kutta methods works, as well as setting the method to Automatic. Can
anyone shed any light on what I am doing wrong?

Example code is posted below, and can be found as a notebook at
<http://www.astec.ac.uk/staff/jones/NDSolveProblemExample.nb>.

Clear[TrajectoryF3D];
TrajectoryF3D[] :=
 Block[{a1 = 6.695, q = -586.6792516042472, s, LF = 0.058782},
  G = 20.56952366997071;
  K = 3;
  sxF3D = NDSolve[{
     x'[s] == -((Px[s] (-1 - K x[s]))/
       Sqrt[-1 + G^2 - Px[s]^2 - Pz[s]^2]),
     Px'[s] ==
      K Sqrt[-1 + G^2 - Px[s]^2 - Pz[s]^2] +
       q (-((Sqrt[-1 + G^2] K)/(2 q)) - a1 x[s]) (1 + K x[s]) +
       q K (-((Sqrt[-1 + G^2] (1 + K x[s]))/(2 q)) +
          1/2 a1 (-x[s]^2 + z[s]^2)),
     z'[s] == -((Pz[s] (-1 - K x[s]))/
       Sqrt[-1 + G^2 - Px[s]^2 - Pz[s]^2]),
     Pz'[s] == a1 q (1 + K x[s]) z[s],
     z[0] == 0,
     Pz[0] == 0,
     x[0] == 0.01,
     Px[0] == 0
     }, {x, Px, z, Pz}, {s, 0, LF},
    Method -> {"SymplecticPartitionedRungeKutta",
      "PositionVariables" -> {x, z}}];
  ]

data3D = TrajectoryF3D[];

NDSolve::nlnum1: The function value {-0.00129312 (-1.-3. x[0.]),0.
(-1.-3. x[0.])} is not a list of numbers with dimensions {2} when the
arguments are {0.,0.0265673,0.}. >>


Any help would be very much appreciated.
Many Thanks,

James Jones


  • Prev by Date: Re: Mathematica syntax in W|A
  • Next by Date: Determining Frequency Distributon and Applying Rules
  • Previous by thread: Re: Thoughts on a Wolfram|Alpha
  • Next by thread: Determining Frequency Distributon and Applying Rules