From e0f00c13eac7c9f9ae735bb7928057fc1445b056 Mon Sep 17 00:00:00 2001 From: hackbard Date: Wed, 5 Nov 2003 12:24:49 +0000 Subject: [PATCH] integral-1_2.c added, rueckwearst rekursion (N...0) --- integral-1_2.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 integral-1_2.c diff --git a/integral-1_2.c b/integral-1_2.c new file mode 100644 index 0000000..e49100b --- /dev/null +++ b/integral-1_2.c @@ -0,0 +1,28 @@ +#include +#include +#include + +int main(int argc,char **argv) { + double p_N; + double p; + int start; + int i,j; + + if(argc!=3) { + printf("usage: %s \n",argv[0]); + return 1; + } + + start=atoi(argv[1]); + p_N=atof(argv[2]); + + printf("debug: N=%d startwert=%f\n",start,p_N); + + for(i=start;i>=0;i--) { + p=(1/((double)i+1))*(M_E-p_N); + printf("p_%d = %f\n",i,p); + p_N=p; + } + + return 1; +} -- 2.39.2