-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInt_con_limites_variables
75 lines (59 loc) · 1.34 KB
/
Int_con_limites_variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from matplotlib import pyplot
import numpy as np
import math
from scipy import integrate
#Tenemos la integral (x + 3y +1) Y tenemos la funcion (X^2 + y^2 = 16)
dA = 1
coordinates = []
b = 1
for x in range(1,4,1):
y = (16 - x ** 2) ** 0.5
y = math.floor(y)
for b in range(y):
coordinates.append((x, b+1))
data = np.array(coordinates)
print(coordinates)
x, y = data.T
f = lambda x,y: x +3*y + 1
Suma=sum(dA * f(x, y))
print(int(Suma))
#Ponemos un plot con la funcion
# Definimos la funcion que queremos calcular
def f1(x):
return (16-x**2)**0.5
def f2(x):
return 0
# Valores del eje X que toma el gráfico.
x = range(-10, 15)
# Graficar ambas funciones.
pyplot.plot(x, [f1(i) for i in x])
pyplot.plot(x, [f2(i) for i in x])
# Establecer el color de los ejes.
pyplot.axhline(0, color="black")
pyplot.axvline(0, color="black")
# Limitar los valores de los ejes.
pyplot.xlim(0, 5)
pyplot.ylim(0, 5)
#gridline
pyplot.grid()
datax = np.array([
[1, 1],
[1, 2],
[1, 3],
[2, 3],
[2, 1],
[2, 2],
[3, 1],
[3, 2],
[1, 3.87298335],
[2, 3.46410162],
[3, 2.64575131],
])
x, y = datax.T
pyplot.scatter(x,y)
# Guardar gráfico como imágen PNG.
pyplot.savefig("output.png")
# Mostrarlo.
pyplot.show()
#Recursos
#https://activecalculus.org/multi/S-11-1-Double-Integrals-Rectangles.html