From: hackbard Date: Tue, 24 Feb 2004 13:00:25 +0000 (+0000) Subject: added bessel_1.c + modified Makefile X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbec7a4f63c3acda2e68719cb98d85fd34c91afc;p=physik%2Fcomputational_physics.git added bessel_1.c + modified Makefile --- diff --git a/Makefile b/Makefile index b368059..ad5c1cf 100644 --- 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 index 0000000..afc0a97 --- /dev/null +++ b/bessel_1.c @@ -0,0 +1,56 @@ +#include +#include +#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:lEPSILON) { + 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; +} + +