From 6952cbadc1d127bb88fd0988438df3bd3cd8d311 Mon Sep 17 00:00:00 2001 From: ArnoStrouwen Date: Sat, 26 Nov 2022 16:47:53 +0100 Subject: [PATCH 1/3] strict docs --- .gitignore | 3 ++- docs/Project.toml | 1 + docs/make.jl | 11 +++++++++-- docs/src/basics/FAQ.md | 4 ++-- docs/src/tutorials/iterator_interface.md | 5 +++-- docs/src/tutorials/nonlinear.md | 13 +++++++------ 6 files changed, 24 insertions(+), 13 deletions(-) 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..631a2b5c9 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()) ``` From 22c940d1ae36a4a688cd6b202f6d4556f70a7fc6 Mon Sep 17 00:00:00 2001 From: ArnoStrouwen Date: Sat, 26 Nov 2022 16:59:57 +0100 Subject: [PATCH 2/3] depend on StaticArrays --- docs/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Project.toml b/docs/Project.toml index 802c1eca3..621095836 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,6 +2,7 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" +StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] Documenter = "0.27" From b39387dfbc11b8957a4edd53a44dc01995fb9bf7 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 26 Nov 2022 17:06:29 +0100 Subject: [PATCH 3/3] Update docs/src/basics/FAQ.md --- docs/src/basics/FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/basics/FAQ.md b/docs/src/basics/FAQ.md index 3a0185aba..fb106259b 100644 --- a/docs/src/basics/FAQ.md +++ b/docs/src/basics/FAQ.md @@ -22,7 +22,7 @@ end function f2(out, levels, u0) for i in 1:N - out[i] = solve(NonlinearProblem{false}(IntervalNonlinearFunction{false}(myfun), + out[i] = solve(NonlinearProblem{false}(NonlinearFunction{false}(myfun), u0, levels[i]), SimpleNewtonRaphson()).u end end