Modelica.Math.Nonlinear

Library of functions operating on nonlinear equations

Information

This package contains functions to perform tasks such as numerically integrating a function, or solving a nonlinear algebraic equation system. The common feature of the functions in this package is that the nonlinear characteristics are passed as user definable functions.

For details about how to define and to use functions as input arguments to functions, see ModelicaReference.Classes.'function' or Section 12.4.2 (Functional Input Arguments to Functions) of the Modelica 3.4 specification.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Modelica.Math.Nonlinear.Examples Examples Examples demonstrating the usage of the functions in package Nonlinear
Modelica.Math.Nonlinear.Interfaces Interfaces Interfaces for functions
Modelica.Math.Nonlinear.quadratureLobatto quadratureLobatto Return the integral of an integrand function using an adaptive Lobatto rule
Modelica.Math.Nonlinear.solveOneNonlinearEquation solveOneNonlinearEquation Solve f(u) = 0 in a very reliable and efficient way (f(u_min) and f(u_max) must have different signs)

Modelica.Math.Nonlinear.quadratureLobatto Modelica.Math.Nonlinear.quadratureLobatto

Return the integral of an integrand function using an adaptive Lobatto rule

Information

Syntax

quadratureLobatto(function f(), a, b);
quadratureLobatto(function f(), a, b, tolerance=100*Modelica.Constants.eps);

Description

Compute definite integral over function f(u,...) from u=a up to u=b using the adaptive Lobatto rule according to:

Walter Gander:
Adaptive Quadrature - Revisited. 1998. ftp://ftp.inf.ethz.ch/pub/publications/tech-reports/3xx/306.ps

Example

See the examples in Modelica.Math.Nonlinear.Examples.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
fIntegrand function
aLower limit of integration interval
bUpper limit of integration interval
toleranceRelative tolerance for integral value

Outputs

NameDescription
integralIntegral value

Modelica.Math.Nonlinear.solveOneNonlinearEquation Modelica.Math.Nonlinear.solveOneNonlinearEquation

Solve f(u) = 0 in a very reliable and efficient way (f(u_min) and f(u_max) must have different signs)

Information

Syntax

solveOneNonlinearEquation(function f(), u_min, u_max);
solveOneNonlinearEquation(function f(), u_min, u_max, tolerance=100*Modelica.Constants.eps);

Description

This function determines the solution of one non-linear algebraic equation "y=f(u)" in one unknown "u" in a reliable way. It is one of the best numerical algorithms for this purpose. As input, the nonlinear function f(u) has to be given, as well as an interval u_min, u_max that contains the solution, i.e., "f(u_min)" and "f(u_max)" must have a different sign. The function computes a smaller interval in which a sign change is present using the relative tolerance "tolerance" that can be given as 4th input argument.

The interval reduction is performed using inverse quadratic interpolation (interpolating with a quadratic polynomial through the last 3 points and computing the zero). If this fails, bisection is used, which always reduces the interval by a factor of 2. The inverse quadratic interpolation method has superlinear convergence. This is roughly the same convergence rate as a globally convergent Newton method, but without the need to compute derivatives of the non-linear function. The solver function is a direct mapping of the Algol 60 procedure "zero" to Modelica, from:

Brent R.P.:
Algorithms for Minimization without derivatives. Prentice Hall, 1973, pp. 58-59.
Download: https://maths-people.anu.edu.au/~brent/pd/rpb011i.pdf
Errata and new print: https://maths-people.anu.edu.au/~brent/pub/pub011.html

Example

See the examples in Modelica.Math.Nonlinear.Examples.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
fFunction y = f(u); u is computed so that y=0
u_minLower bound of search interval
u_maxUpper bound of search interval
toleranceRelative tolerance of solution u

Outputs

NameDescription
uValue of independent variable u so that f(u) = 0
Automatically generated Thu Oct 1 16:08:15 2020.