# Mathematical Model Of Various Distribution Engineering Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

According to jerry banks et al Discrete event simulation, fifth edition, various distribution models are used to generate random variable X by using inverse transform techquine .They are as follows in subsequent sections

Uniform distribution also known as rectangular distribution is in which random Variable X is uniformly distributed between interval [a,b] where its pdf(probability density function) is given by

â‰¤xâ‰¤b

And cumulative density function (cdf) is given by

It should that the length of interval is proportional for all and

Thereby satisfying aâ‰¤â‰¤â‰¤b

P()= F() -F()=

http://sage.math.canterbury.ac.nz/home/pub/60/data/Uniform01ThreeCharts.png

If Inverse transform technique approach is used to sample uniform distribution, first a reasonable guess to generating random variable X is given

Here R is always Random on [0,1] so its pdf is given by

â‰¤xâ‰¤b

Also cdf is given by so following steps are implied to obtain X is as follows

Set / = R

Then we solve X in terms of R yielding,

Which agrees with random variable X equation

Exponential Distribution has shown its importance to model interarrival times where arrivals are completely random in nature and to model highly variable model service times which occur in random fashion .Hence in these scenarios Î» is the rate of arrivals per hour or services per minite.To measure the lifetime of component in system which fails catastrophically ,exponentiatial distribution is used where Î» is the failure rate

Here random variable X is said to be exponentially distributed with parameter Î» > 0 if its pdf is given by

Î»x, xâ‰¥0

Elsewhere

And cdf is given by

Here the parameter Î» can be taken as the mean number of occurrences per time unit.If interarriaval time are exponential distribution with rate Î»,the Î» can be considered as the mean number of arrivals per unit ,or the arrival rate .I we nnotice for any i

So is the mean interarrival time .So main goal is to dvelop a procedure for generating values that have exponential distribution.

Hence inverse transform technique can be implied at least in principle for any distribution but most useful where cdf F(x) is of form that is simple so that inverse can be computed easily .Following step show step by step procedure for inverse transform technique illustrated by exponential distribution

Step 1: Computing cdf of random variable X

F(x)= ,xâ‰¥0.

Step 2 :Set F(x)= R on the rang of X

For exponential distribution it becomes =R on the range Xâ‰¥0.

X is the random variable whaich is exponentially distributed hence is also a randon variable called R which is to be uniformly distributed over interval [0,1].

Step 3: Solving the equation F(x)= R for X in terms of R

For the exponetiaonl distribution ,solution is as follows :

X= 1.1

The above equation(1.1) is know as Random Variate Generator for exponetional distribution.It can also be written as X = .To generate sequence of randon numbers next setp is followed

Step 4: Using equation = ) we genatare random numbers and compute correndonding randon varietes

For exponential case by equation 1.1 so

For i=1,2,3â€¦â€¦â€¦..For simplifiacation

This alternative is justified by the fact both and 1- are uniformly distributed on [0,1]

Jonathan de Halleux, [email protected], 2002

http://www.codeproject.com/Articles/2868/A-Normal-Exponential-Random-Generator-and-Histogra

A C++ program to generate Random Varites using Normal and exponetional distribution is implemented as Fast randon generator using the algorithm developed by George Marsaglia and Wai Wan Tsang in paper The Ziggurat Method for Generating Random Variables, George Marsaglia and Wai Wan Tsang, Journal of Statistical Software, Vol 05, Issue 08.as

// RandomGenerator.cpp: implementation of the CRandomGenerator //

#include "stdafx.h"

#include "HistogramDemo.h"

#include "RandomGenerator.h"

#ifdef _DEBUG

#undef THIS_FILE

static char THIS_FILE[]=__FILE__;

#define new DEBUG_NEW

#endif

unsigned long CRandomGenerator::jz;

unsigned long CRandomGenerator::jsr=123456789;

long CRandomGenerator::hz;

unsigned long CRandomGenerator::iz;

unsigned long CRandomGenerator::kn[128];

unsigned long CRandomGenerator::ke[256];

float CRandomGenerator::wn[128];

float CRandomGenerator::fn[128];

float CRandomGenerator::we[256];

float CRandomGenerator::fe[256];

CRandomGenerator::CRandomGenerator( unsigned long jsreed )

zigset(jsreed);

## }

/* nfix() generates variates from the residue when rejection in RNOR occurs. */

float CRandomGenerator::nfix(void)

## {

const float r = 3.442620f; /* The starting of the right tail */

static float x, y;

for(;;)

## {

x=hz*wn[iz];

if(iz==0)

{ /* iz==0, handle the base strip */

do

## {

x=-log(UNI())*0.2904764;

/* .2904764 is 1/r */

y=-log(UNI());

} while(y+y<x*x);

return (hz>0)? r+x : -r-x;

## }

/* iz>0, handle the wedges of other strips */

if( fn[iz]+UNI()*(fn[iz-1]-fn[iz]) < exp(-.5*x*x) )

return x;

/* start all over */

hz=SHR3();

iz=hz&127;

if(abs(hz)<kn[iz])

return (hz*wn[iz]);

## }

/* efix() generates variates from the residue when rejection in REXP occurs. */

float CRandomGenerator::efix(void)

float x;

for(;;)

## {

if(iz==0)

return (7.69711-log(UNI())); /* iz==0 */

x=jz*we[iz];

if( fe[iz]+UNI()*(fe[iz-1]-fe[iz]) < exp(-x) )

return (x);

/* Start all over again */

jz=SHR3();

iz=(jz&255);

if(jz<ke[iz])

return (jz*we[iz]);

## }

/*--------This procedure sets the seed and creates the tables------*/

void CRandomGenerator::zigset(unsigned long jsrseed)

## {

const double m1 = 2147483648.0, m2 = 4294967296.;

double dn=3.442619855899,tn=dn,vn=9.91256303526217e-3, q;

double de=7.697117470131487, te=de, ve=3.949659822581572e-3;

int i;

jsr^=jsrseed;

/* Set up tables for RNOR */

q=vn/exp(-.5*dn*dn);

kn[0]=(dn/q)*m1;

kn[1]=0;

wn[0]=q/m1;

wn[127]=dn/m1;

fn[0]=1.;

fn[127]=exp(-.5*dn*dn);

for(i=126;i>=1;i--)

## {

dn=sqrt(-2.*log(vn/dn+exp(-.5*dn*dn)));

kn[i+1]=(dn/tn)*m1; tn=dn;

fn[i]=exp(-.5*dn*dn);

wn[i]=dn/m1;

## }

/* Set up tables for REXP */

q = ve/exp(-de);

ke[0]=(de/q) * m2; ke[1]=0;

we[0]=q/m2; we[255]=de/m2;

fe[0]=1.; fe[255]=exp(-de);

for(i=254;i>=1;i--)

## {

de=-log(ve/de+exp(-de));

ke[i+1]= (de/te)*m2;

te=de;

fe[i]=exp(-de);

we[i]=de/m2;