You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These codes are examples of solving ordinary differential equations using the finite difference method, the method of runge kutta of order 4, scipy's "odeint" function and other methods.
Some codes also feature an animation of the solution.
The "neōn_katalogos" file (as the name might suggest) is a list containing several examples of implicit, explicit and symplectic ode-solving algorithms; all of them, for simplicity are applied to the harmonic oscillator. Some of them are also in the file ode.c
We briefly present the various methods used, each of these, unless otherwise specified, is contained as an example in the file neōn katalogos:
Initial value problem
Euler
The former are Euler's methods, classical, implicit and semi-implicit (the latter symplectic).
If we have the following:
the value of the coefficients d_i and c_i are in the code
Prediction and correction
We can also use multiple integrators through the prediction and correction method.
In this code it is implemented using the classic euler and the trapezoidal rule.
With classical Euler we do the prevision and then correct them with trapezoidal rule:
The following is a fourth-order predictor-corrector method using an explicit Adams-Bashforth scheme as a predictor and an implicit Adams-Moulton scheme as a corrector. To get started, three points of the solution are needed, which are calculated using an RK4
A technique that is not used in the neōn katalogos code is the shooting method, because it was made for boundary value problems and not for initial value problems.
It allows you to solve a boundary value problem by reducing it to the system of an initial value problem as we can see in shooting.py.
In this code we use the first derivative in t = 0 as a parameter that is not known and we try to find the value for which the solution takes the correct value on the boundary.
(we remember that in general the solution isn't unique for boundary problems)
So now the problem become to find the solution of the following equation:
$$
F(s) = y(t_1; s) - y_1 = 0
$$
In some particular case, as in Schrodinger's equation where the initial condition are known, if the potential is even, we can use the energy as parameter.
Two examples are in buca quadrata e osc.arm-s (see repository: quantum-mechanics)
The basic idea is, once we have our nonlinear system, linearize it and solve it. Starting from an initial guess, for example, a straight line connecting the two points that are the boundary conditions, the algorithm relaxes towards the solution of the equation.
To solve the system we use the Newton method:
The adaptive.py code is an example of an integrator with an adaptive step (Runge–Kutta–Fehlberg method and Cash-Karp Runga-Kutta Method), i.e. the integration step changes during the simulation.