Commit 4cf2adfd9e1c6daf50a736d45c51118420839aa7
0 parents
first session
Showing
3 changed files
with
51 additions
and
0 deletions
Show diff stats
1 | +++ a/exe2,3.py | |
... | ... | @@ -0,0 +1,16 @@ |
1 | +r = 3 | |
2 | +x=0,5; | |
3 | +f=(r+1)*x-r*(x*x); | |
4 | +def f1(x): | |
5 | + f1=(r+1)*x-r*(x*x); | |
6 | + | |
7 | +i = 0; | |
8 | +for i in range(0,500): | |
9 | + f1(x) | |
10 | + x= f1(x); | |
11 | + | |
12 | + | |
13 | +print(x) | |
14 | + | |
15 | +#exo2.4 | |
16 | +# on va sortir de la boucle avant de tester est ce qu'elle egale a 0 | |
0 | 17 | \ No newline at end of file | ... | ... |
1 | +++ a/exercice2,2.py | |
... | ... | @@ -0,0 +1,16 @@ |
1 | +z = (3.11*2.3)*1.5; | |
2 | +y = 3.11*(2.3*1.5); | |
3 | +print(z) | |
4 | +print(y) | |
5 | +#we expcet the same result | |
6 | +# we got 10.7295 , 10.729499999999998 c'est pas le meme rendu | |
7 | + | |
8 | +o = 1.11+(3.33+5.50); | |
9 | +p = (1.11+3.33)+5.50; | |
10 | +print(o); | |
11 | +print(p); | |
12 | +# le meme resultat pour les deux operations | |
13 | +# 9.94 9.940000000000001 , c'est pas la meme precision pour les deux resultats | |
14 | + | |
15 | + | |
16 | + | ... | ... |
1 | +++ a/exercice2.1.py | |
... | ... | @@ -0,0 +1,19 @@ |
1 | +#0.1 est non representable | |
2 | +x= 0.1 ; | |
3 | +print(x) | |
4 | +print("% .25f" %x) | |
5 | + | |
6 | +y=0.2; | |
7 | +z= x+y; | |
8 | +print(z) | |
9 | +#0.3 | |
10 | +#.30000000000000004 | |
11 | + #laprecision est beaucoup mieux | |
12 | + #s qu'on a des calculs complexe la merge d'erreur augmante plus de zero# | |
13 | +p=2.675; | |
14 | +print(round(p,2)) | |
15 | + | |
16 | +#2.85 | |
17 | + | |
18 | + | |
19 | + | |
0 | 20 | \ No newline at end of file | ... | ... |