From: hackbard Date: Tue, 2 Dec 2003 10:47:57 +0000 (+0000) Subject: added polynom_interpolation,fixes inintegral-*, updated Makefile and cvsignore file X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=8fc948825d4563572a1172aba6c0b998bc1d907c;p=physik%2Fcomputational_physics.git added polynom_interpolation,fixes inintegral-*, updated Makefile and cvsignore file --- diff --git a/.cvsignore b/.cvsignore index dc86506..9fddb52 100644 --- a/.cvsignore +++ b/.cvsignore @@ -3,3 +3,6 @@ newton zentral homogen +integral-1_2 +integral-2_2 +polynom_interpolation diff --git a/Makefile b/Makefile index 3ba14bb..a806075 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CFLAGS = -O3 -Wall LIBS = -L/usr/lib -lm API = g_plot.o -OBJS = newton zentral homogen +OBJS = newton zentral homogen integral-1_2 integral-2_2 polynom_interpolation all: $(OBJS) @@ -24,6 +24,9 @@ integral-1_2: $(API) integral-2_2: $(API) $(CC) $(CFLAGS) -o $@ $(API) $(LIBS) integral-2_2.c +polynom_interpolation: $(API) + $(CC) $(CFLAGS) -o $@ $(API) $(LIBS) polynom_interpolation.c + clean: rm $(API) $(OBJS) diff --git a/integral-1_2.c b/integral-1_2.c index be9a749..c286121 100644 --- a/integral-1_2.c +++ b/integral-1_2.c @@ -6,7 +6,7 @@ int main(int argc,char **argv) { double p_N; double p; int start; - int i,j; + int i; if(argc!=3) { printf("usage: %s \n",argv[0]); diff --git a/integral-2_2.c b/integral-2_2.c index 2c8a317..472a6c1 100644 --- a/integral-2_2.c +++ b/integral-2_2.c @@ -6,7 +6,7 @@ int main(int argc,char **argv) { double p_N; double p; int steps; - int i,j; + int i; if(argc!=2) { printf("usage: %s \n",argv[0]); diff --git a/polynom_interpolation.c b/polynom_interpolation.c new file mode 100644 index 0000000..587faa9 --- /dev/null +++ b/polynom_interpolation.c @@ -0,0 +1,64 @@ +#define _GNU_SOURCE +#include +#include +#include +#include "g_plot.h" +#include + +#define I_START 5 +#define I_END 20 +#define I_LENGTH (I_END - I_START) +#define N_I 3 + +int main(int argc,char **argv) { + double *buf,*buf_i; + int N; + double step,step_i; + double x,x_i,x_j,x_k,w; + int i,j,k,l; + char file[64]; + int fd; + + if(argc!=2) { + printf("usage: %s \n",argv[0]); + return 1; + } + + N=atoi(argv[1]); + step=(double)I_LENGTH/(N+1); + + /* savefile init */ + strcpy(file,"polynom_interpolation.plot"); + fd=gp_init(file); + + /* calculate fixpoints */ + buf=(double *)malloc((N+2)*sizeof(double)); + for(i=0;i