mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +00:00
beginning to fold in HOD code with jeremy tinker's approval
This commit is contained in:
parent
d8108d3a8e
commit
44cd0eb71f
95 changed files with 21950 additions and 0 deletions
20
c_tools/hod/qtrap.c
Normal file
20
c_tools/hod/qtrap.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#define JMAX 20
|
||||
|
||||
double qtrap(double (*func)(double), double a, double b, double EPS)
|
||||
{
|
||||
double trapzd(double (*func)(double), double a, double b, int n);
|
||||
/*void nrerror(char error_text[]);*/
|
||||
int j;
|
||||
double s,olds,t1,t2;
|
||||
|
||||
olds = -1.0e30;
|
||||
for (j=1;j<=JMAX;j++) {
|
||||
s=trapzd(func,a,b,j);
|
||||
if (fabs(s-olds) < EPS*fabs(olds)) return s;
|
||||
olds=s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
#undef JMAX
|
Loading…
Add table
Add a link
Reference in a new issue