FUNCTION
Sine_Power_Integral
Evaluates the sine power integral.
Interface
#include <codecogs/maths/special/sine_power_integral.h>
using namespace Maths::Special;
This function evaluates the sine power integral with given parameters, defined by
$$\mathrm{sinepower}(a, b, n) = \int_a^b \sin(t)^n \mathrm{d}t$$
(1)
The algorithm uses the fact that
$$\int \sin^n(t) \mathrm{d}t = \frac{1}{n} \left( -\sin^{n-1}(t) \cos(t) + (n-1) \int \sin^{n-2}(t) \mathrm{d}t \right)$$
(2)
Example 1
#include <codecogs/maths/special/sine_power_integral.h>
#include <iostream>
#include <iomanip>
int main()
{
std::cout << std::setprecision(10);
std::cout << "For lower and upper bounds a = 0 and b = 10, " << std::endl;
std::cout << "and 0 <= n < 10, the value of the integral is" << std::endl;
for (int n = 0; n < 10; n++)
{
std::cout << "n = " << n << " : ";
std::cout << Maths::Special::sine_power_integral(0, 10, n) << std::endl;
}
return 0;
}Output
For lower and upper bounds a = 0 and b = 10,
and 0 <= n < 10, the value of the integral is
n = 0 : 10
n = 1 : 1.839071529
n = 2 : 4.771763687
n = 3 : 1.308824601
n = 4 : 3.545048474
n = 5 : 1.061758823
n = 6 : 2.947543192
n = 7 : 0.913186379
n = 8 : 2.577621119
n = 9 : 0.8124365163Parameters
a
the lower limit of integration
b
the upper limit of integration
n
the power of the sine function
Returns
An approximation of the sine power integral.
References
John Burkardt's library of statistical C++ routines, http://www.csit.fsu.edu/~burkardt/cpp_src/prob/prob.html
Interactive Calculator
a
b
n
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.