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,19 @@
#include <cmath>
#include "nr.h"
using namespace std;
DP NR::gammln(const DP xx)
{
int j;
DP x,y,tmp,ser;
static const DP cof[6]={76.18009172947146,-86.50532032941677,
24.01409824083091,-1.231739572450155,0.1208650973866179e-2,
-0.5395239384953e-5};
y=x=xx;
tmp=x+5.5;
tmp -= (x+0.5)*log(tmp);
ser=1.000000000190015;
for (j=0;j<6;j++) ser += cof[j]/++y;
return -tmp+log(2.5066282746310005*ser/x);
}