aerosandbox.modeling.splines.hermite
#
Module Contents#
Functions#
|
Computes the linear Hermite polynomial patch that passes through the given endpoints f_a and f_b. |
|
Computes the cubic Hermite polynomial patch that passes through the given endpoints and endpoint derivatives. |
|
Computes a Hermite patch (i.e., values + derivatives at endpoints) that uses a cosine function to blend between |
Attributes#
- aerosandbox.modeling.splines.hermite.linear_hermite_patch(x, x_a, x_b, f_a, f_b)[source]#
Computes the linear Hermite polynomial patch that passes through the given endpoints f_a and f_b.
- 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')[source]#
Computes the cubic Hermite polynomial patch that passes through the given endpoints and endpoint derivatives.
- 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')[source]#
Computes a Hermite patch (i.e., values + derivatives at endpoints) that uses a cosine function to blend between linear segments.
The end result is conceptually similar to a cubic Hermite patch, but computation is faster and the patch is C^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]