add numerical recipes library
This commit is contained in:
20
lib/nr/ansi/recipes/bessk.c
Normal file
20
lib/nr/ansi/recipes/bessk.c
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
float bessk(int n, float x)
|
||||
{
|
||||
float bessk0(float x);
|
||||
float bessk1(float x);
|
||||
void nrerror(char error_text[]);
|
||||
int j;
|
||||
float 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