I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 1.00
sub units 0.00
+
0

Prob

Calculates the probability that values in a range are between two limits.
Controller: CodeCogs

get GPL add to cart

Interface

C++

Prob

 
template<class T> doubleprobintn
T*data
double*prob
intx
inty = INT_MAX )
Returns the probability that values in a range are between two limits. If upper limit y is not supplied, then it returns the probability that values in data are equal to lower limit. If the data array does not sum to 1 or if one of its components are null, the function exits.

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

nthe size of the data and of the prob
datais the range of numeric values of x with which there are associated probabilities
probis a set of probabilities associated with values in data
xis the lower bound on the value for which you want a probability.
yDefault 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.