Utility

double SBody::absolute_accuracy = 1e-15

Global absolute accuracy.

double SBody::relative_accuracy = 1e-15

Global relative accuracy.

Warning

doxygenvariable: Cannot find variable “SBody::M_2PI” in doxygen xml output for project “SBody” from directory: ../doxygen

Warning

doxygenvariable: Cannot find variable “SBody::M_PI2” in doxygen xml output for project “SBody” from directory: ../doxygen

constexpr long double SBody::M_SQRT27 = 5.19615242270663188058233902451761710l

\(\sqrt{27}\)

constexpr long double SBody::EPSILON = 1e-10l

Epsilon, a small value. \(\varepsilon\).

constexpr long double SBody::SIN_EPSILON = 1e-10l

\(\sin\varepsilon\).

constexpr long double SBody::COS_EPSILON = 0.999999999999999999995l

\(\cos\varepsilon\).

constexpr long double SBody::EPSILON_CIRCLE_AREA = boost::math::long_double_constants::pi * boost::math::tools::epsilon<double>()

Area of a circle with radius of SQRT_DBL_EPSILON. \(\pi\varepsilon^2\).

constexpr int SBody::SAMPLE_NUMBER = 100

Sample number.

constexpr long double SBody::ANGLE_INTERVAL = boost::math::long_double_constants::two_pi / SAMPLE_NUMBER

The angle corresponding to the sample number.

constexpr long double SBody::EPSILON_POLYGON_AREA = 0.06279051952931337 / ANGLE_INTERVAL * EPSILON_CIRCLE_AREA

Area of the regular polygon with SAMPLE_NUMBER edges.

Integrator

Warning

doxygenclass: Cannot find class “SBody::Integrator” in doxygen xml output for project “SBody” from directory: ../doxygen

Solver

Warning

doxygenclass: Cannot find class “SBody::Solver” in doxygen xml output for project “SBody” from directory: ../doxygen

DerivativeSolver

Warning

doxygenclass: Cannot find class “SBody::DerivativeSolver” in doxygen xml output for project “SBody” from directory: ../doxygen

MultiSolver

Warning

doxygenclass: Cannot find class “SBody::MultiSolver” in doxygen xml output for project “SBody” from directory: ../doxygen

MultiFunctionSolver

template<typename Type, std::size_t N, typename Parameter>
class MultiFunctionSolver

Subclassed by SBody::ConjugateGradientMultiFunctionSolver< Type, N, Parameter >, SBody::D2NewtonMultiFunctionSolver< Type, N, Parameter >, SBody::DNewtonMultiFunctionSolver< Type, N, Parameter >, SBody::DNewtonRotationMultiFunctionSolver< Type, N, Parameter >, SBody::DNewtonTranslationMultiFunctionSolver< Type, N, Parameter >, SBody::DirectionMultiFunctionSolver< Type, N, Parameter >, SBody::HybridAdditionMultiFunctionSolver< Type, N, Parameter >, SBody::HybridMultiFunctionSolver< Type, N, Parameter >, SBody::TriangleMultiFunctionSolver< Type, N, Parameter >

MultiDerivativeSolver

Warning

doxygenclass: Cannot find class “SBody::MultiDerivativeSolver” in doxygen xml output for project “SBody” from directory: ../doxygen

GslBlock

Warning

doxygenclass: Cannot find class “SBody::GslBlock” in doxygen xml output for project “SBody” from directory: ../doxygen

Math

Warning

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

Warning

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

Warning

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

Warning

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

template<typename Type>
Type SBody::DotCross(const boost::numeric::ublas::bounded_vector<Type, 3> &x, const boost::numeric::ublas::bounded_vector<Type, 3> &y, const boost::numeric::ublas::bounded_vector<Type, 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

Warning

doxygenfunction: Unable to resolve function “SBody::TriangleArea” with arguments (double, double, double) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type> Type TriangleArea(const boost::numeric::ublas::bounded_vector<Type, 3> &x, const boost::numeric::ublas::bounded_vector<Type, 3> &y, const boost::numeric::ublas::bounded_vector<Type, 3> &z)

Warning

doxygenfunction: Unable to resolve function “SBody::TriangleArea” with arguments (const double[], const double[], const double[]) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type> Type TriangleArea(const boost::numeric::ublas::bounded_vector<Type, 3> &x, const boost::numeric::ublas::bounded_vector<Type, 3> &y, const boost::numeric::ublas::bounded_vector<Type, 3> &z)
template<typename Type>
int SBody::RotateAroundAxis(boost::numeric::ublas::bounded_vector<Type, 8> x, bool rotate_velocity, Axis axis, Type angle)

Rotate vector x around the axis by angle.

Parameters:
  • x – 8 dimensional vector

  • rotate_velocity – if true, rotate velocity part, else rotate position part

  • axis – the rotation axis

  • angle – in rad

Returns:

status

Warning

doxygenfunction: Unable to resolve function “SBody::CartesianToSpherical” with arguments (const double[], double[], size_t) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type, std::size_t N> int CartesianToSpherical(boost::numeric::ublas::bounded_vector<Type, N> &x)
- template<typename Type> int CartesianToSpherical(const boost::numeric::ublas::bounded_vector<Type, 4> &cartesian, boost::numeric::ublas::bounded_vector<Type, 4> &spherical)
- template<typename Type> int CartesianToSpherical(const boost::numeric::ublas::bounded_vector<Type, 8> &cartesian, boost::numeric::ublas::bounded_vector<Type, 8> &spherical)

Warning

doxygenfunction: Unable to resolve function “SBody::CartesianToSpherical” with arguments (double[], size_t) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type, std::size_t N> int CartesianToSpherical(boost::numeric::ublas::bounded_vector<Type, N> &x)
- template<typename Type> int CartesianToSpherical(const boost::numeric::ublas::bounded_vector<Type, 4> &cartesian, boost::numeric::ublas::bounded_vector<Type, 4> &spherical)
- template<typename Type> int CartesianToSpherical(const boost::numeric::ublas::bounded_vector<Type, 8> &cartesian, boost::numeric::ublas::bounded_vector<Type, 8> &spherical)

Warning

doxygenfunction: Unable to resolve function “SBody::SphericalToCartesian” with arguments (const double[], double[], size_t) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type, std::size_t N> int SphericalToCartesian(boost::numeric::ublas::bounded_vector<Type, N> &x)
- template<typename Type> int SphericalToCartesian(const boost::numeric::ublas::bounded_vector<Type, 4> &spherical, boost::numeric::ublas::bounded_vector<Type, 4> &cartesian)
- template<typename Type> int SphericalToCartesian(const boost::numeric::ublas::bounded_vector<Type, 8> &spherical, boost::numeric::ublas::bounded_vector<Type, 8> &cartesian)

Warning

doxygenfunction: Unable to resolve function “SBody::SphericalToCartesian” with arguments (double[], size_t) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type, std::size_t N> int SphericalToCartesian(boost::numeric::ublas::bounded_vector<Type, N> &x)
- template<typename Type> int SphericalToCartesian(const boost::numeric::ublas::bounded_vector<Type, 4> &spherical, boost::numeric::ublas::bounded_vector<Type, 4> &cartesian)
- template<typename Type> int SphericalToCartesian(const boost::numeric::ublas::bounded_vector<Type, 8> &spherical, boost::numeric::ublas::bounded_vector<Type, 8> &cartesian)
template<typename Type>
int SBody::OppositeSign(Type x, Type y)

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

Parameters:
  • x – number

  • y – number

Returns:

result

template<typename Type>
int SBody::MapTheta(boost::numeric::ublas::bounded_vector<Type, 8> &y, Type &last_theta)

The modified spherical coordiante maps the polar angle from \(\theta\in[0,\pi]\) to.

\[\begin{split} \theta'\equiv\begin{cases}\theta & (\theta\leq\pi/2)\\ \theta-\pi & (\theta>\pi/2)\end{cases}. \end{split}\]

Parameters:
  • theta_0 – theta in the last integration step

  • y – 8 dimensional vector

Returns:

status

template<typename Type>
Type SBody::ModBy2Pi(Type phi)

Return phi in \([0, 2\pi)\).

Parameters:

phi\(\phi\)

Returns:

result

template<typename Type>
Type SBody::PhiDifference(Type phi)

Similar to ModBy2Pi, but return phi in \([-\pi, \pi)\).

Parameters:

phi\(\phi\)

Returns:

result

Warning

doxygenfunction: Unable to resolve function “SBody::LinearInterpolation” with arguments (double, double, double, double, double) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type, std::size_t N> int LinearInterpolation(Type x, Type x0, Type x1, const boost::numeric::ublas::bounded_vector<Type, N> &y0, const boost::numeric::ublas::bounded_vector<Type, N> &y1, Type y[])
- template<typename Type, std::size_t N> int LinearInterpolation(Type x, Type x0, Type x1, const boost::numeric::ublas::bounded_vector<Type, N> &y0, const boost::numeric::ublas::bounded_vector<Type, N> &y1, boost::numeric::ublas::bounded_vector<Type, N> &y)
- template<typename Type> Type LinearInterpolation(Type x, Type x0, Type x1, Type y0, Type y1)

Warning

doxygenfunction: Unable to resolve function “SBody::LinearInterpolation” with arguments (double, double, double, const double[], const double[], double[], size_t) in doxygen xml output for project “SBody” from directory: ../doxygen. Potential matches:

- template<typename Type, std::size_t N> int LinearInterpolation(Type x, Type x0, Type x1, const boost::numeric::ublas::bounded_vector<Type, N> &y0, const boost::numeric::ublas::bounded_vector<Type, N> &y1, Type y[])
- template<typename Type, std::size_t N> int LinearInterpolation(Type x, Type x0, Type x1, const boost::numeric::ublas::bounded_vector<Type, N> &y0, const boost::numeric::ublas::bounded_vector<Type, N> &y1, boost::numeric::ublas::bounded_vector<Type, N> &y)
- template<typename Type> Type LinearInterpolation(Type x, Type x0, Type x1, Type y0, Type y1)
template<typename Type>
int SBody::InterpolateSphericalPositionToCartesian(Type t, Type t0, Type t1, const boost::numeric::ublas::bounded_vector<Type, 8> &y0, const boost::numeric::ublas::bounded_vector<Type, 8> &y1, boost::numeric::ublas::bounded_vector<Type, 8> &y)

Linear interpolation of two spherical positions y0 and y1 at t, stored in y.

\[y=\frac{\text{SphericalToCartesian}(y_0)(t_1-t)+\text{SphericalToCartesian}(y_1)(t-t_0)}{t_1-t_0}\]

Parameters:
  • t – time to evaluate \(y\)

  • t0\(t_0\)

  • t1\(t_1\)

  • y0 – 8 dimensional vector, spherical, \(y_0\)

  • y1 – 8 dimensional vector, spherical, \(y_1\)

  • y – 8 dimensional vector, cartesian, \(y\)

Returns:

status

template<typename Type>
Type SBody::Flux(Type luminosity, Type magnification, Type redshift)

Calculate the bolometric flux. The result is.

\[F_\text{obs}=\frac{L_\text{src}}{(1+z)^2}\frac{\Omega_\text{src}}{\Omega_\text{obs}}.\]
The additional \((1+z)^{-1}\) comes from the expansion of the frequency that \((1+z)^{-1}=\frac{\nu_\text{obs}}{\nu_\text{src}}\).

Parameters:
  • luminosity – intrinsic luminosity of the source, \(L_\text{src}\)

  • magnification – magnification of the source, including the relativistic redshift and beaming, and gravitational lensing. \(\frac{\Omega_\text{src}}{(1+z)\Omega_\text{obs}}\)

  • redshift – relativistic redshift of the source, \(1+z\)

Returns:

result

template<typename Type>
Type SBody::FluxDensity(Type spectral_density, Type magnification)

Calculate the flux density. The result is.

\[F_{\nu,\text{obs}}=\frac{L_{\nu,\text{src}}}{1+z}\frac{\Omega_\text{src}}{\Omega_\text{obs}}.\]

Parameters:
  • spectral_density – intrinsic spectral density of the source, \(L_{\nu,\text{src}}\)

  • magnification – magnification of the source, including the relativistic redshift and beaming, and gravitational lensing. \(\frac{\Omega_\text{src}}{(1+z)\Omega_\text{obs}}\)

Returns:

result

Elliptic Integrals

Calculate the elliptic integrals using the Legendre forms. Further information can be found in GSL Manual, Carlson (1988), Carlson (1989), Carlson (1991), and Carlson (1992).

template<typename Type>
Type SBody::EllipticIntegral(int p5, Type y, Type x, Type a5, Type b5, Type a1, Type b1, Type a2, Type b2, Type a3, Type b3, Type a4 = 1., Type b4 = 0.)
template<typename Type>
Type SBody::EllipticIntegral2Complex(int p5, Type y, Type x, Type a5, Type b5, Type f, Type g, Type h, Type a1, Type b1, Type a4 = 1., Type b4 = 0.)
template<typename Type>
Type SBody::EllipticIntegral4Complex(int p5, Type y, Type x, Type a5, Type b5, Type f1, Type g1, Type h1, Type f2, Type g2, Type h2)

Warning

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

Warning

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