geometric_pdf

Evaluates the discrete geometric probability density function (PDF).

Synopsis

#include<imsls.h>

floatimsls_f_geometric_pdf(intix, floatpin)

The type double function is imsls_d_geometric_pdf.

Required Arguments

intix (Input)
Argument for which the discrete geometric PDF is to be evaluated. ix must be non-negative.

floatpin (Input)
Probability parameter of the discrete geometric PDF (the probability of success for each independent trial).   pin must be in the open interval (0, 1).

Return Value

The probability that a discrete geometric random variable having parameter pin will be equal to ix. A value of NaN is returned if an input value is in error.

Description

The function geometric_pdf evaluates the discrete geometric probability density function (PDF), defined

 

where the return value f(Ip) is the probability that I = ix trials would be observed before observing a success, and input parameter p = pin is the probability of success for each independent trial.

Example

In this example, we evaluate the discrete geometric PDF at ix = 3, pin = 0.25.

 

#include <imsls.h>

#include <stdio.h>

 

int main()

{

int ix = 3;

float pin = 0.25;

float p;

 

p = imsls_f_geometric_pdf(ix, pin);

printf("The probability density of a discrete ");

printf("geometric\nrandom variable with ");

printf("probability parameter pin = %4.2f\n", pin);

printf("and value ix = %1i is %8.6f\n\n", ix, p);

}

Output

The probability density of a discrete geometric

random variable with probability parameter pin = 0.25

and value ix = 3 is 0.105469