Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Documentation"

on:
push:
branches:
- master
tags: '*'
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }}

jobs:
build-and-deploy-docs:
name: "Documentation"
uses: "SciML/.github/.github/workflows/documentation.yml@v1"
secrets: "inherit"
16 changes: 8 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ uuid = "e2752cbe-bcf4-5895-8727-84ebc14a76bd"
version = "1.6.3"

[deps]
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
MATLAB = "10e44e05-a98a-55b3-a45b-ba969058deb6"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
ModelingToolkitBase = "7771a370-6774-4173-bd38-47e70ca0b839"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLPublic = "431bcebd-1456-4ced-9d72-93c2757fff0b"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
DiffEqBase = "6.122, 7"
MATLAB = "0.8.1, 0.9, 0.10"
ModelingToolkit = "11.22"
ModelingToolkitBase = "1.30"
ParameterizedFunctions = "5"
PrecompileTools = "1.1"
Reexport = "1"
SafeTestsets = "0.1, 1"
SciMLBase = "3.27"
SciMLTesting = "2.1"
SciMLBase = "3.28.4"
SciMLPublic = "1"
SciMLTesting = "2.4"
Symbolics = "7.34"
Test = "<0.0.1, 1"
julia = "1.10"

Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ that MATLAB can handle:
If you need arbitrary precision or GPU computing, use the native Julia solvers
from [DifferentialEquations.jl](https://docs.sciml.ai/DiffEqDocs/stable/) instead.

Note that the algorithms are defined to have the same name as the MATLAB algorithms,
but are not exported. Thus to use `ode45`, you would specify the algorithm as
`MATLABDiffEq.ode45()`.
The algorithms have the same names as their MATLAB counterparts. They are public but not
exported, so use qualified names such as `MATLABDiffEq.ode45()`.

### Available Solvers

Expand All @@ -60,7 +59,7 @@ but are not exported. Thus to use `ode45`, you would specify the algorithm as
## Example

```julia
using MATLABDiffEq, ParameterizedFunctions
using MATLAB, MATLABDiffEq, ParameterizedFunctions, SciMLBase

f = @ode_def LotkaVolterra begin
dx = 1.5x - x*y
Expand Down Expand Up @@ -91,22 +90,22 @@ is done. Thus you can simply call the same ODE function and time it
directly. This is done by:

```julia
@time MATLABDiffEq.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
@time MATLAB.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
```

To be even more pedantic, you can play around in the actual MATLAB
session by using

```
MATLABDiffEq.show_msession()
MATLAB.show_msession()
```

## Overhead Amount

Generally, for long enough problems the overhead is minimal. Example:

```julia
using DiffEqBase, ParameterizedFunctions, MATLABDiffEq
using MATLAB, MATLABDiffEq, ParameterizedFunctions, SciMLBase
f = @ode_def_bare RigidBodyBench begin
dy1 = -2*y2*y3
dy2 = 1.25*y1*y3
Expand All @@ -132,16 +131,16 @@ julia> @time sol = solve(prob, alg);
julia> @time sol = solve(prob, alg);
0.065460 seconds (38.84 k allocations: 1.556 MB)

julia> @time MATLABDiffEq.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
julia> @time MATLAB.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
0.058249 seconds (11 allocations: 528 bytes)

julia> @time MATLABDiffEq.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
julia> @time MATLAB.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
0.060367 seconds (11 allocations: 528 bytes)

julia> @time MATLABDiffEq.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
julia> @time MATLAB.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
0.060171 seconds (11 allocations: 528 bytes)

julia> @time MATLABDiffEq.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
julia> @time MATLAB.eval_string("[t,u] = $(algstr)(diffeqf,tspan,u0,options);")
0.058928 seconds (11 allocations: 528 bytes)
```

Expand Down
8 changes: 8 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
MATLABDiffEq = "e2752cbe-bcf4-5895-8727-84ebc14a76bd"

[compat]
Documenter = "1"
MATLABDiffEq = "1.6"
julia = "1.10"
18 changes: 18 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Documenter
using MATLABDiffEq

DocMeta.setdocmeta!(MATLABDiffEq, :DocTestSetup, :(using MATLABDiffEq); recursive = true)

makedocs(;
modules = [MATLABDiffEq],
sitename = "MATLABDiffEq.jl",
doctest = true,
checkdocs = :exports,
format = Documenter.HTML(;
canonical = "https://docs.sciml.ai/MATLABDiffEq/stable/",
prettyurls = get(ENV, "CI", "false") == "true",
),
pages = ["Home" => "index.md"],
)

deploydocs(; repo = "github.com/SciML/MATLABDiffEq.jl.git", push_preview = true)
47 changes: 45 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
```@meta
CurrentModule = MATLABDiffEq
```

# MATLABDiffEq.jl

```@autodocs
Modules = [MATLABDiffEq]
MATLABDiffEq provides SciML algorithm markers that solve ODE problems with MATLAB's ODE
routines. It is primarily intended for comparing implementations and migrating MATLAB
models; native Julia solvers are the recommended choice for production workloads.

## Basic Usage

Load `SciMLBase` for the problem and solve interfaces, then pass a qualified MATLABDiffEq
algorithm to `solve`:

```julia
using MATLABDiffEq, SciMLBase

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

prob = ODEProblem(lorenz!, [1.0, 0.0, 0.0], (0.0, 100.0))
sol = solve(prob, MATLABDiffEq.ode45(); reltol = 1.0e-6, abstol = 1.0e-8)
```

The MATLAB engine must be installed and available to MATLAB.jl. MATLABDiffEq accepts
`Float64`, standard integer, and `Complex{Float64}` state values. Callbacks are not
supported.

## Public API

Algorithm types are public but not exported, which avoids collisions with similarly named
algorithms from other solver packages. Use them through the `MATLABDiffEq` namespace.

```@docs
MATLABAlgorithm
ode23
ode45
ode113
ode23s
ode23t
ode23tb
ode15s
ode15i
```
Loading
Loading