answersLogoWhite

0


Best Answer

/*************************************************************************/

/* POISSON3.C */

/* Calculate poisson statistics given average number of occurences */

/* and the value of interest. */

/* Uses the formula P(X=x) = mu^x * e^-mu/x!, for x = 1,2,3...x */

/* NOTICE: Factorial1() is copyrighted by author */

/* FURTHERMORE: Software is provided as is, with no promise of fitness */

/* for use. */

/* comments or questions: p_duke52@Yahoo.com */

/* Have fun... */

/* PAD, May 25, 2008 */

/*************************************************************************/ #include <stdio.h>

#include <math.h> /* protype of "e", exp(x) == exp^x */

#include <conio.h> /* For clrscr() */ /*********************************************************\

// copyrighted by author

// Written by: Jaco van Staden

// Date: 13 July 2002

// Program: Maths Program

// from the file "A_maths_me1067647162002.zip"

// available at Planet Source Code:

// http://www.planet-source-code.com

// changed int to double for size issues

// -- PAD, 5/25/08

\**********************************************************/ double Factorial1 (double a)

{

double answer = 1.0;

while(a>1)

answer *= a--;

return answer;

} int main(void)

{

double result, res1, res2;

double i = 0.0, k = 0.00;

double answer = 0.0; result = res1 = res2 = 0.0; clrscr(); /* makes it easier to see input prompts */ printf("Enter mean: ");

scanf("%lf", &i); printf("Enter value of interest: ");

scanf("%lf", &k); /* factorial of value of interest */ answer = Factorial1(k); /* formula for k */

result = pow(i,k);

res1 = 1/(exp(k));

res2 = (result * res1) / answer; printf("answer is ... : %0.20lf", res2);

return 0;

} /*************************************************************************/

/* POISSON3.C */

/* Calculate poisson statistics given average number of occurences */

/* and the value of interest. */

/* Uses the formula P(X=x) = mu^x * e^-mu/x!, for x = 1,2,3...x */

/* NOTICE: Factorial1() is copyrighted by author */

/* FURTHERMORE: Software is provided as is, with no promise of fitness */

/* for use. */

/* comments or questions: p_duke52@yahoo.com */

/* Have fun... */

/* PAD, May 25, 2008 */

/*************************************************************************/ #include <stdio.h>

#include <math.h> /* protype of "e", exp(x) == exp^x */

#include <conio.h> /* For clrscr() */ /*********************************************************\

// copyrighted by author

// Written by: Jaco van Staden

// Date: 13 July 2002

// Program: Maths Program

// from the file "A_maths_me1067647162002.zip"

// available at Planet Source Code:

// http://www.planet-source-code.com

// changed int to double for size issues

// -- PAD, 5/25/08

\**********************************************************/ double Factorial1 (double a)

{

double answer = 1.0;

while(a>1)

answer *= a--;

return answer;

} int main(void)

{

double result, res1, res2;

double i = 0.0, k = 0.00;

double answer = 0.0; result = res1 = res2 = 0.0; clrscr(); /* makes it easier to see input prompts */ printf("Enter mean: ");

scanf("%lf", &i); printf("Enter value of interest: ");

scanf("%lf", &k); /* factorial of value of interest */ answer = Factorial1(k); /* formula for k */

result = pow(i,k);

res1 = 1/(exp(k));

res2 = (result * res1) / answer; printf("answer is ... : %0.20lf", res2);

return 0;

}

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C source code for poisson distribution?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Getting source code of c?

C is a programming language, so it doesn't have source code.(On the other hand, C compilers do have source code, but you, as a beginner in programming, could not understand them.)


How do you Open a text file as C plus plus source code?

All C++ source code is is a text file with the .cpp extension. So if you save your code as *****.cpp then it is automatically C++ source code.


What is the source code for scientific calculator in c?

What is the source code for scientific calculator in c?Read more: What_is_the_source_code_for_scientific_calculator_in_c


Stack overflow Exception source code in c sharp?

You have to ask Microsoft for the source code


How do you convert .c extension to .exe?

To convert source code (.c file) to an executable (.exe) file you have to use a compiler, which is a translator of source code to machine code.


What is the differentiate of turbo c from turbo c plus plus?

Turbo C compiles c source. turbo c++ compiles c++ source code.


Where do you get the exact source code in C that implements lossless compression algorithm?

The source code, in C, will depend on what type of lossless compression algorithm will be used. A source code should be available from various computer scientists in your area.


What type of a program is used in order to enter c source code?

What type of a program is used in order to enter C source code


How do you convert c exe to source code?

Not possible.


What is a source code file in c plus plus?

A source code file is a plain-text file containing C++ instructions. The instructions must be compiled and linked to create a native machine code executable.


What is meaning of PHP is an open source software?

It means that the source code of PHP (not PHP code, but the C/C++ code used to build the PHP binary) is published and available to anyone. It also means that anyone can contribute fixes and improvements to the source code.Read more here: open-source


Source code of lotto game lottery in c?

sravanthi