Skip to content

Example doesn't re-initialize the integration #258

@ianhbell

Description

@ianhbell

The "simple example" doesn't re-start the integration at [1,0] for each of the integration methods; each is chained after the one preceding it. This was very confusing when I was trying to compare against results from odeint:

import timeit
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt 
import numpy as np

def fprime(t, x):
    gam = 0.15
    return x[1], -x[0]-gam*x[1]

tic = timeit.default_timer()
sol = solve_ivp(fprime, [0.0, 10], y0=[1,0], method='RK45', dense_output=True, rtol=1e-8, atol=1e-10)
toc = timeit.default_timer()

t = np.linspace(np.min(sol.t), np.max(sol.t), 10000)
soly = sol.sol(t)
plt.plot(t, soly.T)
plt.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions