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,20 @@
#include <cmath>
#include "nr.h"
using namespace std;
DP NR::probks(const DP alam)
{
const DP EPS1=1.0e-6,EPS2=1.0e-16;
int j;
DP a2,fac=2.0,sum=0.0,term,termbf=0.0;
a2 = -2.0*alam*alam;
for (j=1;j<=100;j++) {
term=fac*exp(a2*j*j);
sum += term;
if (fabs(term) <= EPS1*termbf || fabs(term) <= EPS2*sum) return sum;
fac = -fac;
termbf=fabs(term);
}
return 1.0;
}