Statistics › Moments ›
Prob
Calculates the probability that values in a range are between two limits.
Controller: CodeCogs
Contents
Interface
C++
Prob
template<class T> doubleprob( | int | n | |
T* | data | ||
double* | prob | ||
int | x | ||
int | y = INT_MAX | ) |
Example 1
#include <codecogs/statistics/moments/prob.h> #include <iostream> int main() { int x[5]={1, 2, 3, 4, 5}; double y[5] ={0.1, 0.2, 0.3, 0.2, 0.2}; double rez = Stats::Moments::prob<int>(5,x,y,2,4); std::cout << "The probability is: " << rez << std::endl; return 0; }
Output:The probability is: 0.7
Parameters
n the size of the data and of the prob data is the range of numeric values of x with which there are associated probabilities prob is a set of probabilities associated with values in data x is the lower bound on the value for which you want a probability. y Default Value = INT_MAX
Returns
- returns the probability that values in a range are between two limits
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.