inverse

# Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Every function with one output argument may have one or more "`inverse`" annotations to define inverses of this function.

#### Syntax

```function f1
input A1 u1;
...
input T1 uk;
...
input Am um = am;
...
input An un;
output T2 y;
annotation(inverse(uk = f2(..., y, ....), ui = f3(..., y, ...), ...));
algorithm
...
end f1;```

#### Description

The meaning is that function "`f2`" is one inverse to function "`f1`" where the previous output "`y`" is now an input and the previous input "`uk`" is now an output. More than one inverse can be defined within the same inverse annotation. Several inverses are separated by commas. (The inverse requires that for all valid values of the input arguments of `f2(...,y, ...)` and `uk` being calculated as `uk := f2(..., y, ...)` implies the equality `y = f1(..., uk, ...,) `up to a certain precision.)

Function "`f1`" can have any number and types of arguments with and without default value. The restriction is that the number of unknown variables in the output argument of both "`f1`" and "`f2`" must be the same and that "`f2`" must have exactly the same arguments as "`f1`" (with the same defaults, if an argument um has a default), but the order of the arguments may be permuted.

#### Examples

```function h_pTX
input Real p    "pressure";
input Real T    "temperature";
input Real X[:] "mass fractions";
output Real h   "specific enthalpy";
annotation(inverse(T = T_phX(p,h,X)));
algorithm
...
end h_pTX;

function T_phX
input Real  p    "pressure";
input Real  h    "specific enthalpy";
input Real  X[:] "mass fractions";
output Real T    "temperature";
algorithm
...
end T_phX;```