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 optimal coefficients of a polynomial approximation to a function .
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
Callable
|
|
required |
polynomial_order |
int
|
Order of the polynomial approximation. |
required |
lower_limit |
float
|
|
required |
upper_limit |
float
|
|
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 using dyadic intervals in .
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
Callable
|
. |
required |
n_intervals |
int
|
The number of intervals. |
required |
polynomial_order |
int
|
The polynomial order. |
required |
Returns:
Type | Description |
---|---|
Array
|
The polynomial coefficient tables. |