.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ode/ode_problem/plot_van_der_pol.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_examples_ode_ode_problem_plot_van_der_pol.py: Solve an ODE: the Van der Pol problem ===================================== .. GENERATED FROM PYTHON SOURCE LINES 22-38 .. code-block:: Python from __future__ import annotations from typing import TYPE_CHECKING import matplotlib.pyplot as plt from numpy import array from numpy import zeros from gemseo.algos.ode.factory import ODESolverLibraryFactory from gemseo.algos.ode.ode_problem import ODEProblem from gemseo.problems.ode.van_der_pol import VanDerPol if TYPE_CHECKING: from gemseo.typing import RealArray .. GENERATED FROM PYTHON SOURCE LINES 39-85 This tutorial describes how to solve an ordinary differential equation (ODE) problem with |g|. A first-order ODE is a differential equation that can be written as .. math:: \frac{ds(t)}{dt} = f(t, s(t)) where the right-hand side of the equation :math:`f(t, s(t))` is a function of time :math:`t` and of a state :math:`s(t)` that returns another state :math:`\frac{ds(t)}{dt}` (see Hartman, Philip (2002) [1964], Ordinary differential equations, Classics in Applied Mathematics, vol. 38, Philadelphia: Society for Industrial and Applied Mathematics). To solve this equation, initial conditions must be set: .. math:: s(t_0) = s_0 For this example, we consider the Van der Pol equation as an example of a time-independent problem. Solving the Van der Pol time-independent problem ------------------------------------------------ The Van der Pol problem describes the position over time of an oscillator with non-linear damping: .. math:: \frac{d^2 x(t)}{dt^2} - \mu (1-x^2(t)) \frac{dx(t)}{dt} + x(t) = 0 where :math:`x(t)` is the position coordinate at time :math:`t`, and :math:`\mu` is the stiffness parameter. To solve the Van der Pol problem with |g|, we first need to model this second-order equation as a first-order equation. Let :math:`y = \frac{dx}{dt}` and :math:`s = \begin{pmatrix}x\\y\end{pmatrix}`. Then the Van der Pol problem can be rewritten: .. math:: \frac{ds(t)}{dt} = f(t, s(t)) = \begin{pmatrix} y(t) \\ \mu (1-x^2(t)) y(t) - x(t) \end{pmatrix} .. GENERATED FROM PYTHON SOURCE LINES 88-90 Step 1 : Defining the problem ............................. .. GENERATED FROM PYTHON SOURCE LINES 90-118 .. code-block:: Python mu = 5 def evaluate_f(time: float, state: RealArray): """Evaluate the right-hand side function :math:`f` of the equation. Args: time: Time at which :math:`f` should be evaluated. state: State for which the :math:`f` should be evaluated. Returns: The value of :math:`f` at `time` and `state`. """ return array([state[1], mu * state[1] * (1 - state[0] ** 2) - state[0]]) initial_state = array([2, -2 / 3]) initial_time = 0.0 final_time = 50.0 ode_problem = ODEProblem( func=evaluate_f, initial_state=initial_state, times=(initial_time, final_time), solve_at_algorithm_times=True, ) .. GENERATED FROM PYTHON SOURCE LINES 119-123 By default, the Jacobian of the problem is approximated using the finite difference method. However, it is possible to define an explicit expression of the Jacobian and pass it to the problem. In the case of the Van der Pol problem, this would be: .. GENERATED FROM PYTHON SOURCE LINES 123-149 .. code-block:: Python def evaluate_jac(time: float, state: RealArray): """Evaluate the Jacobian of the function :math:`f`. Args: time: Time at which the Jacobian should be evaluated. state: State for which the Jacobian should be evaluated. Returns: The value of the Jacobian at `time` and `state`. """ jac = zeros((2, 2)) jac[1, 0] = -mu * 2 * state[1] * state[0] - 1 jac[0, 1] = 1 jac[1, 1] = mu * (1 - state[0] * state[0]) return jac ode_problem_with_jacobian = ODEProblem( evaluate_f, initial_state, (initial_time, final_time), jac_function_wrt_state=evaluate_jac, ) .. GENERATED FROM PYTHON SOURCE LINES 150-155 Step 2: Solving the ODE problem ............................... Whether the Jacobian is specified or not, once the problem is defined, the ODE solver is called on the :class:`.ODEProblem` by using the :class:`.ODESolversFactory`: .. GENERATED FROM PYTHON SOURCE LINES 155-158 .. code-block:: Python ODESolverLibraryFactory().execute(ode_problem, algo_name="RK45") ODESolverLibraryFactory().execute(ode_problem_with_jacobian, algo_name="RK45") .. rst-class:: sphx-glr-script-out .. code-block:: none ODEResult(times=array([0.00000000e+00, 3.74532749e-02, 1.03428167e-01, 1.72202666e-01, 2.49134295e-01, 3.37974639e-01, 4.45392319e-01, 5.81153227e-01, 7.61409032e-01, 1.00893026e+00, 1.31816564e+00, 1.63105754e+00, 1.92924608e+00, 2.24281802e+00, 2.59456065e+00, 2.97621895e+00, 3.39050042e+00, 3.86048412e+00, 4.44478615e+00, 4.69135185e+00, 4.84571211e+00, 5.00007236e+00, 5.07314736e+00, 5.14622236e+00, 5.20628412e+00, 5.26634588e+00, 5.31863072e+00, 5.37091555e+00, 5.42944041e+00, 5.50218147e+00, 5.59077871e+00, 5.70214103e+00, 5.84768592e+00, 6.04941392e+00, 6.35882583e+00, 6.63377208e+00, 6.90871832e+00, 7.18731601e+00, 7.47587710e+00, 7.78663249e+00, 8.12193118e+00, 8.47939066e+00, 8.86396069e+00, 9.28743242e+00, 9.77435635e+00, 1.02491719e+01, 1.05013670e+01, 1.06512736e+01, 1.08011802e+01, 1.08771177e+01, 1.09530552e+01, 1.10132681e+01, 1.10734810e+01, 1.11253580e+01, 1.11772350e+01, 1.12362346e+01, 1.13093179e+01, 1.13984316e+01, 1.15105216e+01, 1.16572100e+01, 1.18608945e+01, 1.21748138e+01, 1.24467397e+01, 1.27186657e+01, 1.29981260e+01, 1.32897352e+01, 1.36018848e+01, 1.39369708e+01, 1.42948273e+01, 1.46805863e+01, 1.51056174e+01, 1.55953182e+01, 1.60614872e+01, 1.63105618e+01, 1.64584845e+01, 1.66064072e+01, 1.66787060e+01, 1.67510048e+01, 1.68130053e+01, 1.68750058e+01, 1.69273591e+01, 1.69797124e+01, 1.70381842e+01, 1.71108942e+01, 1.71994403e+01, 1.73107277e+01, 1.74561489e+01, 1.76576578e+01, 1.79665784e+01, 1.82419129e+01, 1.85172475e+01, 1.87958242e+01, 1.90841554e+01, 1.93948765e+01, 1.97303185e+01, 2.00878750e+01, 2.04725021e+01, 2.08960759e+01, 2.13831962e+01, 2.18573634e+01, 2.21093633e+01, 2.22591224e+01, 2.24088815e+01, 2.24848402e+01, 2.25607989e+01, 2.26209580e+01, 2.26811171e+01, 2.27329936e+01, 2.27848702e+01, 2.28438721e+01, 2.29169574e+01, 2.30060740e+01, 2.31181680e+01, 2.32648621e+01, 2.34685561e+01, 2.37824982e+01, 2.40544125e+01, 2.43263269e+01, 2.46057957e+01, 2.48974259e+01, 2.52095892e+01, 2.55446813e+01, 2.59025480e+01, 2.62883237e+01, 2.67133785e+01, 2.72031227e+01, 2.76691667e+01, 2.79181865e+01, 2.80660802e+01, 2.82139738e+01, 2.82864685e+01, 2.83589632e+01, 2.84208246e+01, 2.84826860e+01, 2.85350130e+01, 2.85873400e+01, 2.86458433e+01, 2.87185763e+01, 2.88071568e+01, 2.89184928e+01, 2.90639904e+01, 2.92656299e+01, 2.95748477e+01, 2.98499848e+01, 3.01251219e+01, 3.04037521e+01, 3.06922812e+01, 3.10030948e+01, 3.13385224e+01, 3.16961024e+01, 3.20808051e+01, 3.25044774e+01, 3.29917723e+01, 3.34653659e+01, 3.37171885e+01, 3.38668170e+01, 3.40164454e+01, 3.40921259e+01, 3.41678063e+01, 3.42281267e+01, 3.42884472e+01, 3.43403581e+01, 3.43922691e+01, 3.44512341e+01, 3.45242937e+01, 3.46133708e+01, 3.47254090e+01, 3.48720149e+01, 3.50755574e+01, 3.53891472e+01, 3.56613041e+01, 3.59334609e+01, 3.62128649e+01, 3.65042628e+01, 3.68163278e+01, 3.71514459e+01, 3.75092906e+01, 3.78949860e+01, 3.83199373e+01, 3.88094972e+01, 3.92760755e+01, 3.95253273e+01, 3.96733450e+01, 3.98213626e+01, 3.98930355e+01, 3.99647084e+01, 4.00271482e+01, 4.00895880e+01, 4.01420268e+01, 4.01944656e+01, 4.02528341e+01, 4.03254689e+01, 4.04139021e+01, 4.05250303e+01, 4.06702014e+01, 4.08712824e+01, 4.11792328e+01, 4.14552096e+01, 4.17311864e+01, 4.20095911e+01, 4.22972773e+01, 4.26076948e+01, 4.29431828e+01, 4.33006627e+01, 4.36850438e+01, 4.41082958e+01, 4.45948478e+01, 4.50709142e+01, 4.53234712e+01, 4.54736619e+01, 4.56238526e+01, 4.56989836e+01, 4.57741146e+01, 4.58349486e+01, 4.58957825e+01, 4.59477578e+01, 4.59997331e+01, 4.60586192e+01, 4.61316207e+01, 4.62206109e+01, 4.63325270e+01, 4.64789422e+01, 4.66821594e+01, 4.69949923e+01, 4.72676485e+01, 4.75403046e+01, 4.78195481e+01, 4.81104158e+01, 4.84222296e+01, 4.87573635e+01, 4.91151157e+01, 4.95005786e+01, 4.99252199e+01, 5.00000000e+01]), state_trajectories=array([], dtype=float64), n_func_evaluations=1730, n_jac_evaluations=0, algorithm_has_converged=True, algorithm_name='RK45', algorithm_settings={'first_step': None, 'max_step': inf, 'rtol': 0.001, 'atol': 1e-06}, algorithm_termination_message='The solver successfully reached the end of the integration interval.', jac_wrt_desvar=array([], dtype=float64), jac_wrt_initial_state=array([], dtype=float64), terminal_event_index=None, final_state=array([[ 1.26847016], [-0.34017088]]), termination_time=array([50.])) .. GENERATED FROM PYTHON SOURCE LINES 159-176 By default, the Runge-Kutta method of order 4(5) (``"RK45"``) is used, but other algorithms can be applied by specifying the option ``algo_name`` in :meth:`.ODESolverLibraryFactory().execute`. See more information on available algorithms in `the SciPy documentation `_. Step 3: Examining the results ............................. The convergence of the algorithm can be known by examining :attr:`.ODEProblem.algorithm_has_converged` and :attr:`.ODEProblem.solver_message`. The solution of the :class:`.ODEProblem` on the user-specified time interval can be accessed through the vectors :attr:`.ODEProblem.states` and :attr:`.ODEProblem.times_eval`. .. GENERATED FROM PYTHON SOURCE LINES 176-183 .. code-block:: Python plt.plot(ode_problem.result.times, ode_problem.result.state_trajectories[0], label="x") plt.plot(ode_problem.result.times, ode_problem.result.state_trajectories[1], label="y") plt.legend() plt.xlabel("time") plt.show() .. image-sg:: /examples/ode/ode_problem/images/sphx_glr_plot_van_der_pol_001.png :alt: plot van der pol :srcset: /examples/ode/ode_problem/images/sphx_glr_plot_van_der_pol_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 184-189 Shortcut ........ The class :class:`.VanDerPol` is available in the package :mod:`gemseo.problems.ode`, so it just needs to be imported to be used. .. GENERATED FROM PYTHON SOURCE LINES 189-191 .. code-block:: Python ode_problem = VanDerPol() ODESolverLibraryFactory().execute(ode_problem, algo_name="RK45") .. rst-class:: sphx-glr-script-out .. code-block:: none ODEResult(times=array([0.00000000e+00, 3.02889880e-04, 6.05779761e-04, 9.19543822e-04, 1.23318623e-03, 1.54831722e-03, 1.86699348e-03, 2.19411325e-03, 2.53977274e-03, 2.92128804e-03, 3.36329597e-03, 3.89893117e-03, 4.57707708e-03, 5.47709067e-03, 6.70631653e-03, 7.94054333e-03, 9.04797379e-03, 1.01554042e-02, 1.12779072e-02, 1.23918108e-02, 1.34830214e-02, 1.45644470e-02, 1.56611247e-02, 1.67810456e-02, 1.79042147e-02, 1.90056269e-02, 2.00859937e-02, 2.11712234e-02, 2.22825463e-02, 2.34107825e-02, 2.45253095e-02, 2.56111902e-02, 2.66876034e-02, 2.77856208e-02, 2.89120756e-02, 3.00392570e-02, 3.11371929e-02, 3.22106958e-02, 3.32937591e-02, 3.44105558e-02, 3.55457617e-02, 3.66602394e-02, 3.77390477e-02, 3.88096880e-02, 3.99102151e-02, 4.10450773e-02, 4.21765437e-02, 4.32693318e-02, 4.43343877e-02, 4.54156305e-02, 4.65399445e-02, 4.76834857e-02, 4.87968566e-02, 4.98664641e-02, 5.09306177e-02, 5.20352809e-02, 5.31808038e-02, 5.43166166e-02, 5.54020844e-02, 5.64569315e-02, 5.75370351e-02, 5.86714478e-02, 5.98247635e-02, 6.09354745e-02, 6.19933612e-02, 6.30504461e-02, 6.41614238e-02, 6.53202405e-02, 6.64601279e-02, 6.75355546e-02, 6.85783247e-02, 6.96584071e-02, 7.08060804e-02, 7.19705807e-02, 7.30764881e-02, 7.41197994e-02, 7.51694766e-02, 7.62895609e-02, 7.74646149e-02, 7.86078353e-02, 7.96699841e-02, 8.06988362e-02, 8.17805312e-02, 8.29451628e-02, 8.41220623e-02, 8.52204063e-02, 8.62461238e-02, 8.72884232e-02, 8.84209746e-02, 8.96153316e-02, 9.07605637e-02, 9.18058661e-02, 9.28191974e-02, 9.39046480e-02, 9.50902543e-02, 9.62803445e-02, 9.73678845e-02, 9.83731466e-02, 9.94085726e-02, 1.00557278e-01, 1.01773764e-01, 1.02798733e-01, 1.03823703e-01, 1.04962272e-01, 1.06182108e-01, 1.07213960e-01, 1.08245812e-01, 1.09384272e-01, 1.10595952e-01, 1.11630655e-01, 1.12665358e-01, 1.13801753e-01, 1.15008298e-01, 1.16159033e-01, 1.17197135e-01, 1.18199537e-01, 1.19282660e-01, 1.20478679e-01, 1.21680064e-01, 1.22765892e-01, 1.23759737e-01, 1.24786971e-01, 1.25940650e-01, 1.27171198e-01, 1.28187667e-01, 1.29204136e-01, 1.30346597e-01, 1.31579975e-01, 1.32604268e-01, 1.33628561e-01, 1.34770773e-01, 1.35994674e-01, 1.37022340e-01, 1.38050006e-01, 1.39189846e-01, 1.40407685e-01, 1.41439273e-01, 1.42470861e-01, 1.43608963e-01, 1.44820679e-01, 1.45855726e-01, 1.46890774e-01, 1.48027163e-01, 1.49233347e-01, 1.50383847e-01, 1.51422148e-01, 1.52424966e-01, 1.53508296e-01, 1.54704072e-01, 1.55905059e-01, 1.56990873e-01, 1.57985096e-01, 1.59012711e-01, 1.60166370e-01, 1.61396492e-01, 1.62413188e-01, 1.63429884e-01, 1.64572263e-01, 1.65805341e-01, 1.66829869e-01, 1.67854398e-01, 1.68996551e-01, 1.70220165e-01, 1.71248045e-01, 1.72275925e-01, 1.73415711e-01, 1.74633292e-01, 1.75665082e-01, 1.76696871e-01, 1.77834926e-01, 1.79046408e-01, 1.80081644e-01, 1.81116880e-01, 1.82253227e-01, 1.83459197e-01, 1.84609618e-01, 1.85648098e-01, 1.86651170e-01, 1.87734584e-01, 1.88930184e-01, 1.90130976e-01, 1.91216856e-01, 1.92211341e-01, 1.93239157e-01, 1.94392754e-01, 1.95622627e-01, 1.96639524e-01, 1.97656421e-01, 1.98798757e-01, 2.00031603e-01, 2.01056313e-01, 2.02081023e-01, 2.03223138e-01, 2.04446546e-01, 2.05474597e-01, 2.06502647e-01, 2.07642401e-01, 2.08859796e-01, 2.09891745e-01, 2.10923695e-01, 2.12061722e-01, 2.13273035e-01, 2.14308422e-01, 2.15343809e-01, 2.16480133e-01, 2.17685949e-01, 2.18836318e-01, 2.19874941e-01, 2.20878215e-01, 2.21961700e-01, 2.23157176e-01, 2.24357828e-01, 2.25443766e-01, 2.26438458e-01, 2.27466434e-01, 2.28619992e-01, 2.29849685e-01, 2.30866742e-01, 2.31883798e-01, 2.33026111e-01, 2.34258788e-01, 2.35283645e-01, 2.36308501e-01, 2.37450594e-01, 2.38673855e-01, 2.39702043e-01, 2.40730231e-01, 2.41869968e-01, 2.43087230e-01, 2.44119309e-01, 2.45151388e-01, 2.46289401e-01, 2.47500595e-01, 2.48536105e-01, 2.49571615e-01, 2.50707929e-01, 2.51913636e-01, 2.53063974e-01, 2.54102714e-01, 2.55106148e-01, 2.56189695e-01, 2.57385086e-01, 2.58585640e-01, 2.59671630e-01, 2.60666486e-01, 2.61694591e-01, 2.62848129e-01, 2.64077694e-01, 2.65094880e-01, 2.66112065e-01, 2.67254368e-01, 2.68486926e-01, 2.69511901e-01, 2.70536876e-01, 2.71678961e-01, 2.72902118e-01, 2.73930419e-01, 2.74958719e-01, 2.76098451e-01, 2.77315621e-01, 2.78347806e-01, 2.79379991e-01, 2.80518003e-01, 2.81729115e-01, 2.82764725e-01, 2.83800336e-01, 2.84936651e-01, 2.86142285e-01, 2.87292608e-01, 2.88331443e-01, 2.89335007e-01, 2.90418609e-01, 2.91613943e-01, 2.92814432e-01, 2.93900469e-01, 2.94895458e-01, 2.95923669e-01, 2.97077199e-01, 2.98306675e-01, 2.99323967e-01, 3.00341258e-01, 3.01483562e-01, 3.02716038e-01, 3.03741111e-01, 3.04766184e-01, 3.05908271e-01, 3.07131358e-01, 3.08159751e-01, 3.09188145e-01, 3.10327882e-01, 3.11544990e-01, 3.12577264e-01, 3.13609537e-01, 3.14747556e-01, 3.15958613e-01, 3.16994308e-01, 3.18030004e-01, 3.19166327e-01, 3.20371913e-01, 3.21522233e-01, 3.22561150e-01, 3.23564819e-01, 3.24648472e-01, 3.25843771e-01, 3.27044218e-01, 3.28130300e-01, 3.29125397e-01, 3.30153696e-01, 3.31307228e-01, 3.32536646e-01, 3.33554026e-01, 3.34571405e-01, 3.35713717e-01, 3.36946140e-01, 3.37971295e-01, 3.38996450e-01, 3.40138547e-01, 3.41361589e-01, 3.42390061e-01, 3.43418533e-01, 3.44558282e-01, 3.45775352e-01, 3.46807701e-01, 3.47840049e-01, 3.48978081e-01, 3.50189106e-01, 3.51224873e-01, 3.52260640e-01, 3.53396978e-01, 3.54602537e-01, 3.55752863e-01, 3.56791849e-01, 3.57795606e-01, 3.58879305e-01, 3.60074586e-01, 3.61275010e-01, 3.62361134e-01, 3.63356320e-01, 3.64384694e-01, 3.65538237e-01, 3.66767619e-01, 3.67785073e-01, 3.68802527e-01, 3.69944854e-01, 3.71177245e-01, 3.72202470e-01, 3.73227695e-01, 3.74369808e-01, 3.75592825e-01, 3.76621364e-01, 3.77649903e-01, 3.78789669e-01, 3.80006719e-01, 3.81039132e-01, 3.82071545e-01, 3.83209596e-01, 3.84420604e-01, 3.85456434e-01, 3.86492263e-01, 3.87628621e-01, 3.88834168e-01, 3.89984506e-01, 3.91023552e-01, 3.92027384e-01, 3.93111126e-01, 3.94306402e-01, 3.95506817e-01, 3.96592980e-01, 3.97588243e-01, 3.98616681e-01, 3.99770239e-01, 4.00999603e-01, 4.02017121e-01, 4.03034640e-01, 4.04176986e-01, 4.05409362e-01, 4.06434648e-01, 4.07459933e-01, 4.08602067e-01, 4.09825073e-01, 4.10853671e-01, 4.11882269e-01, 4.13022057e-01, 4.14239099e-01, 4.15271569e-01, 4.16304039e-01, 4.17442112e-01, 4.18653117e-01, 4.19689002e-01, 4.20724886e-01, 4.21861267e-01, 4.23066813e-01, 4.24217169e-01, 4.25256269e-01, 4.26260165e-01, 4.27343947e-01, 4.28539228e-01, 4.29739645e-01, 4.30825846e-01, 4.31821174e-01, 4.32849669e-01, 4.34003248e-01, 4.35232606e-01, 4.36250181e-01, 4.37267756e-01, 4.38410126e-01, 4.39642498e-01, 4.40667838e-01, 4.41693177e-01, 4.42835334e-01, 4.44058341e-01, 4.45086992e-01, 4.46115642e-01, 4.47255454e-01, 4.48472501e-01, 4.49505021e-01, 4.50537542e-01, 4.51675640e-01, 4.52886651e-01, 4.53922585e-01, 4.54958519e-01, 4.56094926e-01, 4.57300480e-01, 4.58450858e-01, 4.59490007e-01, 4.60493959e-01, 4.61577780e-01, 4.62773073e-01, 4.63973500e-01, 4.65059738e-01, 4.66055122e-01, 4.67083668e-01, 4.68237271e-01, 4.69466634e-01, 4.70484259e-01, 4.71501885e-01, 4.72644280e-01, 4.73876659e-01, 4.74902047e-01, 4.75927435e-01, 4.77069619e-01, 4.78292635e-01, 4.79321333e-01, 4.80350030e-01, 4.81489870e-01, 4.82706927e-01, 4.83739494e-01, 4.84772061e-01, 4.85910187e-01, 4.87121211e-01, 4.88157191e-01, 4.89193170e-01, 4.90329605e-01, 4.91535173e-01, 4.92685577e-01, 4.93724770e-01, 4.94728772e-01, 4.95812630e-01, 4.97007942e-01, 4.98208385e-01, 4.99294659e-01, 5.00000000e-01]), state_trajectories=array([[ 2.00000000e+00, 1.99986735e+00, 1.99981373e+00, 1.99979150e+00, 1.99978270e+00, 1.99977912e+00, 1.99977759e+00, 1.99977685e+00, 1.99977642e+00, 1.99977610e+00, 1.99977577e+00, 1.99977541e+00, 1.99977496e+00, 1.99977436e+00, 1.99977354e+00, 1.99977271e+00, 1.99977198e+00, 1.99977124e+00, 1.99977049e+00, 1.99976975e+00, 1.99976902e+00, 1.99976830e+00, 1.99976757e+00, 1.99976682e+00, 1.99976607e+00, 1.99976534e+00, 1.99976462e+00, 1.99976389e+00, 1.99976315e+00, 1.99976240e+00, 1.99976166e+00, 1.99976093e+00, 1.99976021e+00, 1.99975948e+00, 1.99975873e+00, 1.99975798e+00, 1.99975725e+00, 1.99975653e+00, 1.99975581e+00, 1.99975506e+00, 1.99975431e+00, 1.99975356e+00, 1.99975284e+00, 1.99975213e+00, 1.99975140e+00, 1.99975064e+00, 1.99974989e+00, 1.99974916e+00, 1.99974845e+00, 1.99974773e+00, 1.99974698e+00, 1.99974621e+00, 1.99974547e+00, 1.99974476e+00, 1.99974405e+00, 1.99974331e+00, 1.99974255e+00, 1.99974179e+00, 1.99974107e+00, 1.99974036e+00, 1.99973964e+00, 1.99973889e+00, 1.99973812e+00, 1.99973738e+00, 1.99973667e+00, 1.99973597e+00, 1.99973523e+00, 1.99973445e+00, 1.99973369e+00, 1.99973298e+00, 1.99973228e+00, 1.99973156e+00, 1.99973079e+00, 1.99973002e+00, 1.99972928e+00, 1.99972858e+00, 1.99972788e+00, 1.99972714e+00, 1.99972635e+00, 1.99972559e+00, 1.99972488e+00, 1.99972420e+00, 1.99972348e+00, 1.99972270e+00, 1.99972192e+00, 1.99972118e+00, 1.99972050e+00, 1.99971980e+00, 1.99971905e+00, 1.99971825e+00, 1.99971749e+00, 1.99971679e+00, 1.99971612e+00, 1.99971539e+00, 1.99971460e+00, 1.99971381e+00, 1.99971308e+00, 1.99971241e+00, 1.99971172e+00, 1.99971096e+00, 1.99971014e+00, 1.99970946e+00, 1.99970878e+00, 1.99970802e+00, 1.99970721e+00, 1.99970652e+00, 1.99970583e+00, 1.99970507e+00, 1.99970426e+00, 1.99970357e+00, 1.99970288e+00, 1.99970212e+00, 1.99970132e+00, 1.99970055e+00, 1.99969986e+00, 1.99969919e+00, 1.99969847e+00, 1.99969767e+00, 1.99969687e+00, 1.99969615e+00, 1.99969548e+00, 1.99969480e+00, 1.99969403e+00, 1.99969321e+00, 1.99969253e+00, 1.99969185e+00, 1.99969109e+00, 1.99969027e+00, 1.99968959e+00, 1.99968890e+00, 1.99968814e+00, 1.99968733e+00, 1.99968664e+00, 1.99968595e+00, 1.99968519e+00, 1.99968438e+00, 1.99968369e+00, 1.99968301e+00, 1.99968225e+00, 1.99968144e+00, 1.99968075e+00, 1.99968006e+00, 1.99967930e+00, 1.99967850e+00, 1.99967773e+00, 1.99967704e+00, 1.99967637e+00, 1.99967565e+00, 1.99967485e+00, 1.99967405e+00, 1.99967332e+00, 1.99967266e+00, 1.99967198e+00, 1.99967121e+00, 1.99967039e+00, 1.99966971e+00, 1.99966903e+00, 1.99966827e+00, 1.99966745e+00, 1.99966676e+00, 1.99966608e+00, 1.99966532e+00, 1.99966450e+00, 1.99966382e+00, 1.99966313e+00, 1.99966237e+00, 1.99966156e+00, 1.99966087e+00, 1.99966018e+00, 1.99965942e+00, 1.99965862e+00, 1.99965793e+00, 1.99965724e+00, 1.99965648e+00, 1.99965567e+00, 1.99965491e+00, 1.99965421e+00, 1.99965354e+00, 1.99965282e+00, 1.99965202e+00, 1.99965122e+00, 1.99965050e+00, 1.99964984e+00, 1.99964915e+00, 1.99964838e+00, 1.99964756e+00, 1.99964688e+00, 1.99964621e+00, 1.99964544e+00, 1.99964462e+00, 1.99964394e+00, 1.99964325e+00, 1.99964249e+00, 1.99964168e+00, 1.99964099e+00, 1.99964031e+00, 1.99963955e+00, 1.99963873e+00, 1.99963805e+00, 1.99963736e+00, 1.99963660e+00, 1.99963579e+00, 1.99963510e+00, 1.99963441e+00, 1.99963365e+00, 1.99963285e+00, 1.99963208e+00, 1.99963139e+00, 1.99963072e+00, 1.99963000e+00, 1.99962920e+00, 1.99962840e+00, 1.99962768e+00, 1.99962701e+00, 1.99962633e+00, 1.99962556e+00, 1.99962474e+00, 1.99962406e+00, 1.99962338e+00, 1.99962262e+00, 1.99962180e+00, 1.99962111e+00, 1.99962043e+00, 1.99961967e+00, 1.99961885e+00, 1.99961817e+00, 1.99961748e+00, 1.99961672e+00, 1.99961591e+00, 1.99961522e+00, 1.99961453e+00, 1.99961377e+00, 1.99961297e+00, 1.99961228e+00, 1.99961158e+00, 1.99961083e+00, 1.99961002e+00, 1.99960926e+00, 1.99960856e+00, 1.99960789e+00, 1.99960717e+00, 1.99960637e+00, 1.99960557e+00, 1.99960485e+00, 1.99960419e+00, 1.99960350e+00, 1.99960273e+00, 1.99960191e+00, 1.99960123e+00, 1.99960055e+00, 1.99959979e+00, 1.99959897e+00, 1.99959829e+00, 1.99959760e+00, 1.99959684e+00, 1.99959603e+00, 1.99959534e+00, 1.99959465e+00, 1.99959389e+00, 1.99959308e+00, 1.99959239e+00, 1.99959171e+00, 1.99959095e+00, 1.99959014e+00, 1.99958945e+00, 1.99958876e+00, 1.99958800e+00, 1.99958720e+00, 1.99958643e+00, 1.99958574e+00, 1.99958507e+00, 1.99958434e+00, 1.99958355e+00, 1.99958275e+00, 1.99958202e+00, 1.99958136e+00, 1.99958067e+00, 1.99957990e+00, 1.99957908e+00, 1.99957841e+00, 1.99957773e+00, 1.99957697e+00, 1.99957614e+00, 1.99957546e+00, 1.99957478e+00, 1.99957401e+00, 1.99957320e+00, 1.99957251e+00, 1.99957183e+00, 1.99957107e+00, 1.99957026e+00, 1.99956957e+00, 1.99956888e+00, 1.99956812e+00, 1.99956731e+00, 1.99956662e+00, 1.99956593e+00, 1.99956517e+00, 1.99956437e+00, 1.99956360e+00, 1.99956291e+00, 1.99956224e+00, 1.99956152e+00, 1.99956072e+00, 1.99955992e+00, 1.99955919e+00, 1.99955853e+00, 1.99955784e+00, 1.99955708e+00, 1.99955626e+00, 1.99955558e+00, 1.99955490e+00, 1.99955414e+00, 1.99955332e+00, 1.99955263e+00, 1.99955195e+00, 1.99955119e+00, 1.99955037e+00, 1.99954968e+00, 1.99954900e+00, 1.99954824e+00, 1.99954743e+00, 1.99954674e+00, 1.99954605e+00, 1.99954529e+00, 1.99954448e+00, 1.99954379e+00, 1.99954310e+00, 1.99954234e+00, 1.99954154e+00, 1.99954077e+00, 1.99954008e+00, 1.99953941e+00, 1.99953869e+00, 1.99953789e+00, 1.99953709e+00, 1.99953637e+00, 1.99953570e+00, 1.99953502e+00, 1.99953425e+00, 1.99953343e+00, 1.99953275e+00, 1.99953207e+00, 1.99953131e+00, 1.99953049e+00, 1.99952980e+00, 1.99952912e+00, 1.99952836e+00, 1.99952754e+00, 1.99952685e+00, 1.99952617e+00, 1.99952541e+00, 1.99952460e+00, 1.99952391e+00, 1.99952322e+00, 1.99952246e+00, 1.99952165e+00, 1.99952096e+00, 1.99952027e+00, 1.99951951e+00, 1.99951871e+00, 1.99951794e+00, 1.99951725e+00, 1.99951658e+00, 1.99951586e+00, 1.99951506e+00, 1.99951426e+00, 1.99951354e+00, 1.99951287e+00, 1.99951219e+00, 1.99951142e+00, 1.99951060e+00, 1.99950992e+00, 1.99950924e+00, 1.99950848e+00, 1.99950766e+00, 1.99950697e+00, 1.99950629e+00, 1.99950553e+00, 1.99950471e+00, 1.99950402e+00, 1.99950334e+00, 1.99950258e+00, 1.99950177e+00, 1.99950108e+00, 1.99950039e+00, 1.99949963e+00, 1.99949882e+00, 1.99949813e+00, 1.99949744e+00, 1.99949668e+00, 1.99949588e+00, 1.99949511e+00, 1.99949442e+00, 1.99949375e+00, 1.99949303e+00, 1.99949223e+00, 1.99949143e+00, 1.99949070e+00, 1.99949004e+00, 1.99948935e+00, 1.99948858e+00, 1.99948776e+00, 1.99948709e+00, 1.99948641e+00, 1.99948565e+00, 1.99948482e+00, 1.99948414e+00, 1.99948346e+00, 1.99948269e+00, 1.99948188e+00, 1.99948119e+00, 1.99948051e+00, 1.99947975e+00, 1.99947893e+00, 1.99947825e+00, 1.99947756e+00, 1.99947680e+00, 1.99947599e+00, 1.99947530e+00, 1.99947461e+00, 1.99947385e+00, 1.99947305e+00, 1.99947228e+00, 1.99947159e+00, 1.99947092e+00, 1.99947019e+00, 1.99946940e+00, 1.99946860e+00, 1.99946787e+00, 1.99946721e+00, 1.99946652e+00, 1.99946575e+00, 1.99946493e+00, 1.99946425e+00, 1.99946357e+00, 1.99946281e+00, 1.99946199e+00, 1.99946131e+00, 1.99946062e+00, 1.99945986e+00, 1.99945905e+00, 1.99945836e+00, 1.99945767e+00, 1.99945691e+00, 1.99945610e+00, 1.99945541e+00, 1.99945472e+00, 1.99945396e+00, 1.99945316e+00, 1.99945247e+00, 1.99945177e+00, 1.99945102e+00, 1.99945021e+00, 1.99944945e+00, 1.99944875e+00, 1.99944808e+00, 1.99944736e+00, 1.99944656e+00, 1.99944576e+00, 1.99944504e+00, 1.99944457e+00], [-6.66543343e-01, -2.69245437e-01, -1.09008060e-01, -4.29772973e-02, -1.71965922e-02, -7.09608393e-03, -3.14120535e-03, -1.59546970e-03, -9.96661476e-04, -7.72199602e-04, -6.95079133e-04, -6.72729664e-04, -6.67819834e-04, -6.67129569e-04, -6.67455464e-04, -6.68128773e-04, -6.68165750e-04, -6.68203720e-04, -6.68367415e-04, -6.68469335e-04, -6.68368264e-04, -6.68195270e-04, -6.68151200e-04, -6.68287350e-04, -6.68466445e-04, -6.68456565e-04, -6.68265360e-04, -6.68131808e-04, -6.68198255e-04, -6.68410285e-04, -6.68520439e-04, -6.68369384e-04, -6.68158280e-04, -6.68125207e-04, -6.68311119e-04, -6.68529816e-04, -6.68486830e-04, -6.68236701e-04, -6.68090506e-04, -6.68195775e-04, -6.68468540e-04, -6.68581756e-04, -6.68363138e-04, -6.68110707e-04, -6.68096601e-04, -6.68346656e-04, -6.68611332e-04, -6.68516926e-04, -6.68195878e-04, -6.68041683e-04, -6.68198519e-04, -6.68547576e-04, -6.68654482e-04, -6.68346502e-04, -6.68051610e-04, -6.68066456e-04, -6.68398770e-04, -6.68715925e-04, -6.68544388e-04, -6.68140827e-04, -6.67985722e-04, -6.68209542e-04, -6.68654594e-04, -6.68739322e-04, -6.68316130e-04, -6.67980802e-04, -6.68036409e-04, -6.68473943e-04, -6.68849468e-04, -6.68565707e-04, -6.68070285e-04, -6.67923751e-04, -6.68232863e-04, -6.68798990e-04, -6.68835975e-04, -6.68268954e-04, -6.67899299e-04, -6.68008693e-04, -6.68580642e-04, -6.69018388e-04, -6.68576497e-04, -6.67984586e-04, -6.67857800e-04, -6.68273471e-04, -6.68992398e-04, -6.68942459e-04, -6.68203312e-04, -6.67809774e-04, -6.67986023e-04, -6.68729233e-04, -6.69228555e-04, -6.68572297e-04, -6.67886535e-04, -6.67790817e-04, -6.68336914e-04, -6.69247651e-04, -6.69054511e-04, -6.68120368e-04, -6.67716714e-04, -6.67971234e-04, -6.68930742e-04, -6.68191961e-04, -6.67712960e-04, -6.67905349e-04, -6.68842729e-04, -6.68186870e-04, -6.67744891e-04, -6.67943171e-04, -6.68826081e-04, -6.68197847e-04, -6.67767664e-04, -6.67957820e-04, -6.68797902e-04, -6.69386975e-04, -6.68616319e-04, -6.67852448e-04, -6.67748646e-04, -6.68345841e-04, -6.69403409e-04, -6.69175944e-04, -6.68110510e-04, -6.67673357e-04, -6.67941824e-04, -6.69020860e-04, -6.68187538e-04, -6.67672485e-04, -6.67875516e-04, -6.68918082e-04, -6.68182315e-04, -6.67707151e-04, -6.67916721e-04, -6.68896633e-04, -6.68194405e-04, -6.67732240e-04, -6.67933346e-04, -6.68862722e-04, -6.68202227e-04, -6.67757860e-04, -6.67953839e-04, -6.68835138e-04, -6.68210444e-04, -6.67781934e-04, -6.67972170e-04, -6.68809417e-04, -6.69394436e-04, -6.68627027e-04, -6.67866203e-04, -6.67763183e-04, -6.68359358e-04, -6.69411707e-04, -6.69184006e-04, -6.68123158e-04, -6.67687666e-04, -6.67956324e-04, -6.69031940e-04, -6.68200717e-04, -6.67686396e-04, -6.67889067e-04, -6.68928916e-04, -6.68195346e-04, -6.67721057e-04, -6.67930375e-04, -6.68907739e-04, -6.68207438e-04, -6.67746070e-04, -6.67946904e-04, -6.68873959e-04, -6.68215235e-04, -6.67771637e-04, -6.67967352e-04, -6.68846508e-04, -6.68223435e-04, -6.67795659e-04, -6.67985634e-04, -6.68820898e-04, -6.69403996e-04, -6.68638994e-04, -6.67879760e-04, -6.67776909e-04, -6.68372086e-04, -6.69421357e-04, -6.69194354e-04, -6.68136221e-04, -6.67701397e-04, -6.67969813e-04, -6.69043013e-04, -6.68213691e-04, -6.67700057e-04, -6.67902530e-04, -6.68940283e-04, -6.68208318e-04, -6.67734665e-04, -6.67943775e-04, -6.68919214e-04, -6.68220388e-04, -6.67759630e-04, -6.67960262e-04, -6.68885554e-04, -6.68228170e-04, -6.67785154e-04, -6.67980669e-04, -6.68858199e-04, -6.68236357e-04, -6.67809138e-04, -6.67998915e-04, -6.68832674e-04, -6.69414314e-04, -6.68651139e-04, -6.67893112e-04, -6.67790389e-04, -6.68384808e-04, -6.69431744e-04, -6.69205270e-04, -6.68149197e-04, -6.67714882e-04, -6.67983113e-04, -6.69054480e-04, -6.68226600e-04, -6.67713488e-04, -6.67915810e-04, -6.68951972e-04, -6.68221225e-04, -6.67748056e-04, -6.67957007e-04, -6.68930984e-04, -6.68233279e-04, -6.67772986e-04, -6.67973463e-04, -6.68897416e-04, -6.68241050e-04, -6.67798477e-04, -6.67993839e-04, -6.68870134e-04, -6.68249226e-04, -6.67822432e-04, -6.68012059e-04, -6.68844673e-04, -6.69425207e-04, -6.68663418e-04, -6.67906309e-04, -6.67803684e-04, -6.68397527e-04, -6.69442689e-04, -6.69216616e-04, -6.68162108e-04, -6.67728180e-04, -6.67996271e-04, -6.69066243e-04, -6.68239460e-04, -6.67726745e-04, -6.67928953e-04, -6.68963905e-04, -6.68234084e-04, -6.67761283e-04, -6.67970114e-04, -6.68942979e-04, -6.68246126e-04, -6.67786185e-04, -6.67986545e-04, -6.68909480e-04, -6.68253889e-04, -6.67811653e-04, -6.68006898e-04, -6.68882254e-04, -6.68262057e-04, -6.67835585e-04, -6.68025097e-04, -6.68856841e-04, -6.69436534e-04, -6.68675800e-04, -6.67919388e-04, -6.67816837e-04, -6.68410242e-04, -6.69454055e-04, -6.69228288e-04, -6.68174971e-04, -6.67741337e-04, -6.68009321e-04, -6.69078232e-04, -6.68252283e-04, -6.67739871e-04, -6.67941991e-04, -6.68976023e-04, -6.68246907e-04, -6.67774385e-04, -6.67983125e-04, -6.68955144e-04, -6.68258939e-04, -6.67799267e-04, -6.67999538e-04, -6.68921698e-04, -6.68266696e-04, -6.67824716e-04, -6.68019873e-04, -6.68894514e-04, -6.68274858e-04, -6.67848631e-04, -6.68038057e-04, -6.68869139e-04, -6.69448191e-04, -6.68688259e-04, -6.67932379e-04, -6.67829884e-04, -6.68422955e-04, -6.69465742e-04, -6.69240208e-04, -6.68187796e-04, -6.67754386e-04, -6.68022289e-04, -6.69090393e-04, -6.68265079e-04, -6.67752897e-04, -6.67954950e-04, -6.68988282e-04, -6.68259702e-04, -6.67787393e-04, -6.67996063e-04, -6.68967438e-04, -6.68271727e-04, -6.67812260e-04, -6.68012462e-04, -6.68934033e-04, -6.68279479e-04, -6.67837694e-04, -6.68032784e-04, -6.68906881e-04, -6.68287636e-04, -6.67861596e-04, -6.68050956e-04, -6.68881534e-04, -6.69460099e-04, -6.68700778e-04, -6.67945302e-04, -6.67842850e-04, -6.68435667e-04, -6.69477673e-04, -6.69252316e-04, -6.68200594e-04, -6.67767353e-04, -6.68035195e-04, -6.69102684e-04, -6.68277854e-04, -6.67765846e-04, -6.67967850e-04, -6.69000648e-04, -6.68272476e-04, -6.67800330e-04, -6.68008946e-04, -6.68979832e-04, -6.68284496e-04, -6.67825184e-04, -6.68025335e-04, -6.68946458e-04, -6.68292245e-04, -6.67850608e-04, -6.68045647e-04, -6.68919330e-04, -6.68300399e-04, -6.67874500e-04, -6.68063810e-04, -6.68894005e-04, -6.69472198e-04, -6.68713343e-04, -6.67958173e-04, -6.67855755e-04, -6.68448379e-04, -6.69489790e-04, -6.69264568e-04, -6.68213370e-04, -6.67780259e-04, -6.68048054e-04, -6.69115076e-04, -6.68290613e-04, -6.67778738e-04, -6.67980703e-04, -6.69013097e-04, -6.68285235e-04, -6.67813212e-04, -6.68021788e-04, -6.68992302e-04, -6.68297251e-04, -6.67838057e-04, -6.68038169e-04, -6.68958951e-04, -6.68304997e-04, -6.67863472e-04, -6.68058473e-04, -6.68931842e-04, -6.68313148e-04, -6.67887358e-04, -6.68076629e-04, -6.68906533e-04, -6.69484444e-04, -6.68725942e-04, -6.67971006e-04, -6.67868612e-04, -6.68461090e-04, -6.69502049e-04, -6.69276929e-04, -6.68226131e-04, -6.67793117e-04, -6.68060877e-04, -6.69127544e-04, -6.68303361e-04, -6.67791586e-04, -6.67993523e-04, -6.69025609e-04, -6.68297983e-04, -6.67826052e-04, -6.68034599e-04, -6.69004829e-04, -6.68309996e-04, -6.67850891e-04, -6.68050974e-04, -6.68971496e-04, -6.68317740e-04, -6.67876300e-04, -6.68071271e-04, -6.68944402e-04, -6.68325889e-04, -6.67900180e-04, -6.68089423e-04, -6.68919105e-04, -6.69496802e-04, -6.68738569e-04, -6.67983810e-04, -6.67881435e-04, -6.68473802e-04, -6.69514417e-04, -6.69289375e-04, -6.68238880e-04, -6.67805940e-04, -6.68073674e-04, -6.69140071e-04, -6.68316100e-04, -6.67804401e-04, -6.68006316e-04, -6.69038169e-04, -6.68310722e-04, -6.67838861e-04, -6.68047385e-04, -6.69017402e-04, -6.68322733e-04, -6.67863695e-04, -6.68063756e-04, -6.68984082e-04, -6.68330475e-04, -6.67889100e-04, -6.68084049e-04, -6.68956998e-04, -6.68338623e-04, -6.67912975e-04, -6.68102196e-04, -6.68931711e-04, -6.69509245e-04, -6.68751216e-04, -6.67996591e-04, -6.67894230e-04, -6.68486514e-04, -6.69526868e-04, -6.69301886e-04, -6.67382536e-04]]), n_func_evaluations=3134, n_jac_evaluations=0, algorithm_has_converged=True, algorithm_name='RK45', algorithm_settings={'first_step': None, 'max_step': inf, 'rtol': 0.001, 'atol': 1e-06}, algorithm_termination_message='The solver successfully reached the end of the integration interval.', jac_wrt_desvar=array([], dtype=float64), jac_wrt_initial_state=array([], dtype=float64), terminal_event_index=None, final_state=array([[ 1.99944457e+00], [-6.67382536e-04]]), termination_time=array([0.5])) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.176 seconds) .. _sphx_glr_download_examples_ode_ode_problem_plot_van_der_pol.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_van_der_pol.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_van_der_pol.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_van_der_pol.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_