numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::constants::impl Namespace Reference

Namespace of internal implementations. More...

Functions

template<typename T >
constexpr auto exp_maclaurin (T x) -> T
 Calculate exponential function with Maclaurin series.
 
template<typename T >
constexpr auto expm1_maclaurin (T x) -> T
 Calculate exponential function minus one with Maclaurin series.
 
template<typename T >
constexpr auto log1m_maclaurin (T x) -> T
 Calculate logarithm of 1 - x.
 
template<typename T , typename I >
constexpr auto pow_pos_int (T base, I exp) -> T
 Calculate the value of base raised to the power exp.
 

Detailed Description

Namespace of internal implementations.

Function Documentation

◆ exp_maclaurin()

template<typename T >
auto num_collect::constants::impl::exp_maclaurin ( T x) -> T
constexpr

Calculate exponential function with Maclaurin series.

This calculates the following series:

\[ e^x = \sum_{k=0}^\infty \frac{x^k}{k!} \]

Note
This function is suitable for small positive numbers.
Template Parameters
TNumber type (assumed as floating-point number types).
Parameters
[in]xNumber.
Returns
Exponential function.

Definition at line 41 of file exp_maclaurin.h.

◆ expm1_maclaurin()

template<typename T >
auto num_collect::constants::impl::expm1_maclaurin ( T x) -> T
constexpr

Calculate exponential function minus one with Maclaurin series.

This calculates the following series:

\[ e^x - 1 = \sum_{k=1}^\infty \frac{x^k}{k!} \]

Note
This function is suitable for small positive numbers.
Template Parameters
TNumber type (assumed as floating-point number types).
Parameters
[in]xNumber.
Returns
Exponential function minus one.

Definition at line 42 of file expm1_maclaurin.h.

◆ log1m_maclaurin()

template<typename T >
auto num_collect::constants::impl::log1m_maclaurin ( T x) -> T
constexpr

Calculate logarithm of 1 - x.

This calculates the following series:

\[ log(1 - x) = -\sum_{k=1}^\infty \frac{x^k}{k} \]

Note
This function is suitable for small positive numbers.
Template Parameters
TNumber type.
Parameters
[in]xNumber.
Returns
logarithm of 1 - x.

Definition at line 42 of file log1m_maclaurin.h.

◆ pow_pos_int()

template<typename T , typename I >
auto num_collect::constants::impl::pow_pos_int ( T base,
I exp ) -> T
constexpr

Calculate the value of base raised to the power exp.

Warning
Exponent is assumed to be a positive integer.
Template Parameters
TBase type.
IInteger type for exponent.
Parameters
[in]baseBase.
[in]expExponent.
Returns
Value of base raised to the power exp.

Definition at line 40 of file pow_pos_int.h.