add numerical recipes library

This commit is contained in:
2025-09-12 18:55:25 +09:00
parent d4dff245bd
commit 2c75620ec9
1344 changed files with 63869 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#include <math.h>
#define NRANSI
#include "nrutil.h"
#define PI 3.141592653589793
void chebft(float a, float b, float c[], int n, float (*func)(float))
{
int k,j;
float fac,bpa,bma,*f;
f=vector(0,n-1);
bma=0.5*(b-a);
bpa=0.5*(b+a);
for (k=0;k<n;k++) {
float y=cos(PI*(k+0.5)/n);
f[k]=(*func)(y*bma+bpa);
}
fac=2.0/n;
for (j=0;j<n;j++) {
double sum=0.0;
for (k=0;k<n;k++)
sum += f[k]*cos(PI*j*(k+0.5)/n);
c[j]=fac*sum;
}
free_vector(f,0,n-1);
}
#undef PI
#undef NRANSI