Evaluates the Arcsin distribution CDF.

You're viewing an older version of this page (#439). View the current version.

View versions (2)

Interface

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

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

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

D(x, a) = \frac{1}{2} + \frac{1}{\pi} \arcsin \left( \frac{x}{a} \right) 
\quad \mbox{for } x \in (-a, a)
(1)

and

D(x, a) = 0 \quad \mbox{for } x \leq -a
\qquad
D(x, a) = 1 \quad \mbox{for } x \geq a
(2)

\graph x=-1:1 a=1

Example 1

In the example that follows, the CDF is evaluated using values from 0 up to 0.8 with a step equal to 0.1. The maximum number of precision digits, implicitly set to 17, may be changed through the <em> PRECISION </em> define.

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

#define PRECISION 17

int main()
{
  std::cout << "The values of the Arcsin CDF 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::CDF(x, 0.7);
    std::cout << std::endl;
  }
  return 0;
}

Output

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

x =   0 : 0.5
x = 0.1 : 0.54562894834298992
x = 0.2 : 0.59223083110566799
x = 0.3 : 0.64098296402862398
x = 0.4 : 0.69361058099470274
x = 0.5 : 0.7532482855711502
x = 0.6 : 0.82776267147847782
x = 0.7 : 1
x = 0.8 : 1

Parameters

x
the argument of the CDF
a
the parameter of the CDF (must be strictly positive)

Returns

the CDF of the Arcsin distribution

References

John Burkardt&#039;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