. |
. |
xxxxxxxxxx
from math import *
def trigo(k):
u = 0.5
v = sqrt(3)/2
for i in range(0,k):
u = sqrt(2)*u/(2*sqrt(v+1))
v = sqrt(2)*sqrt(v+1)/2
return [u,v]
def encadrement(k):
X = trigo(k)
sin = X[0]
cos = X[1]
n =6*2**k
return [n*sin*cos , n*sin/cos]
print "n = ",6*2**1
print "sinus et cosinus"
print trigo(1)
print "Encadrement"
print encadrement(1)
print ""
print "n = ",6*2**5
print "sinus et cosinus"
print trigo(5)
print "Encadrement"
print encadrement(5)
print ""
print "n = ",6*2**17
print "sinus et cosinus"
print trigo(17)
print "Encadrement"
print encadrement(17)
print ""
xxxxxxxxxx
def ml(n):
s = 1.0
for i in range(1,n):
s = s+((-1)**i)/(2.0*i+1)
return 4*s
print ml(10)
print ml(100)
print ml(1000)
print ml(10000)
xxxxxxxxxx
from math import *
def bale(n):
s = 1
for i in range(2,n+1):
s = s + 1.0/(i*i)
return sqrt(6*s)
print bale(10)
print bale(100)
print bale(1000)
print bale(10000)
xxxxxxxxxx
def machin(n):
s = 951.0/1195
for i in range(1,n):
s = s + (-1)**i/(2.0*i+1)*( 4/(5.0**(2*i+1)) - 1/(239.0**(2*i+1)) )
return 4*s
print machin(1)
print machin(2)
print machin(3)
print machin(7)
print machin(8)