Evaluates the Arcsin distribution PDF.

View versions (1)

Interface

#include <codecogs/statistics/distributions/continuous/arcsin/pdf.h>

using namespace Statistics::Distributions::Continuous::Arcsin;

This function evaluates the PDF of the Arcsin distribution with given argument, defined by

P(x, a) = \left( \pi \sqrt{a^2 - x^2} \right) ^ {-1} \quad \mbox{for } x \in (-a, a)
\qquad
P(x, a) = 0, \mbox{otherwise}
(1)

The mean of this distribution is given by

\mu = 0
(2)

In the example that follows, the PDF is evaluated using values from 0 up to 0.8 with a step equal to 0.1. 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 <em> PRECISION </em> define.

\graph x=-1:1 a=1.1:1.9:9 .size=medium

Example 1

#include <codecogs/stats/dists/continuous/arcsin/pdf.h>
#include <iostream>
#include <iomanip>

#define PRECISION 17

int main()
{
  std::cout << "The values of the Arcsin PDF with a = 0.7 and";
  std::cout << std::endl;
  std::cout << "x = {0, 0.1, 0.2, ... , 0.7, 0.8} are" << std::endl;
  std::cout << std::endl;
  for (double x = 0; x < 0.81; x += 0.1)
  {
    std::cout << std::setprecision(1);
    std::cout << "x = " << std::setw(3) << x << " : ";
    std::cout << std::setprecision(PRECISION);
    std::cout << Stats::Dists::Continuous::Arcsin::PDF(x, 0.7);
    std::cout << std::endl;
  }
  std::cout << std::endl;
  std::cout << "The mean of the Arcsin distribution is";
  std::cout << std::endl;
  std::cout << Stats::Dists::Continuous::Arcsin::mean;
  std::cout << std::endl;
  return 0;
}

Output:

The values of the Arcsin PDF with a = 0.7 and
x = {0, 0.1, 0.2, ... , 0.7, 0.8} are

x =   0 : 0.45472840883398669
x = 0.1 : 0.45944074618482678
x = 0.2 : 0.47450836227811805
x = 0.3 : 0.50329212104487042
x = 0.4 : 0.55410638854399263
x = 0.5 : 0.64974733436139687
x = 0.6 : 0.88283278163289547
x = 0.7 : 0
x = 0.8 : 0

The mean of the Arcsin distribution is
0

Parameters

x
the argument of the PDF
a
the paramater of the PDF (must be strictly positive)

Returns

the PDF of the Arcsin distribution

References

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

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

x
a
Result