Skip to content

Latest commit

 

History

History
96 lines (48 loc) · 15.7 KB

README.md

File metadata and controls

96 lines (48 loc) · 15.7 KB

ODE

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:

Euler

The former are Euler's methods, classical, implicit and semi-implicit (the latter symplectic)

it is easy to verify the advantage of the latter method compared to the previous two as it is associated with a canonical transformation.

Mid-point

Another first order method and symplectic integrator is the midpoint method that we present in its implicit and explicit formulation: implicit:

explicit:

velocity verlet

Another algorithm is verlet velocity integration, a symplectic method:

Runge-Kutta 4

A method that could not miss the is :runge kutta of 4 th order:

if f=f(t) this method became Cavalieri-Simpson rule

Yoshida4

If we wanted a symplectic integrator of higher order we can use Yoshida4:

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:

adams-bashforth-moulton, order 4

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

Boundary problem

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)

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)

Adaptive integrator

The adaptive.py code is an example of an integrator with an adaptive step (Runge–Kutta–Fehlberg method and Cash-Karp Runga-Kutta Method (to do) ), i.e. the integration step changes during the simulation. To test it, as always, the harmonic oscillator is used. Brief explanation of the method:

The coefficients are reported in the code.