# Symplectic algorithm

1. Feb 1, 2006

### Heimdall

Hi,

I have this hamiltonian
$$K = \frac{1}{2}(P_1^2 + P_2^2) + P_1 Q_2 - P_2 Q_1 - (\frac{1-\mu}{R_1}+\frac{\mu}{R_2})$$
(see this link if there is any latex problem)

with non separable variables.

I am looking for a symplectic algorithm (runge kutta would be good) to solve the correspondant first order equations, but I can't find it on the internet.

moreover it seems difficult and I don't understand enough what is a symplectic algorithm to code do it by myself..

thx a lot.

Last edited: Feb 1, 2006
2. Feb 2, 2006

### saltydog

Well, for starters are these those:

$$\frac{dP_1}{dt}=\frac{\partial K}{\partial P_2},\quad \frac{dP_2}{dt}=-\frac{\partial K}{\partial P_1}$$

$$\frac{dQ_1}{dt}=\frac{\partial K}{\partial Q_2},\quad \frac{dQ_2}{dt}=-\frac{\partial K}{\partial Q_1}$$

$$\frac{dR_1}{dt}=\frac{\partial K}{\partial R_2},\quad \frac{dR_2}{dt}=-\frac{\partial K}{\partial R_1}$$

What then are the initial conditions?

3. Feb 2, 2006

### saltydog

Know what, I'm just gonna' run with this. Someone in the group just recently said, "you don't do mathematics by just staring at the problem and hope it comes to you".

Anyway, Mathematica has a method called "SymplecticPartitionedRungeKutta". I shall wish to try this method once I figure out how symplectic methods differ from just regular numerical methods as I advocate learning the technique (in general) before using it in some math package. Perhaps I should just start with a pendulum first. Someone else said, "sometimes you have to take two steps backwards in order to move forwards". Might take a while.

4. Feb 3, 2006

### saltydog

For the record my equations posted above are totally incorrect and stems from my lack of familiarity with Hamilitoian sytems in general. But that's ok cus' I ain't staring and I'm not standing still. So it's 3:00a and I need to get up in a few hours to go to work. Well, that would mean I'm already sleeping but I'm fiddling with this instead. Whatever. Anyway I've learned that the Hamiltonian is conserved in Hamiltonian systems and that is the origin of the problem to seek symplectic methods in their numerical solution: most numerical methods do not preserve the constancy of the hamiltonian. Methods which do are called symplectic. Anyway, I have some references to work with and will pick it up later. Think I'll try and get in an hour or 2 of sleep. :zzz:

5. Feb 9, 2006

### saltydog

Some time ago I worked on what I considered a very beautiful problem (well ugly if you're a . . . nevermind). It's called an integral invariant of Poincare'. At the time, I didn't understand the connection to Hamiltonian systems. If you allow a set of initial points to evolve according to a Hamiltonian flow (run all the Hamiltonian differential equations for some time on a set of initial points and then compare the initial set of points to the set of final points), then a certain "measure" of the points is preserved in the flow. This is compactly expressed by the following integral invariant:

$$\sum_{i=n}\oint_{\omega_i} p_idq_i=C$$

That is, the sum of areas projected onto the set of $(p_i,q_i)$ planes is constant. This is shown graphically in the attached plot. I wish to verify this with a real set of Hamiltonian equations but I digress.

Well, symplectic numerical methods are designed to preserve this measure. Consider first the undamped pendulum:

$$\frac{dq}{dt}=p$$

$$\frac{dp}{dt}=-Sin(q)$$

The Hamiltonian function is:

$$H(q,p)=1/2 p^2-Cos(q)$$

The standard (non-symplectic) Euler method for this system would be:

$$q_{k+1}=q_k+hp_k$$

$$p_{k+1}=p_k-hSin(q_k)$$

A phase portrait (q vs. p) for 100 seconds is shown in the second plot. It's dissapating and not reflective of the actual dynamics of an undamped pendulum. A plot of the hamiltonian function would reveal a curve with a non-constant slope.

We can slightly modify this method and convert it to a symplectic form as follows:

$$q_{k+1}=q_k+hp_{k+1}$$

$$p_{k+1}=p_k-hSin(q_k)$$

The phase-portrait of this numerical simulation for 100 seconds is shown in the 3rd plot and reflects the actual dynamics of an undamped pendulum (back and forth and never loosing energy, that is the energy remains constant and reflects the invariant measure of Hamiltonian systems. A plot of the hamiltonian function for this simulation would be a straight line with zero slope. (can we get two more spaces for plots?)

#### Attached Files:

File size:
2 KB
Views:
170
File size:
22.8 KB
Views:
157
• ###### symplectic euler.JPG
File size:
7.3 KB
Views:
139
Last edited: Feb 9, 2006