projects
/
physik
/
computational_physics.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e0f00c1
)
added integral-2_2.c aufwaerts rekursion (0...N)
author
hackbard
<hackbard>
Wed, 5 Nov 2003 12:31:41 +0000
(12:31 +0000)
committer
hackbard
<hackbard>
Wed, 5 Nov 2003 12:31:41 +0000
(12:31 +0000)
integral-1_2.c
patch
|
blob
|
history
integral-2_2.c
[new file with mode: 0644]
patch
|
blob
diff --git
a/integral-1_2.c
b/integral-1_2.c
index
e49100b
..
be9a749
100644
(file)
--- a/
integral-1_2.c
+++ b/
integral-1_2.c
@@
-16,8
+16,6
@@
int main(int argc,char **argv) {
start=atoi(argv[1]);
p_N=atof(argv[2]);
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);
for(i=start;i>=0;i--) {
p=(1/((double)i+1))*(M_E-p_N);
printf("p_%d = %f\n",i,p);
diff --git a/integral-2_2.c
b/integral-2_2.c
new file mode 100644
(file)
index 0000000..
2c8a317
--- /dev/null
+++ b/
integral-2_2.c
@@ -0,0
+1,26
@@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+int main(int argc,char **argv) {
+ double p_N;
+ double p;
+ int steps;
+ int i,j;
+
+ if(argc!=2) {
+ printf("usage: %s <steps>\n",argv[0]);
+ return 1;
+ }
+
+ steps=atoi(argv[1]);
+ p_N=M_E-1;
+
+ for(i=0;i<=steps;i++) {
+ printf("p_%d = %f\n",i,p_N);
+ p=M_E-i*p_N;
+ p_N=p;
+ }
+
+ return 1;
+}