gemseo / core / mdofunctions

taylor_polynomials module¶

Functions computing first- and second-order Taylor polynomials from a function.

gemseo.core.mdofunctions.taylor_polynomials.compute_linear_approximation(function, x_vect, name=None, f_type=None, args=None)[source]

Compute a first-order Taylor polynomial of a function.


$\newcommand{\partialder}{\frac{\partial f}{\partial x_i}(\xref)} f(x) \approx f(\xref) + \sum_{i = 1}^{\dim} \partialder \, (x_i - \xref_i).$
Parameters:
• function (MDOFunction) – The function to be linearized.

• x_vect (ArrayType) – The input vector at which to build the Taylor polynomial.

• name (str | None) – The name of the linear approximation function. If None, create a name from the name of the function.

• f_type (str | None) – The type of the linear approximation function. If None, the function will have no type.

• args (Sequence[str] | None) – The names of the inputs of the linear approximation function, or a name base. If None, use the names of the inputs of the function.

Returns:

The first-order Taylor polynomial of the function at the input vector.

Raises:

AttributeError – If the function does not have a Jacobian function.

Return type:

MDOLinearFunction

Build a quadratic approximation of a function at a given point.

The function must be scalar-valued.


$\newcommand{\partialder}{\frac{\partial f}{\partial x_i}(\xref)} f(x) \approx f(\xref) + \sum_{i = 1}^{\dim} \partialder \, (x_i - \xref_i) + \frac{1}{2} \sum_{i = 1}^{\dim} \sum_{j = 1}^{\dim} \hessapprox_{ij} (x_i - \xref_i) (x_j - \xref_j).$
Parameters:
• function (MDOFunction) – The function to be approximated.

• x_vect (ArrayType) – The input vector at which to build the quadratic approximation.

• hessian_approx (ArrayType) – The approximation of the Hessian matrix at this input vector.

• args (Sequence[str] | None) – The names of the inputs of the quadratic approximation function, or a name base. If None, use the ones of the current function.

Returns:

The second-order Taylor polynomial of the function at the given point.

Return type: