Math Module

This module provides mathematical utilities for numerical computations.

Scalar Operations

template<typename T>
T sbody::sign(T x)
template<typename T>
T sbody::power2(T x)
template<typename T>
T sbody::power3(T x)
template<typename T>
T sbody::power4(T x)
template<typename T>
T sbody::squareRoot(T x)

Square root of x. Return 0 if x is negative.

Parameters:

x – number

Returns:

result

Warning

doxygenfunction: Unable to resolve function “sbody::hypotSquare” with arguments None in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename T> T hypotSquare(T x, T y)
- template<typename T> T hypotSquare(T x, T y, T z)
template<typename T>
bool sbody::oppositeSign(T x, T y)

Return 1 if x, y have opposite signs, else 0.

Parameters:
  • x – number

  • y – number

Returns:

result

Constants

Geometry

enum class sbody::Axis

Values:

enumerator X
enumerator Y
enumerator Z
template<typename T>
T sbody::sinTheta(T theta)
Template Parameters:

T –

Parameters:

theta –

Returns:

T

template<typename T>
T sbody::cosTheta(T theta)
Template Parameters:

T –

Parameters:

theta –

Returns:

T

template<typename T>
T sbody::dotCross(const boost::numeric::ublas::bounded_vector<T, 3> &x, const boost::numeric::ublas::bounded_vector<T, 3> &y, const boost::numeric::ublas::bounded_vector<T, 3> &z)

Dot product of vector x and the cross product of vector y and vector z. \(\vec{x}\cdot(\vec{y}\times\vec{z})\).

Parameters:
  • x – 3 dimensional vector

  • y – 3 dimensional vector

  • z – 3 dimensional vector

Returns:

result

template<typename T>
T sbody::triangleArea(const boost::numeric::ublas::bounded_vector<T, 3> &x, const boost::numeric::ublas::bounded_vector<T, 3> &y, const boost::numeric::ublas::bounded_vector<T, 3> &z)

Calculate the area of a triangle.

Parameters:
  • a – side length

  • b – side length

  • c – side length

Returns:

result

Special Functions

Warning

doxygenfunction: Cannot find function “sbody::CarlsonRC” in doxygen xml output for project “SBody” from directory: ../doxygen

Warning

doxygenfunction: Cannot find function “sbody::CarlsonRJ” in doxygen xml output for project “SBody” from directory: ../doxygen

Warning

doxygenfunction: Cannot find function “sbody::EllipticIntegral” in doxygen xml output for project “SBody” from directory: ../doxygen

Warning

doxygenfunction: Cannot find function “sbody::EllipticIntegral2Complex” in doxygen xml output for project “SBody” from directory: ../doxygen

Warning

doxygenfunction: Cannot find function “sbody::EllipticIntegral4Complex” in doxygen xml output for project “SBody” from directory: ../doxygen