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,28 @@
#include <iostream>
#include <iomanip>
#include <cmath>
#include "nr.h"
using namespace std;
int main(void) // Program fredex
{
const int N=40;
const DP PI=3.141592653589793238;
int j;
DP d,x;
Vec_INT indx(N);
Vec_DP g(N);
Mat_DP a(N,N);
NR::quadmx(a);
NR::ludcmp(a,indx,d);
for (j=0;j<N;j++)
g[j]=sin(j*PI/(N-1));
NR::lubksb(a,indx,g);
for (j=0;j<N;j++) {
x=j*PI/(N-1);
cout << fixed << setprecision(2) << setw(6) << (j+1);
cout << setprecision(6) << setw(13) << x << setw(13) << g[j] << endl;
}
return 0;
}