approximating polynomials
Some useful code to approximate inverse cumulative distribution functions to produce approximate random variables by the inverse transform method.
dyadic_intervals_in_half_interval(n_intervals)
Computed the dyadic intervals in [0, 1/2].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_intervals
|
int
|
The number of intervals. |
required |
Returns:
Type | Description |
---|---|
intervals
|
The dyadic intervals. e.g. |
Source code in src/pyarv/_approximation_utils/approximating_polynomials.py
optimal_polynomial_coefficients(*, f, polynomial_order, lower_limit, upper_limit)
Calculates the \( L^2 \) optimal coefficients of a polynomial approximation to a function \( f \colon (a, b) \to \mathbb{R} \).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f
|
Callable
|
\( f \) |
required |
polynomial_order
|
int
|
Order of the polynomial approximation. |
required |
lower_limit
|
float
|
\( a \) |
required |
upper_limit
|
float
|
\( b \) |
required |
Returns:
Type | Description |
---|---|
coefficients
|
Polynomial coefficients. |
Source code in src/pyarv/_approximation_utils/approximating_polynomials.py
piecewise_polynomial_coefficients_in_half_interval(f, n_intervals, polynomial_order)
Computes the coefficients of a piecewise polynomial approximation to a function \( f \) using dyadic intervals in \( [0, 1/2] \).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f
|
Callable
|
\( f \). |
required |
n_intervals
|
int
|
The number of intervals. |
required |
polynomial_order
|
int
|
The polynomial order. |
required |
Returns:
Type | Description |
---|---|
Array
|
The polynomial coefficient tables. |