Theoretica
A C++ numerical and automatic mathematical library
constants.h File Reference

Mathematical constants and default algorithm parameters. More...

#include <limits>
#include <cstdint>

Go to the source code of this file.

Namespaces

 theoretica
 Main namespace of the library which contains all functions and objects.
 
 th
 Alias for the theoretica namespace.
 

Macros

#define THEORETICA_ALGEBRA_ELEMENT_TOL   (10*MACH_EPSILON)
 THEORETICA_DISABLE_X86 Define this macro to disable Assembly x86 optimizations. More...
 
#define THEORETICA_ALGEBRA_EIGEN_TOL   1E-08
 Tolerance for eigensolvers.
 
#define THEORETICA_ALGEBRA_EIGEN_ITER   100
 Maximum number of iterations for eigensolvers.
 
#define THEORETICA_CORE_TAYLOR_ORDER   12
 Order of Taylor series approximations.
 
#define THEORETICA_CALCULUS_INTEGRAL_STEPS   100
 Default number of steps for integral approximation.
 
#define THEORETICA_CALCULUS_INTEGRAL_TOL   1E-08
 
#define THEORETICA_OPTIMIZATION_TOL   1E-08
 Approximation tolerance for root finding.
 
#define THEORETICA_OPTIMIZATION_BISECTION_ITER   100
 Maximum number of iterations for bisection.
 
#define THEORETICA_OPTIMIZATION_GOLDENSECTION_ITER   100
 Maximum number of iterations for golden section search.
 
#define THEORETICA_OPTIMIZATION_HALLEY_ITER   100
 Maximum number of iterations for Halley's method.
 
#define THEORETICA_OPTIMIZATION_NEWTON_ITER   100
 Maximum number of iterations for Newton-Raphson root finding.
 
#define THEORETICA_OPTIMIZATION_STEFFENSEN_ITER   100
 Maximum number of iterations for Steffensen root finding.
 
#define THEORETICA_OPTIMIZATION_CHEBYSHEV_ITER   100
 Maximum number of iterations for Chebyshev root finding.
 
#define THEORETICA_STATISTICS_TRYANDCATCH_ITER   100
 Maximum number of failed iterations for the Try-and-Catch algorithm.
 
#define THEORETICA_CALCULUS_DERIV_STEP   1E-3
 Default variation for derivative approximation.
 
#define THEORETICA_OPTIMIZATION_MINGRAD_GAMMA   -0.005
 Default step size for gradient descent minimization.
 
#define THEORETICA_OPTIMIZATION_MINGRAD_TOLERANCE   1E-3
 Default tolerance for gradient descent minimization.
 
#define THEORETICA_OPTIMIZATION_MINGRAD_ITER   50000
 Maximum number of iterations for gradient descent minimization.
 
#define THEORETICA_STATISTICS_RAND_PREC   (uint64_t(1) << 31)
 Default precision for random number generation using rand_uniform()
 
#define THEORETICA_STATISTICS_METROPOLIS_DEPTH   16
 Default depth of the Metropolis algorithm.
 
#define TH_CONSTEXPR
 Enable constexpr in function declarations if C++14 is supported.
 
#define TH_CONSTIF
 Enable constexpr in if statements if C++17 is supported.
 

Typedefs

using theoretica::real = double
 A real number, defined as a floating point type. More...
 

Variables

constexpr real theoretica::MACH_EPSILON = std::numeric_limits<real>::epsilon()
 Machine epsilon for the real type.
 
constexpr real theoretica::PHI = 1.6180339887498948482045868
 The Phi (Golden Section) mathematical constant.
 
constexpr real theoretica::INVPHI = 0.6180339887498948482045868
 The inverse of the Golden Section mathematical constant.
 
constexpr real theoretica::PI = 3.141592653589793238462643
 The Pi mathematical constant.
 
constexpr real theoretica::PI2 = 1.57079632679489655799898
 Half of Pi.
 
constexpr real theoretica::PI4 = PI / 4.0
 A quarter of Pi.
 
constexpr real theoretica::PIDOUBLE = PI * 2
 Pi multiplied by 2.
 
constexpr real theoretica::TAU = PI * 2
 The Tau mathematical constant (Pi times 2)
 
constexpr real theoretica::INVPI = 1.0 / PI
 The inverse of Pi.
 
constexpr real theoretica::SQRTPI = 1.7724538509055159927
 The square root of Pi.
 
constexpr real theoretica::E = 2.718281828459045235360287
 The Euler mathematical constant (e)
 
constexpr real theoretica::LOG2E = 1.44269504088896338700465094
 The binary logarithm of e.
 
constexpr real theoretica::LOG210 = 3.32192809488736218170856773213
 The binary logarithm of 10.
 
constexpr real theoretica::LOG10E = 0.434294481903
 The base-10 logarithm of e.
 
constexpr real theoretica::LN2 = 0.69314718056
 The natural logarithm of 2.
 
constexpr real theoretica::LN10 = 2.30258509299
 The natural logarithm of 10.
 
constexpr real theoretica::DEG2RAD = 0.017453292519943295474371680598
 The scalar conversion factor from degrees to radians.
 
constexpr real theoretica::RAD2DEG = 57.2957795130823228646477218717
 The scalar conversion factor from radians to degrees.
 
constexpr real theoretica::SQRT2 = 1.4142135623730950488
 The square root of 2.
 
constexpr real theoretica::INVSQR2 = 0.7071067811865475
 The inverse of the square root of 2.
 
constexpr real theoretica::SQRT3 = 1.732050807568877
 The square root of 3.
 
constexpr real theoretica::ALGEBRA_ELEMENT_TOL = THEORETICA_ALGEBRA_ELEMENT_TOL
 Tolerance for the elements of matrices.
 
constexpr real theoretica::ALGEBRA_EIGEN_TOL = THEORETICA_ALGEBRA_EIGEN_TOL
 Tolerance for eigensolvers.
 
constexpr real theoretica::ALGEBRA_EIGEN_ITER = THEORETICA_ALGEBRA_EIGEN_ITER
 Maximum number of iterations for eigensolvers.
 
constexpr int theoretica::CORE_TAYLOR_ORDER = THEORETICA_CORE_TAYLOR_ORDER
 Order of Taylor series approximations.
 
constexpr int theoretica::CALCULUS_INTEGRAL_STEPS = THEORETICA_CALCULUS_INTEGRAL_STEPS
 Default number of steps for integral approximation.
 
constexpr real theoretica::CALCULUS_INTEGRAL_TOL = THEORETICA_CALCULUS_INTEGRAL_TOL
 
constexpr real theoretica::OPTIMIZATION_TOL = THEORETICA_OPTIMIZATION_TOL
 Approximation tolerance for root finding.
 
constexpr unsigned int theoretica::OPTIMIZATION_BISECTION_ITER = THEORETICA_OPTIMIZATION_BISECTION_ITER
 Maximum number of iterations for the bisection algorithm.
 
constexpr unsigned int theoretica::OPTIMIZATION_GOLDENSECTION_ITER = THEORETICA_OPTIMIZATION_GOLDENSECTION_ITER
 Maximum number of iterations for the golden section search algorithm.
 
constexpr unsigned int theoretica::OPTIMIZATION_HALLEY_ITER = THEORETICA_OPTIMIZATION_HALLEY_ITER
 Maximum number of iterations for Halley's method.
 
constexpr unsigned int theoretica::OPTIMIZATION_NEWTON_ITER = THEORETICA_OPTIMIZATION_NEWTON_ITER
 Maximum number of iterations for the Newton-Raphson algorithm.
 
constexpr unsigned int theoretica::OPTIMIZATION_STEFFENSEN_ITER = THEORETICA_OPTIMIZATION_STEFFENSEN_ITER
 Maximum number of iterations for the Steffensen algorithm.
 
constexpr unsigned int theoretica::OPTIMIZATION_CHEBYSHEV_ITER = THEORETICA_OPTIMIZATION_CHEBYSHEV_ITER
 Maximum number of iterations for the Chebyshev algorithm.
 
constexpr unsigned int theoretica::STATISTICS_TRYANDCATCH_ITER = THEORETICA_STATISTICS_TRYANDCATCH_ITER
 Maximum number of failed iterations for the Try-and-Catch algorithm.
 
constexpr real theoretica::CALCULUS_DERIV_STEP = THEORETICA_CALCULUS_DERIV_STEP
 Default variation for derivative approximation.
 
constexpr real theoretica::OPTIMIZATION_MINGRAD_GAMMA = THEORETICA_OPTIMIZATION_MINGRAD_GAMMA
 Default step size for gradient descent minimization.
 
constexpr real theoretica::OPTIMIZATION_MINGRAD_TOLERANCE = THEORETICA_OPTIMIZATION_MINGRAD_TOLERANCE
 Default tolerance for gradient descent minimization.
 
constexpr unsigned int theoretica::OPTIMIZATION_MINGRAD_ITER = THEORETICA_OPTIMIZATION_MINGRAD_ITER
 Maximum number of iterations for gradient descent minimization.
 
constexpr uint64_t theoretica::STATISTICS_RAND_PREC = THEORETICA_STATISTICS_RAND_PREC
 Default precision for random number generation using rand_uniform()
 
constexpr unsigned int theoretica::STATISTICS_METROPOLIS_DEPTH = THEORETICA_STATISTICS_METROPOLIS_DEPTH
 Default depth of the Metropolis algorithm.
 

Detailed Description

Mathematical constants and default algorithm parameters.

You may change the library's default behavior by redefining the macros starting with THEORETICA_

Macro Definition Documentation

◆ THEORETICA_ALGEBRA_ELEMENT_TOL

#define THEORETICA_ALGEBRA_ELEMENT_TOL   (10*MACH_EPSILON)

THEORETICA_DISABLE_X86 Define this macro to disable Assembly x86 optimizations.

Tolerance for checking the elements of a matrix (such as algebra::is_square)