diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..59c7a1f --- /dev/null +++ b/Project.toml @@ -0,0 +1,19 @@ +name = "DiffEqUncertainty" +uuid = "ef61062a-5684-51dc-bb67-a0fcdec5c97d" +authors = ["Chris Rackauckas "] +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"] diff --git a/test/runtests.jl b/test/runtests.jl index 756b909..692c28f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,12 +1,13 @@ -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] @@ -14,14 +15,15 @@ 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) @@ -29,14 +31,14 @@ 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)