Package: desolver
DESolverThis is a python package for solving Initial Value Problems using various numerical integrators.
Many integration routines are included ranging from fixed step to symplectic to adaptive integrators.DocumentationDocumentation is now available atdesolver docs! This will be updated with new examples as they are written, currently the examples show the use ofpyaudi.Latest Release4.2.0- Improved performance of implicit methods, added embedded implicit methods following Kroulíková (2017) for fully implicit adaptive integration.4.1.0- Initial release of implicit integration schemes that use a basic newton-raphson algorithm to solve for the intermediate states.3.0.0- PyAudi support has been finalised. It is now possible to do numerical integrations usinggdualvariables such asgdual_double,gdual_vdoubleandgdual_real128(only on select platforms, refer topyaudi docsfor more information). Install desolver with pyaudi support usingpip install desolver[pyaudi]. Documentation has also been added and is available atdesolver docs.2.5.0- Event detection has been added to the module. It is now possible to do numerical integration with terminal and non-terminal events.2.2.0- PyTorch backend is now implemented. It is now possible to numerically integrate a system of equations that use pytorch tensors and then compute gradients from these.Use of PyTorch backend requires installation of PyTorch fromhere.To Install:Just typepip install desolverImplemented Integration MethodsExplicit MethodsAdaptive MethodsRunge-Kutta 14(12) (Feagin, 2009)Runge-Kutta 10(8) (Feagin, 2009)Runge-Kutta 8(7) (Dormand & Prince, 1980)Runge-Kutta 4(5) with Cash-Karp CoefficientsAdaptive Heun-Euler MethodFixed Step MethodsSymplectic BABs9o7H Method  (Mads & Nielsen, 2015, BAB’s9o7H)Symplectic ABAs5o6HA Method (Mads & Nielsen, 2015, ABAs5o6H)Runge-Kutta 5 - The 5th order integrator from RK45 with Cash-Karp Coefficients.Runge-Kutta 4 - The classic RK4 integratorMidpoint MethodHeun’s MethodEuler’s MethodEuler-Trapezoidal MethodImplicit Methods [NEW]Adaptive MethodsLobatto IIIC 4(2) (Kroulíková, 2017)Radau IIA 5(2) (Kroulíková, 2017)Fixed Step MethodsBackward EulerImplicit MidpointCrank-NicolsonLobatto IIIA 2Lobatto IIIB 2Lobatto IIIC 2Radau IA 3Radau IIA 3Lobatto IIIA 4Lobatto IIIB 4Gauss-Legendre 4Radau IA 5Radau IIA  6Minimal Working ExampleThis example shows the integration of a harmonic oscillator using DESolver.importdesolverasdeimportdesolver.backendasDdefrhs(t,state,k,m,**kwargs):returnD.array([[0.0,1.0],[-k/m,0.0]])@statey_init=D.array([1.,0.])a=de.OdeSystem(rhs,y0=y_init,dense_output=True,t=(0,2*D.pi),dt=0.01,rtol=1e-9,atol=1e-9,constants=dict(k=1.0,m=1.0))print(a)a.integrate()print(a)print("If the integration was successful and correct, a[0].y and a[-1].y should be near identical.")print("a[0].y  ={}".format(a[0].y))print("a[-1].y ={}".format(a[-1].y))print("Maximum difference from initial state after one oscillation cycle:{}".format(D.max(D.abs(a[0].y-a[-1].y))))ReferencesFeagin, T. (2009). High-Order Explicit Runge-Kutta Methods. Retrieved fromhttps://sce.uhcl.edu/rungekutta/Dormand, J. R. and Prince, P. J. (1980) A family of embedded Runge-Kutta formulae.Journal of Computational and Applied Mathematics, 6(1), 19-26.https://doi.org/10.1016/0771-050X(80)90013-3Mads, K. and Nielsen, E. (2015).Efficient fourth order symplectic integrators for near-harmonic separable Hamiltonian systems. Retrieved fromhttps://arxiv.org/abs/1501.04345Kroulíková, T. (2017). RUNGE-KUTTA METHODS (Master’s thesis, BRNO UNIVERSITY OF TECHNOLOGY, Brno, Czechia). Retrieved fromhttps://www.vutbr.cz/www_base/zav_prace_soubor_verejne.php?file_id=174714