gemseo / core / mdofunctions

Hide inherited members

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, input_names=None)[source]

Compute a first-order Taylor polynomial of a function.

\(\newcommand{\xref}{\hat{x}}\newcommand{\dim}{d}\) The first-order Taylor polynomial of a (possibly vector-valued) function \(f\) at a point \(\xref\) is defined as

\[\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 (NumberArray) – 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.

  • input_names (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

gemseo.core.mdofunctions.taylor_polynomials.compute_quadratic_approximation(function, x_vect, hessian_approx, input_names=None)[source]

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

The function must be scalar-valued.

\(\newcommand{\xref}{\hat{x}}\newcommand{\dim}{d}\newcommand{ \hessapprox}{\hat{H}}\) For a given approximation \(\hessapprox\) of the Hessian matrix of a function \(f\) at a point \(\xref\), the quadratic approximation of \(f\) is defined as

\[\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 (NumberArray) – The input vector at which to build the quadratic approximation.

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

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

Returns:

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

Return type:

MDOQuadraticFunction