System Constructors

struct NonlinearSystem <: AbstractTimeIndependentSystem

A nonlinear system of equations.


  • eqs

    Vector of equations defining the system.

  • states

    Unknown variables.

  • ps


  • var_to_name

    Array variables.

  • observed

  • jac

    Jacobian matrix. Note: this field will not be defined until calculate_jacobian is called on the system.

  • name

    Name: the name of the system. These are required to have unique names.

  • systems

    systems: The internal systems

  • defaults

    defaults: The default values to use when initial conditions and/or parameters are not supplied in ODEProblem.

  • connector_type

    type: type of the system

  • connections

    connections: connections in a system

  • tearing_state

    tearing_state: cache for intermediate tearing state

  • substitutions

    substitutions: substitutions generated by tearing.


@variables x y z
@parameters σ ρ β

eqs = [0 ~ σ*(y-x),
       0 ~ x*(ρ-z)-y,
       0 ~ x*y - β*z]
@named ns = NonlinearSystem(eqs, [x,y,z],[σ,ρ,β])

Composition and Accessor Functions

  • get_eqs(sys) or equations(sys): The equations that define the nonlinear system.
  • get_states(sys) or states(sys): The set of states in the nonlinear system.
  • get_ps(sys) or parameters(sys): The parameters of the nonlinear system.


Missing docstring.

Missing docstring for structural_simplify. Check Documenter's build log for details.

Missing docstring.

Missing docstring for alias_elimination. Check Documenter's build log for details.


Missing docstring.

Missing docstring for ModelingToolkit.isaffine. Check Documenter's build log for details.

Missing docstring.

Missing docstring for ModelingToolkit.islinear. Check Documenter's build log for details.

Applicable Calculation and Generation Functions


Problem Constructors


Defines a nonlinear system problem. Documentation Page:

Mathematical Specification of a Nonlinear Problem

To define a Nonlinear Problem, you simply need to give the function $f$ which defines the nonlinear system:

\[f(u,p) = 0\]

and an initial guess $u₀$ of where f(u,p)=0. f should be specified as f(u,p) (or in-place as f(du,u,p)), and u₀ should be an AbstractArray (or number) whose geometry matches the desired geometry of u. Note that we are not limited to numbers or vectors for u₀; one is allowed to provide u₀ as arbitrary matrices / higher-dimension tensors as well.

Problem Type



isinplace optionally sets whether the function is in-place or not. This is determined automatically, but not inferred.

Parameters are optional, and if not given, then a NullParameters() singleton will be used, which will throw nice errors if you try to index non-existent parameters. Any extra keyword arguments are passed on to the solvers. For example, if you set a callback in the problem, then that callback will be added in every solve call.

For specifying Jacobians and mass matrices, see the NonlinearFunctions page.


  • f: The function in the problem.
  • u0: The initial guess for the steady state.
  • p: The parameters for the problem. Defaults to NullParameters.
  • kwargs: The keyword arguments passed on to the solvers.

Torn Problem Constructors

Missing docstring.

Missing docstring for BlockNonlinearProblem. Check Documenter's build log for details.