I have forgotten

COST (GBP)
0.19
0.00
0

# PDF

Evaluates the Anglit distribution PDF.
Controller: CodeCogs
Contents

C++
Excel

## PDF

 doublePDF( double x )[inline]
This function evaluates the PDF of the Anglit distribution with given argument, defined by
$P(x)&space;=&space;\sin&space;\left(&space;2x&space;+&space;\frac{\pi}{2}&space;\right)&space;\qquad&space;-\frac{\pi}{4}&space;\leq&space;x&space;\leq&space;\frac{\pi}{4}$

The mean and variance of this distribution are given by

$\mu&space;=&space;0$

and

$\sigma^2&space;=&space;\int_{-\pi/4}^{\pi/4}&space;x^2&space;\sin&space;\left(2x&space;+&space;\frac{\pi}{2}\right)&space;\mathrm{d}x&space;&space;&space;&space;&space;&space;&space;&space;&space;&space;=&space;\frac{1}{16}&space;\pi^2&space;-&space;\frac{1}{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 and variance of the distribution, stored as constants inside the same namespace, are also displayed. The maximum number of precision digits, implicitly set to 17, may be changed through the <em> PRECISION </em> define.

There is an error with your graph parameters for PDF with options x=-1:1

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

### Example 1

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

#define PRECISION 17

int main()
{
std::cout << "The values of the Anglit PDF 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::PDF(x);
std::cout << std::endl;
}
std::cout << std::endl;
std::cout << "The mean of the Anglit distribution is";
std::cout << std::endl;
std::cout << Stats::Dists::Continuous::Anglit::mean;
std::cout << std::endl;
std::cout << "and variance is" << std::endl;
std::cout << Stats::Dists::Continuous::Anglit::variance;
std::cout << std::endl;
return 0;
}
Output:
The values of the Anglit PDF with
x = {0, 0.1, 0.2, ... , 0.7, 0.8} are

x =   0 : 0.70710678118654746
x = 0.1 : 0.83349215422481648
x = 0.2 : 0.926648825310733
x = 0.3 : 0.98286293194097685
x = 0.4 : 0.99989339507807162
x = 0.5 : 0.97706126389947567
x = 0.6 : 0.91527678342432328
x = 0.7 : 0.8170031059169558
x = 0.8 : 0

The mean of the Anglit distribution is
0
and variance is
0.11685027506808487

### 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 PDF

### Returns

the PDF of the Anglit distribution

### 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.