add numerical recipes library
This commit is contained in:
20
lib/nr/ansi/recipes/bessy.c
Normal file
20
lib/nr/ansi/recipes/bessy.c
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
float bessy(int n, float x)
|
||||
{
|
||||
float bessy0(float x);
|
||||
float bessy1(float x);
|
||||
void nrerror(char error_text[]);
|
||||
int j;
|
||||
float by,bym,byp,tox;
|
||||
|
||||
if (n < 2) nrerror("Index n less than 2 in bessy");
|
||||
tox=2.0/x;
|
||||
by=bessy1(x);
|
||||
bym=bessy0(x);
|
||||
for (j=1;j<n;j++) {
|
||||
byp=j*tox*by-bym;
|
||||
bym=by;
|
||||
by=byp;
|
||||
}
|
||||
return by;
|
||||
}
|
||||
Reference in New Issue
Block a user