Evaluates the Anglit distribution CDF.

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

View versions (2)

Interface

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

using namespace Statistics::Distributions::Continuous::Anglit;

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

D(x) = \frac{1}{2} - \frac{1}{2} \cos\left( 2x + \frac{\pi}{2} \right)
\qquad -\frac{\pi}{4} \leq x \leq \frac{\pi}{4}
(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.

\graph x=-1:1

Example 1

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

#define PRECISION 17

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

Output:

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

x =   0 : 0.49999999999999994
x = 0.1 : 0.59933466539753055
x = 0.2 : 0.69470917115432518
x = 0.3 : 0.78232123669751763
x = 0.4 : 0.85867804544976134
x = 0.5 : 0.92073549240394825
x = 0.6 : 0.96601954298361314
x = 0.7 : 0.99272486499423007
x = 0.8 : 1

Parameters

x
the argument of the CDF

Returns

the CDF of the Anglit 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
Result