|
| Union[float, NDArray[np.float64]] | gaussian (Union[float, NDArray[np.float64]] y, float sigma) |
| |
| Union[float, NDArray[np.float64]] | power_law (Union[float, NDArray[np.float64]] k, float nu) |
| |
| NDArray[np.float64] | finite_differences_coefficients (int num_points, int derivative_order=1) |
| |
| float | finite_differences (Callable[[float], float] func, float x_val, int order=1, int grid_points=3, float step_size=1e-5) |
| |
| float | binomial (int a, int b) |
| |
| int | hermite_number (int n) |
| |
| float | gaussian_derivative (float y, float sigma, int order) |
| |
| float | lattice_contribution (float x_val, float nu, float sigma, int order) |
| |
| float | sum_func (float x_val, float nu, float sigma) |
| |
| float | integral (float x_val, float nu, float sigma) |
| |
| float | sem (float x_val, float nu, float sigma, int order) |
| |
| Union[float, NDArray[np.float64]] | min_abs_rel_error (Union[float, NDArray[np.float64]] ref, Union[float, NDArray[np.float64]] approx) |
| |
| None | plot_left (Axes ax, NDArray[np.float64] x_values, dict[str, NDArray[np.float64]] plot_data_values, float nu) |
| |
| None | plot_right (Axes ax, NDArray[np.float64] x_values, NDArray[np.float64] diff1, Union[NDArray[np.float64], None] diff2) |
| |
|
|
int | EPS_TAYLOR = 1e-8 |
| |
|
int | EPS_IS_CLOSE = 1e-12 |
| |
| | parser |
| |
|
| type |
| |
|
| default |
| |
|
| help |
| |
|
| args = parser.parse_args() |
| |
|
| NU0 = args.nu |
| |
|
int | SIGMA0 = 100 |
| |
|
| x = np.linspace(-2 * SIGMA0, 2 * SIGMA0, 51) |
| |
|
| ax1 |
| |
|
| ax2 |
| |
|
| figsize |
| |
|
| integral_values = np.array([integral(xx, NU0, SIGMA0) for xx in x]) |
| |
|
| sum_func_values = np.array([sum_func(xx, NU0, SIGMA0) for xx in x]) |
| |
|
| sem_order_0_values = np.array([sem(xx, NU0, SIGMA0, 0) for xx in x]) |
| |
| | diff_order_0 |
| |
|
Union | diff_order_2 = None |
| |
|
| sem_order_2_values = np.array([sem(xx, NU0, SIGMA0, 2) for xx in x]) |
| |
| dict | plot_data |
| |
Singular Euler-Maclaurin (SEM) expansion for a Gaussian function in 1D.
This script demonstrates the application of the Singular Euler-Maclaurin
expansion to a Gaussian function in one dimension. It calculates and compares
the integral, sum, and SEM approximations for various orders.
Features:
- Calculates and plots integral, sum, and SEM approximations
- Compares SEM approximations of different orders
- Provides error analysis between sum and SEM approximations
Usage:
python sem_gaussian_1d.py [--nu NU]
Arguments:
--nu NU Optional. Set the value of nu for calculations. Default is 1.5.
Example: python sem_gaussian_1d.py --nu 1
The script generates plots comparing the different approximations and their
errors for the specified nu value.