.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_build/auto_examples/convergence/EFT_RungeKutta.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr__build_auto_examples_convergence_EFT_RungeKutta.py: Benchmark of Error-Free Transforms for ODE IVP ============================================== .. GENERATED FROM PYTHON SOURCE LINES 7-8 This benchmark compares accuracy and efficiency of several summation algorithms in floating point arithmetics for initial value problems of ordinary differential equations .. GENERATED FROM PYTHON SOURCE LINES 8-31 .. code-block:: Python eq_names = [ "y'' = -y" , "y'' = - exp(y)" , "y'' = xy" , "y' = Az; z' = By" , ] implicit_methods = { f'{rk_name} {order}' : choreo.scipy_plus.multiprec_tables.ComputeImplicitRKTable_Gauss(order, method=rk_name) for rk_name, order in itertools.product(["Gauss"], [2,4,6,8]) } explicit_methods = { rk_name : getattr(globals()['precomputed_tables'], rk_name) for rk_name in [ 'McAte4' , 'McAte5' , 'KahanLi8' , 'SofSpa10' , ] } .. GENERATED FROM PYTHON SOURCE LINES 118-119 The following plots give the measured relative error as a function of the number of quadrature subintervals .. GENERATED FROM PYTHON SOURCE LINES 119-123 .. code-block:: Python plt.show() .. image-sg:: /_build/auto_examples/convergence/images/sphx_glr_EFT_RungeKutta_001.png :alt: Relative error on integrand y'' = -y, Relative error on integrand y'' = - exp(y), Relative error on integrand y'' = xy, Relative error on integrand y' = Az; z' = By :srcset: /_build/auto_examples/convergence/images/sphx_glr_EFT_RungeKutta_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 172-173 Error as a function of running time .. GENERATED FROM PYTHON SOURCE LINES 173-178 .. code-block:: Python plt.show() .. image-sg:: /_build/auto_examples/convergence/images/sphx_glr_EFT_RungeKutta_002.png :alt: Computational cost (s) as a function of number of iterations for equation y'' = -y, Computational cost (s) as a function of number of iterations for equation y'' = - exp(y), Computational cost (s) as a function of number of iterations for equation y'' = xy, Computational cost (s) as a function of number of iterations for equation y' = Az; z' = By :srcset: /_build/auto_examples/convergence/images/sphx_glr_EFT_RungeKutta_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.406 seconds) .. _sphx_glr_download__build_auto_examples_convergence_EFT_RungeKutta.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: EFT_RungeKutta.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: EFT_RungeKutta.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_