LIBS = -L/usr/lib -lm
API = g_plot.o
-OBJS = newton zentral homogen integral-1_2 integral-2_2 polynom_interpolation
+OBJS = newton zentral homogen integral-1_2 integral-2_2 polynom_interpolation kettenbruchentwicklung
all: $(OBJS)
polynom_interpolation: $(API)
$(CC) $(CFLAGS) -o $@ $(API) $(LIBS) polynom_interpolation.c
+kettenbruchentwicklung: $(API)
+ $(CC) $(CFLAGS) -o $@ $(API) $(LIBS) kettenbruchentwicklung.c
+
clean:
rm $(API) $(OBJS)
--- /dev/null
+#include <stdio.h>
+#include <math.h>
+#include "g_plot.h"
+
+#define INT .5
+#define GENAUIGKEIT .5
+#define GENAUIGKEIT_2 (GENAUIGKEIT*GENAUIGKEIT)
+#define PI M_PI
+
+int main(int argc,char **argv) {
+ double f_n=0,f_a=0;
+ double A,A_1,A_2;
+ double B,B_1,B_2;
+ double a=0;
+ int i;
+ double x;
+ int fd;
+
+ /* parse command line */
+ if(argc!=2) {
+ printf("usage:\n");
+ printf("%s plotfile\n",argv[0]);
+ return -1;
+ }
+
+ /* main init */
+ x=0;
+ fd=gp_init(argv[1]);
+
+ /* x loop */
+ while(x<4*PI) {
+
+ /* init */
+ A_1=0; A_2=x; A=x;
+ B_1=1; B_2=0; B=1;
+ i=1;
+ f_n=0;
+ f_n=f_a+2.0*GENAUIGKEIT;
+ /* loop bis y genuaigkeit */
+ while(!(((f_n-f_a)*(f_n-f_a))<GENAUIGKEIT_2)){
+ f_a=f_n;
+ i++;
+ a=(i>>1)*(i>>1)*x;
+ A=i*A_1+a*A_2;
+ B=i*B_1+a*B_2;
+ f_n=A/B;
+ }
+ printf("debug: x=%f, y=%f bei N=%d (a=%f)\n",x,f_n,i,a);
+ gp_add_data(fd,&f_n,1,1,TYPE_DOUBLE);
+ x+=INT;
+ }
+ gp_close(fd);
+ return 1;
+}
+