Skip to content

calc

Contains differential and integral calculus functions. More...

Functions

Name
template <typename LAMBDA ,typename D >
D
diff(LAMBDA f, D x, unsigned int n =1, D dx =D(0.00001))
Nth order derivative at a point Higher orders are more prone to inaccuracies. You can assign your dx at higher orders to avoid them Be aware that the function already approximates dx at higher orders.
template <typename D >
std::vector< D >
diff(std::vector< D > & x, std::vector< D > & y, int n =1)
Derivative of 2 std::vectors. It returns a vector of size: x.size()-n
template <typename D ,typename LAMBDA >
std::vector< D >
diff(LAMBDA f, std::vector< D > & x, int n =1)
Derivative of function with given vector. It returns a vector of size: x.size()-n
template <typename D ,typename LAMBDA >
std::vector< D >
taylor(LAMBDA f, std::vector< D > & x, D x0 =D(0))
template <typename D ,typename LAMBDA >
std::vector< D >
eular_method(LAMBDA f, D x0, unsigned int n)

Detailed Description

Contains differential and integral calculus functions.

Short for CALCulus

Functions Documentation

function diff

template <typename LAMBDA ,
typename D >
D diff(
    LAMBDA f,
    D x,
    unsigned int n =1,
    D dx =D(0.00001)
)

Nth order derivative at a point Higher orders are more prone to inaccuracies. You can assign your dx at higher orders to avoid them Be aware that the function already approximates dx at higher orders.

Parameters:

  • f Function
  • x Point
  • n Derivative order
  • dx Step size

Template Parameters:

  • LAMBDA std::function
  • D any floating point type (double, float ..)

Return: D

function diff

template <typename D >
std::vector< D > diff(
    std::vector< D > & x,
    std::vector< D > & y,
    int n =1
)

Derivative of 2 std::vectors. It returns a vector of size: x.size()-n

Parameters:

  • x Domain vector
  • y Range vector
  • n Derivative order

Template Parameters:

  • D any floating point type (double, float ..)

Return: std::vector

function diff

template <typename D ,
typename LAMBDA >
std::vector< D > diff(
    LAMBDA f,
    std::vector< D > & x,
    int n =1
)

Derivative of function with given vector. It returns a vector of size: x.size()-n

Parameters:

  • f Function
  • x Domain vector
  • n Derivative order

Template Parameters:

  • D
  • LAMBDA

Return: std::vector

function taylor

template <typename D ,
typename LAMBDA >
std::vector< D > taylor(
    LAMBDA f,
    std::vector< D > & x,
    D x0 =D(0)
)

function eular_method

template <typename D ,
typename LAMBDA >
std::vector< D > eular_method(
    LAMBDA f,
    D x0,
    unsigned int n
)

Updated on 4 September 2022 at 18:30:41 EEST