An open source method of characteristics neutron transport code.
exponentials.h File Reference

Math approximations for computing exponentials. More...

Go to the source code of this file.

Functions

void expF1_poly (FP_PRECISION x, FP_PRECISION *expF1)
 Computes the F1 exponential term. More...
 
void expF2_poly (FP_PRECISION x, FP_PRECISION *expF2)
 Computes the F2 exponential term. More...
 
void expH_poly (FP_PRECISION x, FP_PRECISION *expH)
 Computes the H exponential term. More...
 
void expG_fractional (FP_PRECISION x, FP_PRECISION *expG)
 Computes an exponential G term, used to reconstruct F1, F2 and H. More...
 
void expF1_fractional (FP_PRECISION x, FP_PRECISION *expF1)
 Computes the F1 exponential term. More...
 
void expF2_fractional (FP_PRECISION x, FP_PRECISION *expF2)
 Computes the F2 exponential term. More...
 
void expH_fractional (FP_PRECISION x, FP_PRECISION *expH)
 Computes the H exponential term. More...
 
void expG2_fractional (FP_PRECISION x, FP_PRECISION *expG2)
 Computes the G2 exponential term. More...
 
void cram7 (FP_PRECISION x, FP_PRECISION *expv)
 Evaluates the function 1 - exp(x) for x negative. Vectorises well. Accurate to 6.18 digits (single precision) for entire domain (including near zero, unlike intrinsic) More...
 

Detailed Description

Math approximations for computing exponentials.

Date
January 16, 2019
Author
Guillaume Giudicelli, MIT, Course 22 (g_giu.nosp@m.d@mi.nosp@m.t.edu)

Function Documentation

◆ cram7()

void cram7 ( FP_PRECISION  x,
FP_PRECISION *  expv 
)
inline

Evaluates the function 1 - exp(x) for x negative. Vectorises well. Accurate to 6.18 digits (single precision) for entire domain (including near zero, unlike intrinsic)

Valid for x ~= [-1.5e6, 0]

Parameters
xvalue at which to evaluate 1 - exp(x)
expvvalue of function

◆ expF1_fractional()

void expF1_fractional ( FP_PRECISION  x,
FP_PRECISION *  expF1 
)
inline

Computes the F1 exponential term.

This method computes (1-exp(-x))/x using a 5/6th order rational approximation. It is accurate to 2e-6 over [0, 1e5]. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expF1a pointer to the exponential

◆ expF1_poly()

void expF1_poly ( FP_PRECISION  x,
FP_PRECISION *  expF1 
)
inline

Computes the F1 exponential term.

This method computes (1-exp(-x))/x using a 7th order polynomial approximation. It is accurate to 1e-5 over [0, 5]. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expF1a pointer to the exponential

◆ expF2_fractional()

void expF2_fractional ( FP_PRECISION  x,
FP_PRECISION *  expF2 
)
inline

Computes the F2 exponential term.

This method computes (x-2+exp(-x)*(2+x))/x**2 using a 5/6th order rational approximation. It is accurate to 2e-6 over [0, 1e5]. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expF2a pointer to the exponential

◆ expF2_poly()

void expF2_poly ( FP_PRECISION  x,
FP_PRECISION *  expF2 
)
inline

Computes the F2 exponential term.

This method computes (x-2+exp(-x)*(2+x))/x**2 using a 8th order polynomial approximation. It is accurate to 1e-5 over [0, 5]. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expF2a pointer to the exponential

◆ expG2_fractional()

void expG2_fractional ( FP_PRECISION  x,
FP_PRECISION *  expG2 
)
inline

Computes the G2 exponential term.

This method computes 2/3 - (1 + 2/x) * (1/x + 0.5 - (1 + 1/x) * (1-exp(-x)) / x) using a 5/5th order rational approximation. It is accurate to 1e-6 over [0, 1e6]. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expG2a pointer to the exponential

◆ expG_fractional()

void expG_fractional ( FP_PRECISION  x,
FP_PRECISION *  expG 
)
inline

Computes an exponential G term, used to reconstruct F1, F2 and H.

This method computes 1/x-(1-exp(-x))/x**2 using a 5/6th order rational approximation. It is accurate to 2e-7 over [0, 1e5]. However, accuracy when reconstructing F1, F2 and H is lower. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expGa pointer to the exponential

◆ expH_fractional()

void expH_fractional ( FP_PRECISION  x,
FP_PRECISION *  expH 
)
inline

Computes the H exponential term.

This method computes (1-exp(-x)*(1+x))/x**2 using a 5/7th order rational approximation. It is accurate to 2e-6 over [0, 1e5]. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expHa pointer to the exponential

◆ expH_poly()

void expH_poly ( FP_PRECISION  x,
FP_PRECISION *  expH 
)
inline

Computes the H exponential term.

This method computes (1-exp(-x)*(1+x))/x**2 using a 8th order polynomial approximation. It is accurate to 1e-5 over [0, 5]. It was generated by Colin Josey using Remez's algorithm.

Parameters
xthe value at which to evaluate the function, usually tau
expHa pointer to the exponential