11# Modeling Nonlinear Systems
22
3- In this example, we will go one step deeper and showcase the direct function
4- generation capabilities in ModelingToolkit.jl to build nonlinear systems.
5- Let's say we wanted to solve for the steady state of an ODE. This steady state
6- is reached when the nonlinear system of differential equations equals zero.
7- We use (unknown) variables for our nonlinear system.
3+ ModelingToolkit.jl is not only useful for generating initial value problems (` ODEProblem ` ).
4+ The package can also build nonlinear systems.
5+ This is, for example, useful for finding the steady state of an ODE.
6+ This steady state is reached when the nonlinear system of differential equations equals zero.
7+
8+ !!! note
9+
10+ The high level ` @mtkmodel ` macro used in the
11+ [ getting started tutorial] (@ref getting_started)
12+ is not yet compatible with ` NonlinearSystem ` .
13+ We thus have to use a lower level interface to define nonlinear systems.
14+ For an introduction to this interface, read the
15+ [ programmatically generating ODESystems tutorial] (@ref programmatically).
816
917``` @example nonlinear
1018using ModelingToolkit, NonlinearSolve
@@ -15,8 +23,6 @@ using ModelingToolkit, NonlinearSolve
1523eqs = [0 ~ σ * (y - x)
1624 0 ~ x * (ρ - z) - y
1725 0 ~ x * y - β * z]
18- guesses = [x => 1.0, y => 0.0, z => 0.0]
19- ps = [σ => 10.0, ρ => 26.0, β => 8 / 3]
2026@mtkbuild ns = NonlinearSystem(eqs)
2127
2228guesses = [x => 1.0, y => 0.0, z => 0.0]
@@ -26,7 +32,9 @@ prob = NonlinearProblem(ns, guesses, ps)
2632sol = solve(prob, NewtonRaphson())
2733```
2834
29- We can similarly ask to generate the ` NonlinearProblem ` with the analytical
35+ We found the ` x ` , ` y ` and ` z ` for which the right hand sides of ` eqs ` are all equal to zero.
36+
37+ Just like with ` ODEProblem ` s we can generate the ` NonlinearProblem ` with its analytical
3038Jacobian function:
3139
3240``` @example nonlinear
0 commit comments