I have forgotten

COST (GBP)
0.94
5.11
0

# CDF

Evaluates the Angle distribution CDF.
Controller: CodeCogs
Contents

C++
Excel

## CDF

 doubleCDF( double x int n )[inline]
This component evaluates the CDF of the Angle distribution with given arguments. x is an angle between 0 and $\inline&space;&space;\pi$, corresponding to the angle made in an n dimensional space, between a fixed line passing through the origin, and an arbitrary line that also passes through the origin, which is specified by choosing any point on the n dimensional sphere with uniform probability.

The Angle CDF is defined by the following formula

$\mathrm{D}(x)&space;=&space;&space;\frac{\Gamma\left(\frac{n}{2}\right)}&space;{\sqrt{\pi}&space;\,\Gamma\left(\frac{n-1}{2}\right)}&space;\int_0^x&space;\sin^{n-2}(t)&space;\mathrm{d}t&space;\qquad&space;\mbox{if&space;}&space;n&space;>&space;2$
and
$\mathrm{D}(x)&space;=&space;\frac{x}{\pi}&space;\qquad&space;\mbox{if&space;}&space;n&space;=&space;2$
for all
$x&space;\in&space;[0,&space;\pi]$

The following figure illustrates the typical shape of the Angle distribution for a range of n:
There is an error with your graph parameters for CDF with options x=0:3.5 n=2:6:5

Error Message:Function CDF failed. Ensure that: Invalid C++

### Example 1

In the given example, the CDF is evaluated using a fixed value for n, equal to 4, while the first argument x takes values from 0 up to 2 with a step equal to 0.2. The maximum number of precision digits, implicitly set to 17, may be changed through the <em> PRECISION </em> define.
#include <codecogs/stats/dists/continuous/angle/cdf.h>
#include <iostream>
#include <iomanip>

#define PRECISION 17

int main()
{
std::cout << "The values of the Angle CDF with n = 4 and";
std::cout << std::endl;
std::cout << "x = {0, 0.2, 0.4, ..., 1.8, 2} are" << std::endl;
std::cout << std::endl;
for (double x = 0; x < 2.1; x += 0.2)
{
std::cout << std::setprecision(2);
std::cout << "x = " << std::setw(3) << x << " : ";
std::cout << std::setprecision(PRECISION);
std::cout << Stats::Dists::Continuous::Angle::CDF(x, 4);
std::cout << std::endl;
}
return 0;
}

### Output

The values of the Angle CDF with n = 4 and
x = {0, 0.2, 0.4, ..., 1.8, 2} are

x =   0 : 0
x = 0.2 : 0.001684123127684655
x = 0.4 : 0.013153186649778228
x = 0.6 : 0.042647304023738355
x = 0.8 : 0.095560829038801032
x =   1 : 0.1735907059637424
x = 1.2 : 0.27446855935925973
x = 1.4 : 0.39231882068278456
x = 1.6 : 0.51858635136931963
x = 1.8 : 0.64338711110041569
x =   2 : 0.75706863044011896

### References

John Burkardt's library of statistical C++ routines, http://www.csit.fsu.edu/~burkardt/cpp_src/prob/prob.html

### Parameters

 x the argument of the CDF n the spatial dimension (must be at least 2)

### Returns

the value of the Angle CDF evaluated with the given arguments

### Authors

Lucian Bentea (September 2005)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.