diff --git a/.gitignore b/.gitignore index 21caefb64..525e271af 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ docs/site/ # It records a fixed state of all packages used by the project. As such, it should not be # committed for packages, but should be committed for applications that require a static # environment. -Manifest.toml \ No newline at end of file +Manifest.toml +docs/src/assets/Project.toml diff --git a/docs/Project.toml b/docs/Project.toml index 713f8f89f..802c1eca3 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,4 +1,5 @@ [deps] +BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" diff --git a/docs/make.jl b/docs/make.jl index d02e7a5d3..bc7d411cd 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,8 +9,15 @@ makedocs(sitename = "NonlinearSolve.jl", authors = "Chris Rackauckas", modules = [NonlinearSolve, NonlinearSolve.SciMLBase], clean = true, doctest = false, - format = Documenter.HTML(analytics = "UA-90474609-3", - assets = ["assets/favicon.ico"], + strict = [ + :doctest, + :linkcheck, + :parse_error, + :example_block, + # Other available options are + # :autodocs_block, :cross_references, :docs_block, :eval_block, :example_block, :footnote, :meta_block, :missing_docs, :setup_block + ], + format = Documenter.HTML(assets = ["assets/favicon.ico"], canonical = "https://docs.sciml.ai/NonlinearSolve/stable/"), pages = pages) diff --git a/docs/src/basics/FAQ.md b/docs/src/basics/FAQ.md index 0038ed50b..3a0185aba 100644 --- a/docs/src/basics/FAQ.md +++ b/docs/src/basics/FAQ.md @@ -5,7 +5,7 @@ This is addressed in a [Twitter thread with the author of the improved fzero](https://twitter.com/ChrisRackauckas/status/1544743542094020615). On the test example: -```julia +```@example using NonlinearSolve, BenchmarkTools N = 100_000; @@ -22,7 +22,7 @@ end function f2(out, levels, u0) for i in 1:N - out[i] = solve(IntervalNonlinearProblem{false}(IntervalNonlinearFunction{false}(myfun), + out[i] = solve(NonlinearProblem{false}(IntervalNonlinearFunction{false}(myfun), u0, levels[i]), SimpleNewtonRaphson()).u end end diff --git a/docs/src/tutorials/iterator_interface.md b/docs/src/tutorials/iterator_interface.md index 9e1e70898..a7232fa25 100644 --- a/docs/src/tutorials/iterator_interface.md +++ b/docs/src/tutorials/iterator_interface.md @@ -2,9 +2,10 @@ There is an iterator form of the nonlinear solver which mirrors the DiffEq integrator interface: -```julia +```@example +using NonlinearSolve f(u, p) = u .* u .- 2.0 -u0 = 1.5 # brackets +u0 = 1.5 probB = NonlinearProblem(f, u0) cache = init(probB, NewtonRaphson()) # Can iterate the solver object solver = solve!(cache) diff --git a/docs/src/tutorials/nonlinear.md b/docs/src/tutorials/nonlinear.md index 45be3ffb1..2aa148ca5 100644 --- a/docs/src/tutorials/nonlinear.md +++ b/docs/src/tutorials/nonlinear.md @@ -4,14 +4,14 @@ A nonlinear system $$f(u) = 0$$ is specified by defining a function `f(u,p)`, where `p` are the parameters of the system. For example, the following solves the vector equation $$f(u) = u^2 - p$$ for a vector of equations: -```julia +```@example using NonlinearSolve, StaticArrays f(u,p) = u .* u .- p u0 = @SVector[1.0, 1.0] p = 2.0 probN = NonlinearProblem{false}(f, u0, p) -solver = solve(probN, NewtonRaphson(), tol = 1e-9) +solver = solve(probN, NewtonRaphson(), reltol = 1e-9) ``` where `u0` is the initial condition for the rootfind. Native NonlinearSolve.jl @@ -24,9 +24,10 @@ AbstractArray for automatic differentiation. For scalar rootfinding problems, bracketing methods exist. In this case, one passes a bracket instead of an initial condition, for example: -```julia -f(u, p) = u .* u .- 2.0 -u0 = (1.0, 2.0) # brackets -probB = IntervalNonlinearProblem(f, u0) +```@example +using NonlinearSolve +f(u, p) = u*u - 2.0 +uspan = (1.0, 2.0) # brackets +probB = IntervalNonlinearProblem(f, uspan) sol = solve(probB, Falsi()) ```