Skip to content

Commit

Permalink
update diffeqbase
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Sep 7, 2019
1 parent c2393b6 commit e095e36
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 16 deletions.
19 changes: 19 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name = "DiffEqUncertainty"
uuid = "ef61062a-5684-51dc-bb67-a0fcdec5c97d"
authors = ["Chris Rackauckas <[email protected]>"]
version = "v1.2.0"

[deps]
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"

[compat]
julia = "1"
DiffEqBase = "6"

[extras]
DiffEqProblemLibrary = "a077e3f3-b75c-5d7f-a0c6-6bc4c8ec64a9"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["DiffEqProblemLibrary", "Test", "OrdinaryDiffEq"]
34 changes: 18 additions & 16 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
using DiffEqUncertainty, DiffEqBase, OrdinaryDiffEq, DiffEqProblemLibrary, DiffEqMonteCarlo
using DiffEqUncertainty, DiffEqBase, OrdinaryDiffEq, DiffEqProblemLibrary
using Test

using ParameterizedFunctions
g = @ode_def_bare LorenzExample begin
dx = σ*(y-x)
dy = x*-z) - y
dz = x*y - β*z
end σ ρ β
function g(du,u,p,t)
σ,ρ,β = p
x,y,z = u
du[1] = σ*(y-x)
du[2] = x*-z) - y
du[3] = x*y - β*z
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,10.0)
p = [10.0,28.0,8/3]
prob = ODEProblem(g,u0,tspan,p)

cb = ProbIntsUncertainty(1e4,5)
solve(prob,Tsit5())
monte_prob = MonteCarloProblem(prob)
sim = solve(monte_prob,Tsit5(),num_monte=10,callback=cb,adaptive=false,dt=1/10)
monte_prob = EnsembleProblem(prob)
sim = solve(monte_prob,Tsit5(),trajectories=10,callback=cb,adaptive=false,dt=1/10)

#using Plots; plotly(); plot(sim,vars=(0,1),linealpha=0.4)

fitz = @ode_def_nohes FitzhughNagumo begin
dV = 3.0*(V - V^3/3 + R)
dR = -(1/3.0)*(V - 0.2 - 0.2*R)
function fitz(du,u,p,t)
V,R = u
du[1] = 3.0*(V - V^3/3 + R)
du[2] = -(1/3.0)*(V - 0.2 - 0.2*R)
end
u0 = [-1.0;1.0]
tspan = (0.0,20.0)
prob = ODEProblem(fitz,u0,tspan)

cb = ProbIntsUncertainty(0.1,1)
sol = solve(prob,Euler(),dt=1/10)
monte_prob = MonteCarloProblem(prob)
sim = solve(monte_prob,Euler(),num_monte=100,callback=cb,adaptive=false,dt=1/10)
monte_prob = EnsembleProblem(prob)
sim = solve(monte_prob,Euler(),trajectories=100,callback=cb,adaptive=false,dt=1/10)

#using Plots; plotly(); plot(sim,vars=(0,1),linealpha=0.4)

cb = AdaptiveProbIntsUncertainty(5)
sol = solve(prob,Tsit5())
monte_prob = MonteCarloProblem(prob)
sim = solve(monte_prob,Tsit5(),num_monte=100,callback=cb,abstol=1e-3,reltol=1e-1)
monte_prob = EnsembleProblem(prob)
sim = solve(monte_prob,Tsit5(),trajectories=100,callback=cb,abstol=1e-3,reltol=1e-1)

#using Plots; plotly(); plot(sim,vars=(0,1),linealpha=0.4)

0 comments on commit e095e36

Please sign in to comment.