projects
/
physik
/
computational_physics.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
added polynom_interpolation,fixes inintegral-*, updated Makefile and cvsignore file
[physik/computational_physics.git]
/
integral-1_2.c
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <math.h>
4
5
int main(int argc,char **argv) {
6
double p_N;
7
double p;
8
int start;
9
int i;
10
11
if(argc!=3) {
12
printf("usage: %s <start> <startwert>\n",argv[0]);
13
return 1;
14
}
15
16
start=atoi(argv[1]);
17
p_N=atof(argv[2]);
18
19
for(i=start;i>=0;i--) {
20
p=(1/((double)i+1))*(M_E-p_N);
21
printf("p_%d = %f\n",i,p);
22
p_N=p;
23
}
24
25
return 1;
26
}