Created
December 17, 2018 05:14
-
-
Save ChrisRackauckas/fef4ae7778320530d44b0ff1ab54713a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Sundials, DiffEqBase | |
function lorenz(du,u,p,t) | |
du[1] = 10.0*(u[2]-u[1]) | |
du[2] = u[1]*(28.0-u[3]) - u[2] | |
du[3] = u[1]*u[2] - (8/3)*u[3] | |
end | |
u0 = [1.0;0.0;0.0] | |
tspan = (0.0,100.0) | |
prob = ODEProblem(lorenz,u0,tspan) | |
sol = solve(prob,CVODE_Adams(),reltol=1e-12,abstol=1e-12) | |
prob2 = ODEProblem(lorenz,sol[end],(100.0,0.0)) | |
sol = solve(prob,CVODE_Adams(),reltol=1e-12,abstol=1e-12) | |
@show sol[end]-u0 #[-17.5445, -14.7706, 39.7985] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment