]> hackdaworld.org Git - physik/computational_physics.git/commitdiff
integral-1_2.c added, rueckwearst rekursion (N...0)
authorhackbard <hackbard>
Wed, 5 Nov 2003 12:24:49 +0000 (12:24 +0000)
committerhackbard <hackbard>
Wed, 5 Nov 2003 12:24:49 +0000 (12:24 +0000)
integral-1_2.c [new file with mode: 0644]

diff --git a/integral-1_2.c b/integral-1_2.c
new file mode 100644 (file)
index 0000000..e49100b
--- /dev/null
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+int main(int argc,char **argv) {
+ double p_N;
+ double p;
+ int start;
+ int i,j;
+
+ if(argc!=3) { 
+  printf("usage: %s <start> <startwert>\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;
+}