sciml / matlabdiffeq.jl Goto Github PK
View Code? Open in Web Editor NEWCommon interface bindings for the MATLAB ODE solvers via MATLAB.jl for the SciML Scientific Machine Learning ecosystem
License: Other
Common interface bindings for the MATLAB ODE solvers via MATLAB.jl for the SciML Scientific Machine Learning ecosystem
License: Other
MethodError: no method matching solve(::DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,RigidBodyBench,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::Array{Float64,1}; dense=false, save_everystep=false, maxiters=10000000, ttimeseries_errors=false, verbose=false, abstol=0.001, reltol=Dict(:alg=>OrdinaryDiffEq.DP5()), timeseries_errors=false, dense_errors=false)
Closest candidates are:
solve(::DiffEqBase.AbstractODEProblem{uType,tType,isinplace}, ::DiffEqBase.InternalEuler.FwdEulerAlg; dt, tstops, kwargs...) where {uType, tType, isinplace} at C:\Users\rbakkann.julia\v0.6\DiffEqBase\src\internal_euler.jl:21
solve(::DiffEqBase.AbstractODEProblem{uType,tType,isinplace}, ::DiffEqBase.InternalEuler.BwdEulerAlg; dt, tstops, tol, maxiter, kwargs...) where {uType, tType, isinplace} at C:\Users\rbakkann.julia\v0.6\DiffEqBase\src\internal_euler.jl:51
solve(::DiffEqBase.AbstractODEProblem{uType,tType,isinplace}, ::AlgType<:MATLABDiffEq.MATLABAlgorithm) where {uType, tType, isinplace, AlgType<:MATLABDiffEq.MATLABAlgorithm} at C:\Users\rbakkann.julia\v0.6\MATLABDiffEq\src\MATLABDiffEq.jl:26 got unsupported keyword arguments "dense", "save_everystep", "maxiters", "ttimeseries_errors", "verbose", "abstol", "reltol", "timeseries_errors", "dense_errors"
...
Stacktrace:
[1] #WorkPrecision#11(::Void, ::Int64, ::DiffEqDevTools.TestSolution{Void,0,true,Void,Void,DiffEqBase.ODESolution{Float64,2,Array{Array{Float64,1},1},Void,Void,Array{Float64,1},Array{Array{Array{Float64,1},1},1},DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,RigidBodyBench,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem},OrdinaryDiffEq.Vern7,OrdinaryDiffEq.InterpolationData{RigidBodyBench,Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Vern7Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Vern7ConstantCache{Float64,Float64}}}}}, ::Symbol, ::Array{Any,1}, ::Type{T} where T, ::DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,RigidBodyBench,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Dict{Symbol,V} where V,1}, ::Void) at C:\Users\rbakkann.julia\v0.6\DiffEqDevTools\src\benchmark.jl:167
[2] (::Core.#kw#Type)(::Array{Any,1}, ::Type{DiffEqDevTools.WorkPrecision}, ::DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,RigidBodyBench,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Dict{Symbol,V} where V,1}, ::Void) at .<missing>:0 (repeats 2 times)
[3] include_string(::String, ::String) at .\loading.jl:515
In [ ]:
1
โ
using OrdinaryDiffEq, ODEInterfaceDiffEq, Plots, ODE
using DiffEqDevTools
abstols = 1./10.^(6:13)
reltols = 1./10.^(3:10)
sol = solve(prob,Vern7(),abstol=1/10^14,reltol=1/10^14)
test_sol = TestSolution(sol)
plotly()
setups = [Dict(:alg=>DP5())
Dict(:alg=>dopri5())
Dict(:alg=>BS5())
Dict(:alg=>Tsit5())
Dict(:alg=>Vern6())
Dict(:alg=>Vern7())
Dict(:alg=>MATLABDiffEq.ode45())
]
wp = WorkPrecision(prob,abstols,reltols,setups;appxsol=test_sol,dense=false,save_everystep=false,numruns=1000,maxiters=10000000,ttimeseries_errors=false,verbose=false)
plot(wp)
using MATLABDiffEq
using ModelingToolkit
using OrdinaryDiffEq
@variables t
@variables a(t) = 1.0
D = Differential(t)
@named sys = ODESystem([D(a) ~ ifelse(a>0.0,-a,a)])
prob = ODEProblem(sys, [], (0.0,1.0))
solve(prob,MATLABDiffEq.ode15s())
ERROR: TypeError: non-boolean (Num) used in boolean context
Pkg.add("ParameterizedFunctions")
#Pkg.add("DiffEqBaseQ")
using DiffEqBase, ParameterizedFunctions, MATLABDiffEq
f = @ode_def_bare RigidBodyBench begin
dy1 = I1y2y3
dy2 = I2y1y3
dy3 = I3y1y2 + 0.25*sin(t)^2
end I1=-2 I2=1.25 I3=-.5
prob = ODEProblem(f,[1.0;0.0;0.9],(0.0,100.0))
alg = MATLABDiffEq.ode45()
algstr = string(typeof(alg).name.name)
NFO: Package ParameterizedFunctions is already installed
INFO: METADATA is out-of-date โ you may not have the latest version of ParameterizedFunctions
INFO: Use Pkg.update()
to get the latest versions of your packages
WARNING: deprecated syntax "abstract MATLABAlgorithm<:AbstractODEAlgorithm" at C:\Users\rbakkann.julia\v0.6\MATLABDiffEq\src\MATLABDiffEq.jl:11.
Use "abstract type MATLABAlgorithm<:AbstractODEAlgorithm end" instead.
INFO: Precompiling module MATLABDiffEq.
WARNING: deprecated syntax "abstract MATLABAlgorithm<:AbstractODEAlgorithm" at C:\Users\rbakkann.julia\v0.6\MATLABDiffEq\src\MATLABDiffEq.jl:11.
Use "abstract type MATLABAlgorithm<:AbstractODEAlgorithm end" instead.
ERROR: LoadError: ArgumentError: Module DiffEqBaseQ not found in current path.
Run Pkg.add("DiffEqBaseQ")
to install the DiffEqBaseQ package.
Stacktrace:
[1] _require(::Symbol) at .\loading.jl:428
[2] require(::Symbol) at .\loading.jl:398
[3] include_from_node1(::String) at .\loading.jl:569
[4] include(::String) at .\sysimg.jl:14
[5] anonymous at .<missing>:2
while loading C:\Users\rbakkann.julia\v0.6\MATLABDiffEq\src\MATLABDiffEq.jl, in expression starting on line 6
Failed to precompile MATLABDiffEq to C:\Users\rbakkann.julia\lib\v0.6\MATLABDiffEq.ji.
Stacktrace:
[1] compilecache(::String) at .\loading.jl:703
[2] _require(::Symbol) at .\loading.jl:490
[3] require(::Symbol) at .\loading.jl:398
[4] include_string(::String, ::String) at .\loading.jl:515
Pkg.clone("https://github.com/JuliaDiffEq/MATLABDiffEq.jl")
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
UndefVarError: ode_workprecision_set not defined
Stacktrace:
[1] include_string(::String, ::String) at .\loading.jl:515
using OrdinaryDiffEq, ODEInterfaceDiffEq, Plots, ODE
using DiffEqDevTools
abstols = 1./10.^(6:13)
reltols = 1./10.^(3:10)
sol = solve(prob,Vern7(),abstol=1/10^14,reltol=1/10^14)
test_sol = TestSolution(sol)
plotly()
setups = [Dict(:alg=>DP5())
Dict(:alg=>dopri5())
Dict(:alg=>BS5())
Dict(:alg=>Tsit5())
Dict(:alg=>Vern6())
Dict(:alg=>Vern7())
Dict(:alg=>MATLABDiffEq.ode45())
]
wp = ode_workprecision_set(prob,abstols,reltols,setups;appxsol=test_sol,dense=false,save_everystep=false,numruns=1000,maxiters=10000000,ttimeseries_errors=false,verbose=false)
plot(wp)
Thanks
Was there some other point with this package than to show Julia faster? I mean if MATLAB has some more functionality you can use, and possibly even Octave too, then it's good to know you can call it from Julia easily (through Python, using Oct2Py), as I tried the other day. I doubt their to be faster.
I have no need for ODE/this or related packages, was just curious how it worked, if it uses a toolbox, or same would be available in Octave. Maybe it is despite the error I got here (did I do something wrong?):
https://uk.mathworks.com/help/matlab/math/choose-an-ode-solver.html
>> [t,yv] = ode45(@imaginaryODE, tspan, yv0);
error: 'complexf' undefined near line 6 column 6
error: called from
imaginaryODE at line 6 column 4
starting_stepsize at line 46 column 5
ode45 at line 192 column 25
MWE:
using MATLABDiffEq, OrdinaryDiffeq
function test!(du, u, p, t)
du[1] = -10 * u[1]
du[2] = -0.01 * u[2]
end
u0 = [1.01;1.01]
tspan = (0.0, 1.0)
prob = ODEProblem(test!, u0, tspan)
julia> sol = solve(prob,MATLABDiffEq.ode15s(),saveat=0.1)
retcode: Default
Interpolation: 1st order linear
t: 3-element Array{Float64,1}:
0.0
0.1
1.0
u: 3-element Array{Array{Float64,1},1}:
[1.01, 1.01]
[0.37077117078064675, 1.0089905071455934]
[4.5854039847379484e-5, 0.999950334377818]
julia> sol = solve(prob,QNDF(),saveat=0.1)
retcode: Success
Interpolation: 1st order linear
t: 11-element Array{Float64,1}:
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
u: 11-element Array{Array{Float64,1},1}:
[1.01, 1.01]
[0.3704455272364188, 1.0089905040249973]
[0.13627476141582867, 1.0079820112760844]
[0.050307801181049064, 1.0069745370891778]
[0.01851968870439673, 1.0059680647903897]
[0.006835631288839779, 1.0049625956099648]
[0.0025256513813332842, 1.003958139676276]
[0.0009254926520955427, 1.0029546814523527]
[0.00034266531842009777, 1.001952223812029]
[0.00012726307534597449, 1.0009507730292209]
[4.611900409656228e-5, 0.9999503229774236]
@JuliaRegistrator register()
Hi, this is cool to have a benchmark. I tried to run the example code in the readme, and got
julia> using DiffEqBase, ParameterizedFunctions, MATLABDiffEq
INFO: Precompiling module MATLAB.
julia> f = @ode_def_bare RigidBodyBench begin
dy1 = I1*y2*y3
dy2 = I2*y1*y3
dy3 = I3*y1*y2 + 0.25*sin(t)^2
end I1=-2 I2=1.25 I3=-.5
(::RigidBodyBench) (generic function with 3 methods)
julia> prob = ODEProblem(f,[1.0;0.0;0.9],(0.0,100.0))
DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,RigidBodyBench}(RigidBodyBench,[1.0,0.0,0.9],(0.0,100.0))
julia> alg = MATLABDiffEq.ode45()
MATLABDiffEq.ode45()
julia> algstr = string(typeof(alg).name.name)
"ode45"
julia> @time sol = solve(prob,alg);
ERROR: UndefVarError: ParameterizedFunction not defined
in #solve#1(::Array{Float64,1}, ::Bool, ::Float64, ::Float64, ::Array{Any,1}, ::Function, ::DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,RigidBodyBench}, ::MATLABDiffEq.ode45, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}) at /Users/abradley/.julia/v0.5/MATLABDiffEq/src/MATLABDiffEq.jl:22
in solve(::DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,RigidBodyBench}, ::MATLABDiffEq.ode45) at /Users/abradley/.julia/v0.5/MATLABDiffEq/src/MATLABDiffEq.jl:22
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.