|
FML
|
This namespace deals with special math functions and general math algorithms needed in the library. More...
Typedefs | |
| using | Spline = FML::INTERPOLATION::SPLINE::Spline |
| using | ODESolver = FML::SOLVERS::ODESOLVER::ODESolver |
| using | ODEFunction = FML::SOLVERS::ODESOLVER::ODEFunction |
| using | DVector = std::vector< double > |
Functions | |
| std::optional< double > | find_root_newton (const std::function< double(double)> &function, const std::function< double(double)> &derivative, double x0, double epsilon=1e-7) |
| Find roots \( f(x) = 0 \) using Newtons method. Requires C++17. More... | |
| double | find_root_bisection (const std::function< double(double)> &function, std::pair< double, double > xrange, double epsilon=1e-7) |
| Find roots \( f(x) = 0 \) using bisection. More... | |
| double | find_root_bisection (const Spline &y, double y_value, std::pair< double, double > xrange={0.0, 0.0}, double epsilon=1e-7) |
| Find roots \( f(x) = 0 \) using bisection with f given as a spline. Requires GSL. More... | |
| DVector | Hyperspherical_j_ell_array (int lmax, const double nu, const double chi, double K) |
| Hyperspherical bessel functions using recursion formula. More... | |
| DVector | j_ell_array (int lmax, const double x) |
| Spherical bessel functions using recursion formula. More... | |
| double | j_ell_gsl (const int ell, const double arg) |
| double | j_ell_cxx (const int ell, const double arg) |
| double | j_ell (const int ell, const double arg) |
| Spherical bessel function \( j_\ell(x) \) from CXX or GSL with fix for very small or large arguments. More... | |
| DVector | linspace (double xmin, double xmax, int num) |
| Python linspace. Generate a lineary spaced array. More... | |
| double | Airy_Ai (double z) |
| Airy function \( {\rm Ai}(x) \) (requires GSL). Found by solving and splining \( y'' - xy = 0 \). More... | |
| std::pair< double, bool > | GeneralizedLentzMethod (std::function< double(int)> &a, std::function< double(int)> &b, double epsilon, int maxsteps) |
| Evaluate continued fraction: (b0 + a1/(b1 + a2 /( ... ))). More... | |
| double | Gegenbauer (int n, double x, double alpha) |
| DVector | GegenbauerArray (int nmax, double x, double alpha) |
| double | HyperSphericalBesselWKB (int ell, double nu, double chi, double K) |
| WKB approximation for The hyper spherical bessel functions (for a curved Universe) For a flat Universe call with nu = 1.0, chi = k*(eta0-eta) and K = 0.0. More... | |
| std::vector< double > | legendre_ell_of_mu_vector (double mu, int ell_max) |
| Legendre polynomials. More... | |
Variables | |
| double | init_airy_function_at_startup = Airy_Ai(0.0) |
This namespace deals with special math functions and general math algorithms needed in the library.
| using FML::MATH::DVector = typedef std::vector<double> |
| using FML::MATH::ODEFunction = typedef FML::SOLVERS::ODESOLVER::ODEFunction |
| using FML::MATH::ODESolver = typedef FML::SOLVERS::ODESOLVER::ODESolver |
| using FML::MATH::Spline = typedef FML::INTERPOLATION::SPLINE::Spline |
| double FML::MATH::Airy_Ai | ( | double | z | ) |
| double FML::MATH::find_root_bisection | ( | const Spline & | y, |
| double | y_value, | ||
| std::pair< double, double > | xrange, | ||
| double | epsilon | ||
| ) |
Find roots \( f(x) = 0 \) using bisection with f given as a spline. Requires GSL.
Definition at line 89 of file Math.cpp.
| double FML::MATH::find_root_bisection | ( | const std::function< double(double)> & | function, |
| std::pair< double, double > | xrange, | ||
| double | epsilon | ||
| ) |
Find roots \( f(x) = 0 \) using bisection.
Definition at line 51 of file Math.cpp.
| std::optional< double > FML::MATH::find_root_newton | ( | const std::function< double(double)> & | function, |
| const std::function< double(double)> & | derivative, | ||
| double | x0, | ||
| double | epsilon | ||
| ) |
Find roots \( f(x) = 0 \) using Newtons method. Requires C++17.
| double FML::MATH::Gegenbauer | ( | int | n, |
| double | x, | ||
| double | alpha | ||
| ) |
Definition at line 455 of file Math.cpp.
| DVector FML::MATH::GegenbauerArray | ( | int | nmax, |
| double | x, | ||
| double | alpha | ||
| ) |
| std::pair< double, bool > FML::MATH::GeneralizedLentzMethod | ( | std::function< double(int)> & | a, |
| std::function< double(int)> & | b, | ||
| double | epsilon, | ||
| int | maxsteps | ||
| ) |
Evaluate continued fraction: (b0 + a1/(b1 + a2 /( ... ))).
For example useful for computing ratios of spherical bessel functions.
| [in] | a | The function a[i] |
| [in] | b | The function b[i] |
| [in] | epsilon | Convergence criterion |
| [in] | maxsteps | The maximum steps before we deem it not to converge |
Definition at line 413 of file Math.cpp.
| DVector FML::MATH::Hyperspherical_j_ell_array | ( | int | lmax, |
| const double | nu, | ||
| const double | chi, | ||
| double | K | ||
| ) |
Hyperspherical bessel functions using recursion formula.
Definition at line 140 of file Math.cpp.
| double FML::MATH::HyperSphericalBesselWKB | ( | int | ell, |
| double | nu, | ||
| double | chi, | ||
| double | K | ||
| ) |
WKB approximation for The hyper spherical bessel functions (for a curved Universe) For a flat Universe call with nu = 1.0, chi = k*(eta0-eta) and K = 0.0.
Requires GSL.
Definition at line 484 of file Math.cpp.
| double FML::MATH::j_ell | ( | const int | ell, |
| const double | arg | ||
| ) |
Spherical bessel function \( j_\ell(x) \) from CXX or GSL with fix for very small or large arguments.
Definition at line 248 of file Math.cpp.
| DVector FML::MATH::j_ell_array | ( | int | lmax, |
| const double | x | ||
| ) |
Spherical bessel functions using recursion formula.
Definition at line 189 of file Math.cpp.
| double FML::MATH::j_ell_cxx | ( | const int | ell, |
| const double | arg | ||
| ) |
Definition at line 233 of file Math.cpp.
| double FML::MATH::j_ell_gsl | ( | const int | ell, |
| const double | arg | ||
| ) |
Definition at line 216 of file Math.cpp.
| std::vector< double > FML::MATH::legendre_ell_of_mu_vector | ( | double | mu, |
| int | ell_max | ||
| ) |
Legendre polynomials.
Computes an array with \( P_0(\mu), P_1(\mu), ..., P_{ellmax}(\mu) \) using a recursion relation
Definition at line 546 of file Math.cpp.
| DVector FML::MATH::linspace | ( | double | xmin, |
| double | xmax, | ||
| int | num | ||
| ) |
Python linspace. Generate a lineary spaced array.
Definition at line 269 of file Math.cpp.