Hajo's Homepage
Numerical Physics: Calculate, Don't Simulate

Numerical Physics

Numerical methods have long played an important role in physics research. The programming environment "Numerical Physics" is intended to facilitate the treatment of this topic in school lessons with the help of a simple programming language that is not cluttered by input, output and graphical commands. These are separated into a programming preamble and are not necessary to understand the actual programme. In contrast to the usual simulations, it is thus comprehensible how the result is achieved via the known simple basic equations.

The part of the programme that the students have to understand only contains equations like F = m a or sn = sn+1 + v Δt. With these, for example, the course of a spring oscillation can be represented, as a graph as well as a simulation. Since the programme can handle vector calculations, planetary motions, electron orbits in the magnetic field (including the possible spiral orbit) or the Rutherford experiment can be presented with similar ease.

Even complex topics such as infinitely high square well or energy distribution in an ideal gas can be dealt with, but with a greater programming effort. In other subjects such as biology, e.g. the predator-prey relationship, can also be illustrated with this programme.

The examples mentioned are briefly presented below. Example programmes and explanations can be downloaded in the "Download" section under "Examples.zip" or "AllInOne".
A Simple Programm: Projectile Motion
It could hardly be easier: Only the equations for rectilinear motion and constant acceleration are needed, but in a loop with a very short period of time Δt in each cycle.
But already here the strengths of the programming environment become visible: separation of physics from input, output and graphics, mastery of vector calcu­lation, display of a simulation instead of graphics, and in the case of simulations, synchronisation with real time.

Another Simple Programm: Spring Oscillations

The definition of velocity and acceleration, Hook's law and Newton's basic equation are required. With these, starting from the initial values, the next position and velocity of the oscillating mass. This is repeated in a loop.
Damped Oscillation:

By adding a damping term, damped oscillations can also be illustrated. The representation in phase space can also be easily realised by replacing the time with the second variable (impulse or velocity) in the GRAPH command.

Coupled Oscillatons:

The same programme as above, but twice. In addition, there is the coupling force with different signs for the two springsv (marked with colour in the program code). You can clearly see how the energy moves back and forth between the two springs.

Coupled Oscillations as Animation:

This is essentially the same programme as before. The difference between the display as a graph or simulation is a single instruction in the definition part.

In addition, the time course can be synchronised with the real time. Without coupling, the period of a mass here is 2.0 s.

Vektor Calculus: Lorentz Force

The programming language is capable of vector calculations. This makes it possible, for example, to calculate planetary orbits and the orbits of charged particles in the magnetic field as easily as the spring oscillation. Here you see the spiral path of an electron in the magnetic field.
The operator for the cross product is #.

Solar System
With the help of vector calculus, the 3-body problem can also be treated. If possible the pictures enlarged by right-clicking the mouse.

In the programme on the left, the mutual forces of the Sun, Earth and Moon are calculated. (The effect on the sun can be ignored because of its large mass.) The distance Earth-Moon is calculated as the difference of the vectors Sun-Earth and Sun-Moon.

In the programme on the right, the mutual forces of Earth and Moon are taken into account. One can see how the Earth rotates around the common centre of gravity (white point). (Put the mouse on this point to see that it doen't move. Enlarge the picture, e.g. with the mouse wheel.)

Quantum Physics:
The mathematics of DeBroglie waves in the time-independent Schroedinger equation is the same as for spring oscillations. The (infinitely high as well as the finite) potential well can be treated with with the same method.
However, the programme is considerably more elaborate: by iterating the energy of the particle, a non-diverging state must be sought.

Ideal Gas:
Numerical Physics also allows statistical investigations. Here, the energy distribution of the particles in the ideal gas is calculated. For comparison, the theoretical curve is also shown.
All np particles receive an initial energy T, then each one collides nc times with each other. The new energies are given by the equations for the elastic collision.

Other Natural Sciences
e. g. Biology: Predator-Prey-Relation:

This programming environment can also be used for other natural sciences.

In biology, e.g., the predator-prey relationship can be treated using the Lotka-Volterra equations (populations changing in time, or as phase diagram).