#include <math.h>
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
#define FUNC |
( |
|
x | ) |
((*func)(x)) |
#define SHUFFLE_LENGTH 98 |
double area |
( |
double |
leftmargin, |
|
|
double |
rightmargin |
|
) |
| |
Definition at line 123 of file yield.c.
static double qsimp(double(*func)(double), double a, double b)
static int double_factorial |
( |
int |
n | ) |
|
|
static |
Definition at line 91 of file yield.c.
static int factorial(int n)
static int factorial |
( |
int |
n | ) |
|
|
static |
Definition at line 83 of file yield.c.
static int factorial(int n)
static double gauss_deviate |
( |
long * |
idum | ) |
|
|
static |
Definition at line 190 of file yield.c.
199 double fac, r, v1, v2;
213 fac = sqrt(-2.0*log(r)/r);
double uniform_deviate(long *idum)
double multiarea |
( |
double |
r, |
|
|
int |
dim |
|
) |
| |
Definition at line 129 of file yield.c.
131 double coeff, integral;
137 return integral*coeff;
static double multinormal(double x)
static double multicoeff(int n)
static double qsimp(double(*func)(double), double a, double b)
static double multicoeff |
( |
int |
n | ) |
|
|
static |
Definition at line 109 of file yield.c.
static int factorial(int n)
static int double_factorial(int n)
static long int power2(int n)
static double multinormal |
( |
double |
x | ) |
|
|
static |
double normal |
( |
double |
x | ) |
|
Definition at line 56 of file yield.c.
61 y=exp(y)/sqrt(2*M_PI);
static long int power2 |
( |
int |
n | ) |
|
|
static |
static double qsimp |
( |
double(*)(double) |
func, |
|
|
double |
a, |
|
|
double |
b |
|
) |
| |
|
static |
Definition at line 36 of file yield.c.
42 for (j=1;j<=
JMAX;j++) {
45 if (fabs(s-os) <
EPS*fabs(os))
return s;
49 nrerror(
"Too many steps in routine QSIMP");
void nrerror(char *error_text)
static double trapzd(double(*func)(double), double a, double b, int n)
static double trapzd |
( |
double(*)(double) |
func, |
|
|
double |
a, |
|
|
double |
b, |
|
|
int |
n |
|
) |
| |
|
static |
Definition at line 11 of file yield.c.
20 return (s=0.5*(b-a)*(
FUNC(a)+
FUNC(b)));
25 for (sum=0.0,j=1;j<=it;j++,x+=del) sum +=
FUNC(x);
27 s=0.5*(s+(b-a)*sum/tnm);
double uniform_deviate |
( |
long * |
idum | ) |
|
Definition at line 150 of file yield.c.
163 if((*idum < 0) || (iff==0)) {
165 if((*idum = (
IC-(*idum)) %
IM) < 0)
170 *idum = (
IA*(
unsigned long)(*idum)+
IC) % IM;
171 shuff_tab[j] = (*idum);
173 *idum = (
IA*(
unsigned long)(*idum)+
IC) % IM;
179 nrerror(
"Error in random number generator uniform_deviate.");
183 *idum = (
IA*(
unsigned long)(*idum)+
IC) % IM;
184 shuff_tab[j] = *idum;
186 return (
double) iy/
IM;
void nrerror(char *error_text)