## Symplectic integration of a one-dimensional Hamiltonian system of permanent magnets oscillating in a gravitational field. - A mechanical analogue to a thermodynamic system.

##### Abstract

The objective of this work was to analyze a mechanical analogue to a thermodynamic system. The main goal was to investigate the temperature distribution in a vertical system of oscillating magnets in a gravitational field and assess whether the system could be used as a model of an atmosphere of an ideal gas. In order to answer this question it was necessary to integrate the equations of motion over a long time interval. The reason for this is that the thermodynamic interpretation reduced the mechanical phase space for each magnet to a common statistical interpretation. The long time interval guaranteed that a truly thermodynamic system of magnets would have enough time to occupy each state at least once during the integration.
Most of the work considered integration methods that ensured the integration remained on the energy surface throughout the interval, known as symplectic integration methods. A total of seven methods of different order and properties were derived, implemented and compared. The low order methods were used to study general properties of symplectic methods on the simple harmonic oscillator. It was shown that even though the symplectic methods conserved the phase space trajectory they caused the Hamiltonian (i.e. the total energy) to oscillate. Based on the simulations it was concluded that as long as the Hamiltonian was conserved to the fifth decimal place the symplectic method reproduced the analytical phase space trajectory. This was supported by the long-time simulations performed on a linear system of interacting ODEs with oscillatory solutions to compare the remaining six methods. It was found that the order of the numerical method is significant when considering oscillatory systems, i.e. adding symplectic property to a method will not compensate for the increased accuracy of a higher order method. The superior method was a third order symplectic Runge-Kutta-Nyström method (STRKN) that was designed to exactly integrate linear oscillatory systems. Furthermore, the method was superior to a fourth order Runge-Kutta-Nyström method; this implies that fitting the numerical method a-priori to the form of the solution of the system has a significant impact on the accuracy of the integration.
The simulations of the magnets showed that the probability density concerning the displacement of the velocity for all the magnets in the system could be described using the same Maxwell-Boltzmann density function. From this result it was conclude that, analogue to a thermodynamic system, the temperature was constant throughout. Additionally, the results showed that the probability density concerning the position displacement of each magnet around static equilibrium depends on the index of the magnet in the stack. The width of the density function, which describes the amplitude of the oscillations, increased towards the top of the stack. The thermodynamic analogue to this result is the density, which consequently decreases along the height. Subsequent simulations of systems with equal initial conditions but different total energy showed that the force of the system on the environment, analogue to the pressure, increased linearly. Based on the statistical analysis of the thermodynamic analogue of the results it was concluded that the system of magnets could be used as a model of an atmosphere of an ideal gas.