mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]

Various tools for integration of functions

Functions

template<typename vectorScT , typename vectorT >
vectorT::value_type mx::math::radprofIntegral (vectorScT r, vectorT p, bool inczero=false)
 Calculate the 2D integral given a radial profile. More...
 

Function Documentation

◆ radprofIntegral()

template<typename vectorScT , typename vectorT >
vectorT::value_type mx::math::radprofIntegral ( vectorScT  r,
vectorT  p,
bool  inczero = false 
)

Calculate the 2D integral given a radial profile.

Calculates the integral

\[ 2\pi \int_{min}^{max} p(r) r dr \]

using the Trapezoid rule.

The limits of integration are normally r[0] to r.back() inclusive. If the parameter inczero is set to true, then the region from 0 to r[0] is included, using the value of p[0], where the the integral is there estimate as \( p[0] \pi r[0]^2 \).

Todo:
the trapezoid rule may not be strictly valid as implemented. Is there a weighting to apply based on r?
Returns
the value of the integral
Exceptions
mxExceptionif the sizes of the input vectors don't match.
Parameters
[in]pthe r

Definition at line 62 of file radprofIntegral.hpp.