Epstein Zeta Library 0.5.0
Calculates the Epstein Zeta function
Loading...
Searching...
No Matches
Functions | Variables
sem_gaussian_1d Namespace Reference

Functions

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)
 

Variables

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
 

Detailed Description

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.

Function Documentation

◆ binomial()

float sem_gaussian_1d.binomial ( int a,
int b )
Binomial coefficients

◆ finite_differences()

float sem_gaussian_1d.finite_differences ( Callable[[float], float] func,
float x_val,
int order = 1,
int grid_points = 3,
float step_size = 1e-5 )
Calculate finite differences for given function and parameters.

◆ finite_differences_coefficients()

NDArray[np.float64] sem_gaussian_1d.finite_differences_coefficients ( int num_points,
int derivative_order = 1 )
Calculate finite differences coefficients for Taylor methods.

◆ gaussian()

Union[float, NDArray[np.float64]] sem_gaussian_1d.gaussian ( Union[float, NDArray[np.float64]] y,
float sigma )
Gaussian function with input y and standard deviation sigma.

◆ gaussian_derivative()

float sem_gaussian_1d.gaussian_derivative ( float y,
float sigma,
int order )
Calculate the Gaussian derivative for given input, sigma, and order.

◆ hermite_number()

int sem_gaussian_1d.hermite_number ( int n)
Value of the n'th Hermite polynomial at 0

◆ integral()

float sem_gaussian_1d.integral ( float x_val,
float nu,
float sigma )
Analytic representation of the integral over the summands.

◆ lattice_contribution()

float sem_gaussian_1d.lattice_contribution ( float x_val,
float nu,
float sigma,
int order )
Calculate the lattice contribution for given parameters.

◆ min_abs_rel_error()

Union[float, NDArray[np.float64]] sem_gaussian_1d.min_abs_rel_error ( Union[float, NDArray[np.float64]] ref,
Union[float, NDArray[np.float64]] approx )
Calculate the minimum between the absolute and relative error of two numbers.

◆ plot_left()

None sem_gaussian_1d.plot_left ( Axes ax,
NDArray[np.float64] x_values,
dict[str, NDArray[np.float64]] plot_data_values,
float nu )
Plot the left subplot with integral, sum, and SEM (order 0) values.

◆ plot_right()

None sem_gaussian_1d.plot_right ( Axes ax,
NDArray[np.float64] x_values,
NDArray[np.float64] diff1,
Union[NDArray[np.float64], None] diff2 )
Plot the right subplot with error analysis.

◆ power_law()

Union[float, NDArray[np.float64]] sem_gaussian_1d.power_law ( Union[float, NDArray[np.float64]] k,
float nu )
Power law function with input k and exponent nu.

◆ sem()

float sem_gaussian_1d.sem ( float x_val,
float nu,
float sigma,
int order )
Calculate the SEM function for given parameters.

◆ sum_func()

float sem_gaussian_1d.sum_func ( float x_val,
float nu,
float sigma )
Calculate the sum function for given x, nu, and sigma.

Variable Documentation

◆ diff_order_0

sem_gaussian_1d.diff_order_0
Initial value:
1= np.array(
2 [
3 min_abs_rel_error(s, s0)
4 for s, s0 in zip(sum_func_values, sem_order_0_values)
5 ]
6 )

◆ parser

sem_gaussian_1d.parser
Initial value:
1= argparse.ArgumentParser(
2 description="Calculate SEM function with custom nu value."
3 )

◆ plot_data

dict sem_gaussian_1d.plot_data
Initial value:
1= {
2 "integral": integral_values,
3 "sum_func": sum_func_values,
4 "sem_order_0": sem_order_0_values,
5 }