Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example doesn't re-initialize the integration #258

Open
ianhbell opened this issue Oct 20, 2021 · 0 comments
Open

Example doesn't re-initialize the integration #258

ianhbell opened this issue Oct 20, 2021 · 0 comments

Comments

@ianhbell
Copy link

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant