In [1]:
import math
In [2]:
math.pi
Out[2]:
In [3]:
math.sqrt(25)
Out[3]:
In [4]:
sqrt(25)
In [5]:
25**0.5
Out[5]:
In [7]:
n = int(input("Introduzca el numero de intervalos: "))
In [8]:
area = 0
for i in range(n):
print(i/n, (i+1)/n)
finf = math.sqrt(1-(i/n)**2)
fsup = math.sqrt(1-((i+1)/n)**2)
# Le sumo al area cada area de los trapecios
area += (finf+fsup)/(2*n)
print(area)
In [9]:
math.pi/4
Out[9]:
In [ ]: