Evaluates the Angle distribution PDF.
You're viewing an older version of this page (#455). View the current version.
Interface
#include <codecogs/statistics/distributions/continuous/angle/pdf.h>
using namespace Statistics::Distributions::Continuous::Angle;
Overview
This component evaluates the PDF of the Angle distribution with given arguments. x is an angle between 0 and , 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 PDF is defined by the following formula
and
for all
The mean of this distribution is given by
In the example that follows, the PDF is evaluated using a fixed value for n, equal to 3, while the first argument x takes values from 0 up to 2 with a step equal to 0.2. The mean of the distribution, stored as a constant inside the same namespace, is also displayed. The maximum number of precision digits, implicitly set to 17, may be changed through the PRECISION define.
\graph x=0:3 n=3
Example 1
#include <codecogs/statistics/distributions/continuous/angle/pdf.h>
#include <iostream>
#include <iomanip>
#define PRECISION 17
int main()
{
std::cout << "The values of the Angle PDF with n = 3 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::PDF(x, 3);
std::cout << std::endl;
}
std::cout << std::endl;
std::cout << "The mean of the Angle distribution is equal to";
std::cout << std::endl;
std::cout << Stats::Dists::Continuous::Angle::mean;
std::cout << std::endl;
return 0;
}Output:
The values of the Angle PDF with n = 3 and
x = {0, 0.2, 0.4, ..., 1.8, 2} are
x = 0 : 0
x = 0.2 : 0.099334665397530608
x = 0.4 : 0.19470917115432523
x = 0.6 : 0.28232123669751769
x = 0.8 : 0.35867804544976134
x = 1 : 0.4207354924039482
x = 1.2 : 0.46601954298361309
x = 1.4 : 0.49272486499422996
x = 1.6 : 0.49978680152075255
x = 1.8 : 0.48692381543909757
x = 2 : 0.45464871341284085
The mean of the Angle distribution is equal to
1.5707963267948966Parameters
Returns
References
John Burkardt's library of statistical C++ routines, http://www.csit.fsu.edu/~burkardt/cpp_src/prob/prob.html
DECLARATION