add numerical recipes library
This commit is contained in:
18
lib/nr/cpp/recipes/bessk.cpp
Normal file
18
lib/nr/cpp/recipes/bessk.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "nr.h"
|
||||
|
||||
DP NR::bessk(const int n, const DP x)
|
||||
{
|
||||
int j;
|
||||
DP bk,bkm,bkp,tox;
|
||||
|
||||
if (n < 2) nrerror("Index n less than 2 in bessk");
|
||||
tox=2.0/x;
|
||||
bkm=bessk0(x);
|
||||
bk=bessk1(x);
|
||||
for (j=1;j<n;j++) {
|
||||
bkp=bkm+j*tox*bk;
|
||||
bkm=bk;
|
||||
bk=bkp;
|
||||
}
|
||||
return bk;
|
||||
}
|
||||
Reference in New Issue
Block a user