A package for integrating oscillating second order differential equations
The integrators are described in [2]. They make use of trigonometric functions to take advantage of known structure of the solution, as proposed by [4], after whom this package is named.
The matrix functions appearing in the integrators can be evaluated by symmetric diagonalization or by using PyWkm, which is a private package at the moment. Both of these methods can also be combined with the (restarted) Lanczos-method for evaluating matrix functions times a vector.
See examples/
for example usage of the integrators for a Fermi-Pasta-Ulam-Tsingou problem.
The central function is solve_ivp
in integrate.py
.
It is modeled after the Scipy function of the same name, but has differing in- and outputs.
See the METHODS
dictionary in integrate.py
for the available one- and two-step configurations of the gautschiIntegrators.
The matrix functions are evaluated by an instance of the MatrixFunctionEvaluator
base class.
Subclasses need to implement the calculation of TridiagDiagonalizationEvaluator
.
The code of PyWkm needs to be copied into a folder pywkm
for usage in this repository.
This package does not use low-level methods from its dependencies, so I would expect it to work with any current Numpy
and Scipy versions.
environment.yml
gives specifications for a Conda environment that this package has been used with.
Gautschi-type integrators have usually been evaluated on test problems inspired by the Fermi-Pasta-Ulam-Tsingou experiment, e.g., in [2].
FermiPastaUlamTsingou.py
contains a single frequency example from Section XIII.2.1 of [3].
FPUTMultiFrequency.py
contains a multi frequency example from [1].
FPUTMultiFrequencyLanczos.py
is a variation of the former with longer vectors, so that the Lanczos method can be used to approximate the matrix functions.
The git branch titled fermi-pasta-lanczos-experiment
contains the multi-frequency Fermi-Pasta-Ulam-Tsingou problem inspired
by [1] in FPUTMultiFrequencyLanczosLonger.py
.
It is similar to FPUTMultiFrequencyLanczos.py
, but simulates a longer time.
[1] D. Cohen, E. Hairer, and Ch. Lubich, “Numerical Energy Conservation for Multi-Frequency Oscillatory Differential Equations,” Bit Numer Math, vol. 45, no. 2, pp. 287–305, Jun. 2005, doi: 10.1007/s10543-005-7121-z.
[2] E. Hairer and C. Lubich, “Long-Time Energy Conservation of Numerical Methods for Oscillatory Differential Equations,” SIAM J. Numer. Anal., vol. 38, no. 2, pp. 414–441, Jul. 2000, doi: 10.1137/S0036142999353594.
[3] E. Hairer, G. Wanner, and C. Lubich, Geometric Numerical Integration, vol. 31. in Springer Series in Computational Mathematics, vol. 31. Berlin/Heidelberg: Springer-Verlag, 2006. doi: 10.1007/3-540-30666-8.
[4] W. Gautschi, “Numerical integration of ordinary differential equations based on trigonometric polynomials,” Numerische Mathematik, vol. 3, no. 1, pp. 381–397, Dec. 1961, doi: 10.1007/BF01386037.