Post · 3 min read· pp. 814–816

aerosandbox.modeling.splines.hermite

Attributes

Functions

linear_hermite_patch(x, x_a, x_b, f_a, f_b)Computes the linear Hermite polynomial patch that passes through the given endpoints f_a and f_b.
cubic_hermite_patch(x, x_a, x_b, f_a, f_b, dfdx_a, dfdx_b)Computes the cubic Hermite polynomial patch that passes through the given endpoints and endpoint derivatives.
cosine_hermite_patch(x, x_a, x_b, f_a, f_b, dfdx_a, dfdx_b)Computes a Hermite patch (i.e., values + derivatives at endpoints) that uses a cosine function to blend between

Module Contents

aerosandbox.modeling.splines.hermite.linear_hermite_patch(x, x_a, x_b, f_a, f_b) : Computes the linear Hermite polynomial patch that passes through the given endpoints f_a and f_b.

code
Parameters:
:   - **x** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) – Scalar or array of values at which to evaluate the patch.
    - **x\_a** (*float*) – The x-coordinate of the first endpoint.
    - **x\_b** (*float*) – The x-coordinate of the second endpoint.
    - **f\_a** (*float*) – The function value at the first endpoint.
    - **f\_b** (*float*) – The function value at the second endpoint.

Returns:
:   The value of the patch evaluated at the input x. Returns a scalar if x is a scalar, or an array if x is an array.

Return type:
:   Union[float, aerosandbox.numpy.ndarray]

aerosandbox.modeling.splines.hermite.cubic_hermite_patch(x, x_a, x_b, f_a, f_b, dfdx_a, dfdx_b, extrapolation='continue') : Computes the cubic Hermite polynomial patch that passes through the given endpoints and endpoint derivatives.

code
Parameters:
:   - **x** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) – Scalar or array of values at which to evaluate the patch.
    - **x\_a** (*float*) – The x-coordinate of the first endpoint.
    - **x\_b** (*float*) – The x-coordinate of the second endpoint.
    - **f\_a** (*float*) – The function value at the first endpoint.
    - **f\_b** (*float*) – The function value at the second endpoint.
    - **dfdx\_a** (*float*) – The derivative of the function with respect to x at the first endpoint.
    - **dfdx\_b** (*float*) – The derivative of the function with respect to x at the second endpoint.
    - **extrapolation** (*str*) – A string indicating how to handle extrapolation outside of the domain [x\_a, x\_b]. Valid values are
      “continue”, which continues the patch beyond the endpoints, and “clip”, which clips the patch at the
      endpoints. Default is “continue”.

Returns:
:   The value of the patch evaluated at the input x. Returns a scalar if x is a scalar, or an array if x is an array.

Return type:
:   Union[float, aerosandbox.numpy.ndarray]

aerosandbox.modeling.splines.hermite.cosine_hermite_patch(x, x_a, x_b, f_a, f_b, dfdx_a, dfdx_b, extrapolation='continue') : Computes a Hermite patch (i.e., values + derivatives at endpoints) that uses a cosine function to blend between linear segments.

code
The end result is conceptually similar to a cubic Hermite patch, but computation is faster and the patch is
CinftyC^infty-continuous.

Parameters:
:   - **x** (*Union**[**float**,* *aerosandbox.numpy.ndarray**]*) – Scalar or array of values at which to evaluate the patch.
    - **x\_a** (*float*) – The x-coordinate of the first endpoint.
    - **x\_b** (*float*) – The x-coordinate of the second endpoint.
    - **f\_a** (*float*) – The function value at the first endpoint.
    - **f\_b** (*float*) – The function value at the second endpoint.
    - **dfdx\_a** (*float*) – The derivative of the function with respect to x at the first endpoint.
    - **dfdx\_b** (*float*) – The derivative of the function with respect to x at the second endpoint.
    - **extrapolation** (*str*) – A string indicating how to handle extrapolation outside of the domain [x\_a, x\_b]. Valid values are
      “continue”, which continues the patch beyond the endpoints, and “linear”, which extends the patch
      linearly at the endpoints. Default is “continue”.

Returns:
:   The value of the patch evaluated at the input x. Returns a scalar if x is a scalar, or an array if x is an array.

Return type:
:   Union[float, aerosandbox.numpy.ndarray]

aerosandbox.modeling.splines.hermite.x