diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index cb9b8e84..49125007 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -162,3 +162,24 @@ savefig("tutorial-3d.png"); nothing # hide ``` ![](tutorial-3d.png) + +## Adding a new enclosure algorithm + +To add a new enclosure algorithm, or *solver*, just add a corresponding struct (let us call it `MyEnclosure`) and extend the method `enclose`, as the following code snippet demonstrates. + +```@example +using RangeEnclosures +import RangeEnclosures: enclose +using IntervalArithmetic: Interval + +struct MyEnclosure end + +function enclose(f::Function, + D::Union{Interval,IntervalBox}, + solver::MyEnclosure; kwargs...) + # solver-specific implementation +end +nothing # hide +``` + +Note that the domain `D` can be of type `Interval` for univariate (``n = 1``) functions or of type `IntervalBox` for multivariate (``n > 1``) functions. diff --git a/paper/paper.tex b/paper/paper.tex index 5aa9c180..ecfcebc9 100644 --- a/paper/paper.tex +++ b/paper/paper.tex @@ -55,9 +55,9 @@ \subsection{The enclose API} \vspace*{-3mm} \begin{lstlisting}[language=Julia] import RangeEnclosures: enclose -import IntervalArithmetic: Interval +using IntervalArithmetic: Interval function enclose(f::Function, - dom::Union{Interval,IntervalBox}, + D::Union{Interval,IntervalBox}, solver::MyEnclosure; kwargs...) # solver-specific implementation end