Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
15251af
Fixed step integration working in iterator mode
pwl Oct 6, 2015
ec2c14f
New dense output and file structure
pwl Oct 8, 2015
cb676f1
WIP: merging fixed and adaptive methods
pwl Nov 18, 2015
df951d7
Iterator version of rk solvers
pwl Nov 18, 2015
1c8f561
Bug fixes and reverse time integration
pwl Nov 19, 2015
333d422
Rootfinding
pwl Nov 19, 2015
f229ee9
Minor fixes and cleanup of the code
pwl Nov 20, 2015
da5a09b
Some WIP for the ode23s
pwl Apr 6, 2016
1b7742d
RK stepper WIP
pwl Apr 8, 2016
4dd0615
DenseStepper compatible with Solver
pwl Apr 11, 2016
58b9ad4
Finished the higher level interface
pwl Apr 12, 2016
0aa2e92
Small fixes
pwl Apr 12, 2016
b21b326
No more overshooting
pwl Apr 13, 2016
7b6d6b8
This should eliminate the conversions to Float64
pwl Apr 22, 2016
f558b9f
Review for @pwl
mauro3 Apr 23, 2016
408b149
First round of fixes from @mauro3 comments.
pwl Apr 29, 2016
b6e2b55
Round two of fixes
pwl Apr 30, 2016
d612953
Graceful treatment of integer initial conditions
pwl Jun 24, 2016
53daa74
Added back the old solvers
pwl Jun 24, 2016
5891a43
Add Gitter badge
gitter-badger Jun 25, 2016
1367155
Minor fixes for the Rosenbrock methods
pwl Jun 25, 2016
c4fc212
Added the ForwardDiff jacobian as the default
pwl Jun 25, 2016
c62bc05
isFSAL is now a parameter
pwl Jun 25, 2016
9f05c64
Fixed type stability for RK & updated the tableaus
pwl Jun 26, 2016
f9bb09d
Added new tests by @mauro and more fixes
pwl Jun 27, 2016
ec61459
Improved type stability for ode23s
pwl Jun 27, 2016
7cc07ac
Tests for the jac keyword argument
pwl Jun 30, 2016
7a082b1
Better tests and fixed a jacobian bug
pwl Jun 30, 2016
2a52053
Improved convert for RKTableau
pwl Jul 1, 2016
6f057b7
Update README.md
pwl Jul 13, 2016
210a81e
Minor fixes
pwl Jul 17, 2016
af2dc46
New ODE types
pwl Jul 17, 2016
56f98a1
Decoupling options and solver
pwl Jul 20, 2016
22e15cd
No more Iterators
pwl Jul 20, 2016
4c085e6
Removed the unused dtinit
pwl Jul 20, 2016
0fe7ec4
a few comments
mauro3 Jul 20, 2016
f979d94
Dropped {T,Y} from Solver
mauro3 Jul 20, 2016
5f09191
Merge pull request #5 from JuliaODE/m3/dev
pwl Jul 20, 2016
86ec3a0
Minor fixes after @mauro3 comments
pwl Jul 20, 2016
b470611
Adaptive and Fixed Options
pwl Jul 20, 2016
843c26d
Tests for RK pass, removed backward integration
pwl Jul 20, 2016
a2c1527
Fixed ode23s
pwl Jul 20, 2016
7b8b449
Fixed the tests for the iterator interface
pwl Jul 20, 2016
fbb68e2
Brought back the Jacobian
pwl Jul 20, 2016
21e3506
New dense interface
pwl Jul 21, 2016
7e64beb
New backend and Runge-Kutta implementaion
pwl Jul 24, 2016
7d6edcd
Updated docs
pwl Jul 24, 2016
e18fbe2
some cleanup of iteration
mauro3 Jul 25, 2016
dabbf5d
running partly again
mauro3 Jul 25, 2016
e7c99c8
addressed comments
mauro3 Jul 25, 2016
86c75c1
Bug-dic in errorcontrol! in RK
mauro3 Jul 25, 2016
b3cba83
Added tdir
mauro3 Jul 25, 2016
54fa6e0
import Compat.String
mauro3 Jul 25, 2016
23e0d19
updated statuses
mauro3 Jul 25, 2016
ce14127
Merge pull request #8 from JuliaODE/m3/dev
pwl Jul 25, 2016
1089bdd
Working ode23s
mauro3 Jul 25, 2016
d2a1d9d
New dense output
pwl Jul 25, 2016
581ba3b
added example
mauro3 Jul 25, 2016
69a276c
Brought interfaces.jl up do date with the new dense
pwl Jul 25, 2016
27d370c
Reverse time integration for dense output
pwl Jul 25, 2016
7602fcc
Merge branch 'dev' of github.com:JuliaODE/ODE.jl into jode/dev
mauro3 Jul 25, 2016
54cb490
Fixed some problems with dense output
pwl Jul 25, 2016
0db44f1
ode23s mostly working
mauro3 Jul 25, 2016
66eacc6
updated according to pwl's comments
mauro3 Jul 25, 2016
7d61205
Minor refactoring
pwl Jul 25, 2016
c4f07af
Merge branch 'dev' of github.com:JuliaODE/ODE.jl into dev
pwl Jul 25, 2016
10595ae
updated REQUIRE
mauro3 Jul 25, 2016
d1e82d0
Merge branch 'dev' of github.com:JuliaODE/ODE.jl into jode/dev
mauro3 Jul 25, 2016
531abe4
Changed tspan to tout
pwl Jul 25, 2016
5c1e2da
Merge branch 'dev' of github.com:JuliaODE/ODE.jl into dev
pwl Jul 25, 2016
46b8cfb
Travis
pwl Jul 25, 2016
00e1667
Updated the badges
pwl Jul 25, 2016
7382d03
Updated the badges
pwl Jul 25, 2016
c43a10a
Merge branch 'dev' of github.com:JuliaODE/ODE.jl into jode/dev
mauro3 Jul 25, 2016
69aebb8
Tableau restructure
mauro3 Jul 26, 2016
954a961
improved tableau situation in RK
mauro3 Jul 26, 2016
29cfd4a
starting on rename
mauro3 Jul 26, 2016
880878e
ode->ivp
mauro3 Jul 26, 2016
06b3322
Rest of the renames
mauro3 Jul 26, 2016
fd1ce43
Fixed inconsistency in RK-tableau conversion
mauro3 Jul 26, 2016
b63470f
Merge pull request #9 from JuliaODE/m3/rename
mauro3 Jul 26, 2016
f4c7557
Updated dense output to wrap the Integrator
mauro3 Jul 26, 2016
0a55d99
Added tdir to dense
mauro3 Jul 26, 2016
eb4af91
Big file rename.
mauro3 Jul 26, 2016
f5fb91a
Merge pull request #4 from JuliaODE/dev
pwl Jul 26, 2016
3227dee
Update interpolate!
mauro3 Jul 26, 2016
2769081
Implementing integrator, tutorial
pwl Jul 26, 2016
9f137c3
Merge branch 'dev' of github.com:JuliaODE/ODE.jl into dev
pwl Jul 26, 2016
0d5141e
Changed interpolate! signature back
mauro3 Jul 26, 2016
8fda07c
doc-string for
mauro3 Jul 26, 2016
0c0a6c1
Minor changes, added `integ` as a keyword argument
pwl Jul 27, 2016
3ad4c42
Docs
pwl Jul 27, 2016
f6b7c9c
Removed the old docs
pwl Jul 27, 2016
31a1ec3
Travis docs
pwl Jul 27, 2016
8f38391
Minor fixes and docs
pwl Jul 28, 2016
588d2e5
Got rid of the specialized `solve`
pwl Jul 28, 2016
38b52c0
Merge pull request #16 from JuliaODE/experimental
pwl Jul 28, 2016
0818654
Merge pull request #12 from JuliaODE/dev
pwl Jul 28, 2016
65acc94
New example of a custom integrator
pwl Jul 31, 2016
aefd4d7
Merge pull request #18 from JuliaODE/experimental
pwl Jul 31, 2016
280ba47
Minor fixes
pwl Jul 31, 2016
1239014
Added .documenter.enc
pwl Jul 31, 2016
434b11c
Merge branch 'experimental' into dev
pwl Jul 31, 2016
7913aa4
More fixes, removed `tdir` from dense output
pwl Jul 31, 2016
d4ef5a7
Fixes for the custom integrator
pwl Jul 31, 2016
3b6a70e
Prototype of a test function for custom integrators
pwl Jul 31, 2016
8c1aaf3
Added an iterator trait to Problem
pwl Aug 1, 2016
d081659
Minor doc update
pwl Aug 18, 2016
6acd283
More minor fixes
pwl Aug 18, 2016
f65448a
New tests module
pwl Aug 18, 2016
79fc44d
New test suite, including custom types
pwl Aug 18, 2016
ad0f43b
Even better tests (via @testset)
pwl Aug 19, 2016
414862b
New naming convention and Solution type
pwl Aug 19, 2016
e3bff55
Moved the ODETest to a submodule
pwl Aug 19, 2016
003b3e1
Removed an old `tdir` from dense output
pwl Aug 19, 2016
a173cef
Updated docs
pwl Aug 19, 2016
6e48fe0
Fixed infinite tstop bug custom type test
pwl Aug 23, 2016
ed09054
Better handling of function types in IVP
pwl Aug 23, 2016
91a1bfe
Comment cleanup
pwl Aug 23, 2016
c373406
Switched to the Documenter HTML generation
pwl Aug 25, 2016
d902e56
Wrapped all the tests into testsets
pwl Sep 7, 2016
fec75b9
Removed interface-tests.jl
pwl Sep 7, 2016
254cab3
Merge pull request #19 from JuliaODE/dev
pwl Sep 7, 2016
ce9864b
Update REQUIRE
pwl Sep 8, 2016
9f02b20
Temporary fix: disabled building on release
pwl Sep 9, 2016
9e7ccfd
Fixing the docs
pwl Sep 16, 2016
e5c4b26
Removed obsolate badges
pwl Sep 16, 2016
e47748b
Added back pygments dependency
pwl Sep 16, 2016
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
docs/build
docs/site
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ os:
- osx
- linux
julia:
- 0.3
- release
- 0.5
- nightly
git:
depth: 999999
notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.build("ODE"); Pkg.test("ODE"; coverage=true)';
- julia -e 'Pkg.clone("https://github.com/JuliaODE/ODE.jl.git"); Pkg.build("ODE"); Pkg.test("ODE"; coverage=true)';

after_success:
- julia -e 'cd(Pkg.dir("ODE")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder()); Codecov.submit(process_folder())';
- julia -e 'Pkg.add("Documenter")'
- julia -e 'cd(Pkg.dir("ODE")); include(joinpath("docs", "make.jl"))'
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
Various basic Ordinary Differential Equation solvers implemented in Julia.

[![Build Status](https://travis-ci.org/JuliaLang/ODE.jl.svg?branch=master)](https://travis-ci.org/JuliaLang/ODE.jl)
[![Coverage Status](https://img.shields.io/coveralls/JuliaLang/ODE.jl.svg)](https://coveralls.io/r/JuliaLang/ODE.jl)
[![ODE](http://pkg.julialang.org/badges/ODE_0.3.svg)](http://pkg.julialang.org/?pkg=ODE&ver=0.3)
[![ODE](http://pkg.julialang.org/badges/ODE_0.4.svg)](http://pkg.julialang.org/?pkg=ODE&ver=0.4)
[![Join the chat at https://gitter.im/pwl/ODE.jl](https://badges.gitter.im/pwl/ODE.jl.svg)](https://gitter.im/pwl/ODE.jl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/JuliaODE/ODE.jl.svg?branch=master)](https://travis-ci.org/JuliaODE/ODE.jl)
[![Coverage Status](https://img.shields.io/coveralls/JuliaODE/ODE.jl.svg)](https://coveralls.io/r/JuliaODE/ODE.jl)
[![ODE](http://pkg.julialang.org/badges/ODE_0.5.svg)](http://pkg.julialang.org/?pkg=ODE&ver=0.5)
<!-- [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaODE.github.io/ODE.jl/stable) -->
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaODE.github.io/ODE.jl/latest)

Pull requests are always highly welcome to fix bugs, add solvers, or anything else!

# API discussions

There are currently discussions about how the Julian API for ODE solvers should look like, and the current documentation is more like a wishlist than a documentation. The API has changed considerably since the initial v0.1 release, so be carefull when you upgrade to v0.2 or later versions.

# Current status of the project
Expand Down
3 changes: 2 additions & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
julia 0.3
julia 0.5-
Polynomials
ForwardDiff
Compat 0.4.1
35 changes: 0 additions & 35 deletions doc/api.md

This file was deleted.

10 changes: 0 additions & 10 deletions doc/solvers.md

This file was deleted.

Binary file added docs/.documenter.enc
Binary file not shown.
25 changes: 25 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Documenter, ODE

makedocs(
format = Documenter.Formats.HTML,
modules = [ODE],
clean = false,
sitename = "ODE.jl",
pages = [
"Home" => "index.md",

"Manual" => [
"Basics" => "man/basics.md",
"Base" => "man/base.md"
]
]

)

deploydocs(
repo = "github.com/JuliaODE/ODE.jl.git",
target = "build",
julia = "0.5",
deps = Deps.pip("pygments", "python-markdown-math"),
make = nothing
)
218 changes: 218 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
```@contents
Pages = [
"tutorials/euler_integrator.md",
"man/basics.md",
"man/base.md"
]
```

# ODE.jl

## Top level interface

If you are looking to getting a solution without the additional hussle
of handling an iterator we provide the wrappers `ODE.odeXX`. They
provide a simplistic way of handling explicit differential equations
of the form `y'=F(t,y)` with `y` being either a `Number` or an
`AbstractArray` of any dimension. Below we solve a simple initial
value problem given by `y'=y` with initial data at `t0=0.0` and
`y0=1.0` on the interval `[t0,1]`.

```@example ode
using ODE
tspan = [0.0,1.0]
y0 = 1.0
F(t,y) = y
(t,y) = ODE.ode(F,y0,tspan)
```

The vectors `t` and `y` store the time and solution values at the
corresponding times.

## Solve interface

`ODE.ode` only supports explicit differential equations defined as
`y'=F(t,y)`, for more advenced uses consider using `ODE.solve`, which
was designed to work with a variety of other types of initial value
problems and is optimized for better performance. First we have to
define an initial value problem, in our case this is an explicit
differential equation `y'=y` with inital data `y0=[1.0]` given at the
time `t0=0.0`.

```@example solve
using ODE
t0 = 0.0
y0 = [1.0]
F!(t,y,dy) = dy[1]=y[1]
ode = ODE.ExplicitODE(t0,y0,F!)
```

Note that unlike in `ODE.ode` we now have to supply an in place
function `F!` instead of an explicit function `F`. We can solve the
ODE problem `ode` by simply calling

```@example solve
sol = ODE.solve(ode, tstop = 1)
```

This returns a `Solution` type, which stores the solution. You
probably noticed that we passed a keyword argument `tstop`, this is
the final time of integration which we have to specify because `tstop`
defaults to `Inf` and the integration would carry on forever. You can
access the solution with

```@example solve
(t,y) = sol.t, sol.y
```

You can change the default algorithm (Runge-Kutta (4,5)) by passing an
optional argument `solver`

```@example solve
sol = ODE.solve(ode, tstop = 1, solver = ODE.RKIntegratorAdaptive{:dopri5})
```

For other options accepted by `solve` see [Options](/Options/) below.

You might still find this interface limiting. First of all, it stores
all the results, so if you are only interested in the final value of
`y` it still stores all the intermediate steps. Secondly, you cannot
process the results on the fly (e.g. plot the current state of a
solution). If you need more control you should consider using the
iterator interface.

## Iterator interface

To offeset the limitations of the `ODE.ode` interface we implemented a
general. We use the same problem as before as an example

```@example iterate
using ODE
t0 = 0.0
y0 = [1.0]
F!(t,y,dy) = dy[1]=y[1]
ode = ODE.ExplicitODE(t0,y0,F!)
```

Now we have full flow control over the solver, we can analyze the
intermediate results or interrupt the integration at any point.

```@example iterate
for (t,y) in ODE.iterate(ode)
@show (t,y)
if t > 1
break
end
end
```

Note that we had to break the loop because `sol` would keep producing
the results. To set the final integration time and other parameters
of the integrator `integ` we can pass optional arguments to
`ODE.solver`.

```@example iterate
for (t,y) in ODE.iterate(ode; tstop = 1)
@show (t,y)
end
```

This approach has the added benefit of the solution never exceeding
the final time. Both `ODE.iterate` and `ODE.solve` support the same
options, so you can easily change the method of integration with the
keyword `solver`.

Apart from the time and value `(t,y)` the `ODE.solve` also returns the
derivative, you can retrive it as the third argument in the returned
tuple. In the following example we use it compute the absolute
residual error (zero in this case).

```@example iterate
for (t,y,dy) in ODE.iterate(ode; tstop = 1)
err = norm(y-dy)
@show err
end
```

With `tstop` specified we can also get all results at once using
`collect` and other constructs working on iterators
(e.g. generators). For example

```@example iterate
iter = ODE.iterate(ode; tstop = 1)
solution = collect(iter)
```

returns a vector of triples `(t,y,dy)`. Or if you only wan the first
component of a solution you could simply use

```@example iterate
y1 = collect(y[1] for (t,y) in iter)
```

There are, however, several caveats that you should take into account:

1. Each time the iterator is collected the differential equation is
actually solved, which has potentially high computational cost and
might be inefficient.

2. The `length` is undefined for the result of `ODE.iterate`, because
we don't know a priori how many steps the integration will require
(especially in the case of adaptive solvers). This means that the
functions requireing `length` might not work. For the same reason
there are no `getindex` methods.

## Options

Both `ODE.ode` and `ODE.solve` accept the following keyword arguments.

- `integ`: the type of integrator to use, defaults to a adaptive
Runge-Kutta method of order 4/5. To see the list of available
integrators see [`Integrators`](@ref).

- `initstep`: The initial step size, defaults to `eps(T)^(1/3)`.

- `tstop`: The final integration time, never exceeded by the
integrator. In case of `ODE.ode(F,y0,tspan)` this option defaults
to the last element of `tspan` if it is a vector. In `ODE.solve`
the default is `tstop=Inf`. If `tstop` is smaller then `t0` the
integration runs backwards in time.

Apart from these general options, each integrator has its own keyword
arguments. In particular all integrators with adaptive step size
can be cotrolled with

- `reltol`, `abstol`: The relative and absolute error tolerances. The
solution guarantees that at each step we have
`norm((y-yc)*reltol.+abstol)<=1`, where `yc` is a true solution to
and IVP. Defaults are `reltol=eps(T)^(1/3)/10`,
`abstol=eps(T)^(1/2)/10`.

- `norm`: The norm used to measure error in the formula above,
defaults to `y->Base.vecnorm(y,Inf)`. You can specify it to assign
different weights to different components of `y`.

- `minstep`, `maxstep`: Minimal and maximal stepsize for the
integrator. If at any point the stepsize exceeds these limits the
integrator will yield an error and cease producing
results. Deafaults are `minstep=10*eps(T)` and `maxstep=1/minstep`.

- `maxiters`: The number of iterations before the integrator ceases to
work, defaults to `Inf`. Useful as a safeguard from iterator
continuing ad infinitum.

- `isoutofdomain`: Applied to each component of `y`, if
`isoutofdomain(y[i])==true` the integrator stops. Defaults to
`Base.isnan`.

Apart from these, each integrator may support additional options.

## Integrators

### Explicit Runge-Kutta integrators

### Rosenbrock methods

### Backwards differential formula (BDF) methods

### ???
46 changes: 46 additions & 0 deletions docs/src/man/base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
```@meta
CurrentModule = ODE
```

# Base

The file `base.jl` implements the most basic iterator infrastructure
for solvers and the definitions of the types representing general IVP
(initial value problem) and solvers.

## General functions for solving initial value problems

```@docs
solve
iterate
```

## Predefined types of initial value problems

```@docs
AbstractIVP
IVP
ExplicitODE
ImplicitODE
```

## Solver architecture

```@docs
AbstractSolver
AbstractIntegrator
AbstractState
Solution
```

The fallback constructor for `AbstractSolver(ivp::IVP;opts...)` ensures
that an error is thrown if a solver is constructed for an unsupported
type of the given IVP.

## Fallback functions for solvers

```@docs
Base.length(::AbstractSolver)
output(::AbstractState)
Base.eltype{T,Y}(::Type{AbstractIVP{T,Y}})
```
3 changes: 3 additions & 0 deletions docs/src/man/basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Basic usage

Consider an ODE $y'=y$
Loading