diff --git a/docs/Project.toml b/docs/Project.toml index 1ab26747..d068a5b1 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,10 +1,12 @@ [deps] +DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" IntervalOptimisation = "c7c68f13-a4a2-5b9a-b424-07d005f8d9d2" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" [compat] +DisplayAs = "0.1" Documenter = "1" IntervalArithmetic = "=0.20.9" # new versions require updates and are incompatible with dependencies IntervalOptimisation = "0.4" diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index 49125007..66815392 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -64,16 +64,15 @@ As you can see, the result is much tighter now, while still being rigorous! The ```@example tutorial using Plots -plot(xlabel="x", ylabel="f(x)", legendfontsize=12, tickfontsize=12, - xguidefont=font(15, "Times"), yguidefont=font(15, "Times")) -plot!(IntervalBox(D, R), label="natural enclosure") -plot!(IntervalBox(D, Rbb), label="branch and bound", alpha=1) -plot!(f, -10, 10, lw=2, c=:black, label="f") -savefig("tutorial-2d.png"); nothing # hide +fig = plot(xlabel="x", ylabel="f(x)", legendfontsize=12, tickfontsize=12, + xguidefont=font(15, "Times"), yguidefont=font(15, "Times")) +plot!(fig, IntervalBox(D, R), label="natural enclosure") +plot!(fig, IntervalBox(D, Rbb), label="branch and bound", alpha=1) +plot!(fig, f, -10, 10, lw=2, c=:black, label="f") +import DisplayAs #hide +DisplayAs.Text(DisplayAs.PNG(fig)) #hide ``` -![](tutorial-2d.png) - ### Tuning parameters Some solvers have parameters that can be tuned. For example, looking at the [`BranchAndBoundEnclosure`](@ref) documentation, we can see that it has two parameters, `tol` and `maxdepth`. @@ -153,16 +152,13 @@ using IntervalArithmetic x = y = -5:0.1:5 f(x, y) = h([x, y]) -plot(legend=:none, size=(800, 800), xlabel="x", ylabel="y", zlabel="h(x,y)", - tickfontsize=18, guidefont=font(22, "Times"), zticks=[-2, 0, 2]) -surface!(x, y, [inf(Rh) for _ in x, _ in y], α=0.4) -surface!(x, y, f.(x', y), zlims=(-4, 4)) -surface!(x, y, [sup(Rh) for _ in x, _ in y], α=0.4) -savefig("tutorial-3d.png"); nothing # hide +fig = plot(legend=:none, size=(800, 800), xlabel="x", ylabel="y", zlabel="h(x,y)", + tickfontsize=18, guidefont=font(22, "Times"), zticks=[-2, 0, 2]) +surface!(fig, x, y, [inf(Rh) for _ in x, _ in y], α=0.4) +surface!(fig, x, y, f.(x', y), zlims=(-4, 4)) +surface!(fig, x, y, [sup(Rh) for _ in x, _ in y], α=0.4) +DisplayAs.Text(DisplayAs.PNG(fig)) #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.