Skip to content

Commit adcbec5

Browse files
Add documentation
1 parent 6347b23 commit adcbec5

File tree

15 files changed

+389
-34
lines changed

15 files changed

+389
-34
lines changed

.github/workflows/Documentation.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags: '*'
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: julia-actions/setup-julia@latest
16+
with:
17+
version: '1'
18+
- name: Install dependencies
19+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
20+
- name: Build and deploy
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
23+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
24+
run: julia --project=docs/ docs/make.jl

README.md

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
# NonlinearSolve.jl
22

3+
[![Github Action CI](https://github.com/SciML/NonlinearSolve.jl/workflows/CI/badge.svg)](https://github.com/SciML/NonlinearSolve.jl/actions)
4+
[![Coverage Status](https://coveralls.io/repos/github/SciML/NonlinearSolve.jl/badge.svg?branch=master)](https://coveralls.io/github/SciML/NonlinearSolve.jl?branch=master)
5+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](http://nlsolve.sciml.ai/stable/)
6+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](http://nlsolve.sciml.ai/dev/)
7+
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
8+
39
Fast implementations of root finding algorithms in Julia that satisfy the SciML common interface.
410

11+
For information on using the package,
12+
[see the stable documentation](https://mtk.sciml.ai/stable/). Use the
13+
[in-development documentation](https://mtk.sciml.ai/dev/) for the version of
14+
the documentation which contains the unreleased features.
15+
16+
## High Level Examples
17+
518
```julia
619
using NonlinearSolve, StaticArrays
720

@@ -17,37 +30,3 @@ u0 = (1.0, 2.0) # brackets
1730
probB = NonlinearProblem(f, u0)
1831
sol = solve(probB, Falsi())
1932
```
20-
21-
## Current Algorithms
22-
23-
### Non-Bracketing
24-
25-
- `NewtonRaphson()`
26-
27-
### Bracketing
28-
29-
- `Falsi()`
30-
- `Bisection()`
31-
32-
## Features
33-
34-
Performance is key: the current methods are made to be highly performant on scalar and statically sized small
35-
problems. If you run into any performance issues, please file an issue.
36-
37-
There is an iterator form of the nonlinear solver which mirrors the DiffEq integrator interface:
38-
39-
```julia
40-
f(u, p) = u .* u .- 2.0
41-
u0 = (1.0, 2.0) # brackets
42-
probB = NonlinearProblem(f, u0)
43-
solver = init(probB, Falsi()) # Can iterate the solver object
44-
solver = solve!(solver)
45-
```
46-
47-
Note that the `solver` object is actually immutable since we want to make it live on the stack for the sake of performance.
48-
49-
## Roadmap
50-
51-
The current algorithms should support automatic differentiation, though improved adjoint overloads are planned
52-
to be added in the current update (which will make use of the `f(u,p)` form). Future updates will include
53-
standard methods for larger scale nonlinear solving like Newton-Krylov methods.

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
site/

docs/Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[deps]
2+
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
3+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4+
5+
[compat]
6+
Documenter = "0.27"

docs/make.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Documenter, NonlinearSolve
2+
3+
makedocs(
4+
sitename="NonlinearSolve.jl",
5+
authors="Chris Rackauckas",
6+
modules=[NonlinearSolve],
7+
clean=true,doctest=false,
8+
format = Documenter.HTML(#analytics = "UA-90474609-3",
9+
assets = ["assets/favicon.ico"],
10+
canonical="https://nlsolve.sciml.ai/stable/"),
11+
pages=[
12+
"Home" => "index.md",
13+
"Tutorials" => Any[
14+
"tutorials/nonlinear.md"
15+
],
16+
"Basics" => Any[
17+
"basics/NonlinearProblem.md",
18+
"basics/NonlinearSolvers.md",
19+
"basics/NonlinearFunctions.md",
20+
"basics/FAQ.md"
21+
]
22+
"Solvers" => Any[
23+
"solvers/NonlinearSystemSolvers.md",
24+
"solvers/BracketingSolvers.md"
25+
]
26+
]
27+
)
28+
29+
deploydocs(
30+
repo = "github.com/SciML/NonlinearSolve.jl.git";
31+
push_preview = true
32+
)

docs/src/assets/favicon.ico

1.36 KB
Binary file not shown.

docs/src/assets/logo.png

26 KB
Loading

docs/src/basics/FAQ.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Frequently Asked Questions
2+
3+
Ask more questions.

docs/src/basics/NonlinearFunctions.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# [NonlinearFunctions and Jacobian Types](@id nonlinearfunctions)
2+
3+
The SciML ecosystem provides an extensive interface for declaring extra functions
4+
associated with the differential equation's data. In traditional libraries there
5+
is usually only one option: the Jacobian. However, we allow for a large array
6+
of pre-computed functions to speed up the calculations. This is offered via the
7+
`NonlinearFunction` types which can be passed to the problems.
8+
9+
## Function Type Definitions
10+
11+
### Function Choice Definitions
12+
13+
The full interface available to the solvers is as follows:
14+
15+
- `jac`: The Jacobian of the differential equation with respect to the state
16+
variable `u` at a time `t` with parameters `p`.
17+
- `tgrad`: The gradient of the differential equation with respect to `t` at state
18+
`u` with parameters `p`.
19+
- `paramjac`: The Jacobian of the differential equation with respect to `p` at
20+
state `u` at time `t`.
21+
- `analytic`: Defines an analytical solution using `u0` at time `t` with `p`
22+
which will cause the solvers to return errors. Used for testing.
23+
- `syms`: Allows you to name your variables for automatic names in plots and
24+
other output.
25+
26+
### NonlinearFunction
27+
28+
```julia
29+
function NonlinearFunction{iip,true}(f;
30+
analytic=nothing, # (u0,p)
31+
jac=nothing, # (J,u,p) or (u,p)
32+
jvp=nothing,
33+
vjp=nothing,
34+
jac_prototype=nothing, # Type for the Jacobian
35+
sparsity=jac_prototype,
36+
paramjac = nothing,
37+
syms = nothing,
38+
observed = DEFAULT_OBSERVED_NO_TIME,
39+
colorvec = nothing)
40+
```

docs/src/basics/NonlinearProblem.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Nonlinear Problems
2+
3+
## Mathematical Specification of a Nonlinear Problem
4+
5+
To define a Nonlinear Problem, you simply need to give the function ``f``
6+
which defines the nonlinear system:
7+
8+
```math
9+
f(u,p) = 0
10+
```
11+
12+
and an initial guess ``u₀`` of where `f(u,p)=0`. `f` should be specified as `f(u,p)`
13+
(or in-place as `f(du,u,p)`), and `u₀` should be an AbstractArray (or number)
14+
whose geometry matches the desired geometry of `u`. Note that we are not limited
15+
to numbers or vectors for `u₀`; one is allowed to provide `u₀` as arbitrary
16+
matrices / higher dimension tensors as well.
17+
18+
## Problem Type
19+
20+
### Constructors
21+
22+
```julia
23+
NonlinearProblem(f::NonlinearFunction,u0,p=NullParameters();kwargs...)
24+
NonlinearProblem{isinplace}(f,u0,p=NullParameters();kwargs...)
25+
```
26+
27+
`isinplace` optionally sets whether the function is inplace or not. This is
28+
determined automatically, but not inferred.
29+
30+
Parameters are optional, and if not given then a `NullParameters()` singleton
31+
will be used which will throw nice errors if you try to index non-existent
32+
parameters. Any extra keyword arguments are passed on to the solvers. For example,
33+
if you set a `callback` in the problem, then that `callback` will be added in
34+
every solve call.
35+
36+
For specifying Jacobians and mass matrices, see the [NonlinearFunctions](@ref nonlinearfunctions)
37+
page.
38+
39+
### Fields
40+
41+
* `f`: The function in the ODE.
42+
* `u0`: The initial guess for the steady state.
43+
* `p`: The parameters for the problem. Defaults to `NullParameters`
44+
* `kwargs`: The keyword arguments passed onto the solves.

0 commit comments

Comments
 (0)