added bessel_1.c + modified Makefile
authorhackbard <hackbard>
Tue, 24 Feb 2004 13:00:25 +0000 (13:00 +0000)
committerhackbard <hackbard>
Tue, 24 Feb 2004 13:00:25 +0000 (13:00 +0000)
Makefile
bessel_1.c [new file with mode: 0644]

index b368059..ad5c1cf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,8 @@ INCLUDEDIR = /usr/include
 CFLAGS = -O3 -Wall
 LIBS = -L/usr/lib -lm
 
-API = g_plot.o
-OBJS = newton zentral homogen integral-1_2 integral-2_2 polynom_interpolation kettenbruchentwicklung
+API = g_plot.o general.o
+OBJS = newton zentral homogen integral-1_2 integral-2_2 polynom_interpolation kettenbruchentwicklung bessel_1
 
 all: $(OBJS)
 
@@ -30,6 +30,9 @@ polynom_interpolation: $(API)
 kettenbruchentwicklung: $(API)
        $(CC) $(CFLAGS) -o $@ $(API) $(LIBS) kettenbruchentwicklung.c
 
+bessel_1: $(API)
+       $(CC) $(CFLAGS) -o $@ $(API) $(LIBS) bessel_1.c
+
 clean:
        rm $(API) $(OBJS)
 
diff --git a/bessel_1.c b/bessel_1.c
new file mode 100644 (file)
index 0000000..afc0a97
--- /dev/null
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <math.h>
+#include "g_plot.h"
+#include "general.h"
+
+#define EPSILON .0001
+#define MAX_L 100
+#define R_STEP 0.1
+#define MAX_R 30
+
+int main(int argc, char **argv) {
+       int l;
+       // int fd;
+       int i;
+       double r;
+       double t;
+       double delta=2*EPSILON;
+       double Jl,Jl_1;
+
+       /*
+       if(argc!=2) {
+               printf("usage: %s file\n"argv[0]);
+               return 1;
+       }
+       */
+
+       // for(l=0:l<MAX_L;l++)
+       l=1;
+
+       for(r=0;r<MAX_R;r+=R_STEP) {
+
+       /* fd */
+       // fd=gp_init(argv[1]);
+
+       i=1;
+       t=1/(fak2(2*l-1));
+       Jl_1=t;
+       t=t/(2*l+1);
+       Jl=t;
+       delta=2*EPSILON;
+       while(delta>EPSILON) {
+               t*=-(r*r)/(2*i);
+               Jl_1+=t;
+               t*=(1./(2*l+1+i));
+               Jl+=t;
+               delta=absolute_value(t/Jl);
+               i++;
+       }
+       printf("%f %f %f (i=%d)\n",r,Jl,Jl_1,i);
+
+       }
+       // gp_close(fd);
+       return 1;
+}
+
+