mnspy 0.9.16__py3-none-any.whl → 0.9.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mnspy/ra/303/255ces/bisecci/303/263n.py +9 -11
- mnspy/ra/303/255ces/brent.py +42 -47
- mnspy/ra/303/255ces/falsa_posicion.py +10 -12
- mnspy/ra/303/255ces/muller.py +28 -34
- mnspy/ra/303/255ces/newton_raphson.py +5 -3
- mnspy/ra/303/255ces/punto_fijo.py +5 -4
- mnspy/ra/303/255ces/raices.py +1 -1
- mnspy/ra/303/255ces/secante.py +8 -7
- {mnspy-0.9.16.dist-info → mnspy-0.9.17.dist-info}/METADATA +1 -1
- {mnspy-0.9.16.dist-info → mnspy-0.9.17.dist-info}/RECORD +13 -13
- {mnspy-0.9.16.dist-info → mnspy-0.9.17.dist-info}/WHEEL +0 -0
- {mnspy-0.9.16.dist-info → mnspy-0.9.17.dist-info}/licenses/LICENSE +0 -0
- {mnspy-0.9.16.dist-info → mnspy-0.9.17.dist-info}/top_level.txt +0 -0
|
@@ -88,17 +88,15 @@ class Biseccion(Raices):
|
|
|
88
88
|
print("La raíz no está dentro de este rango, pruebe con otro rango de datos")
|
|
89
89
|
sys.exit()
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
else:
|
|
101
|
-
self._x_max = self.x
|
|
91
|
+
self.x = (self._x_min + self._x_max) / 2
|
|
92
|
+
if self._fin_iteracion():
|
|
93
|
+
return
|
|
94
|
+
elif np.sign(self._f(self._x_min)) == np.sign(self._f(self.x)):
|
|
95
|
+
self._x_min = self.x
|
|
96
|
+
self._calcular()
|
|
97
|
+
elif np.sign(self._f(self._x_max)) == np.sign(self._f(self.x)):
|
|
98
|
+
self._x_max = self.x
|
|
99
|
+
self._calcular()
|
|
102
100
|
|
|
103
101
|
def graficar(self, mostrar_sol: bool = True, mostrar_iter: bool = True, mostrar_lin_iter: bool = True,
|
|
104
102
|
n_puntos: int = 100):
|
mnspy/ra/303/255ces/brent.py
CHANGED
|
@@ -99,53 +99,48 @@ class Brent(Raices):
|
|
|
99
99
|
"signos diferentes")
|
|
100
100
|
sys.exit()
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
self.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
x_a, x_b = x_b, x_a
|
|
145
|
-
y_a, y_b = y_b, y_a
|
|
146
|
-
|
|
147
|
-
self._val = x_a, x_b, x_c
|
|
148
|
-
self._val_f = y_a, y_b, y_c
|
|
102
|
+
x_a, x_b, x_c = self._val
|
|
103
|
+
y_a, y_b, y_c = self._val_f
|
|
104
|
+
x_d = 0
|
|
105
|
+
self._x_min = min([x_a, x_b])
|
|
106
|
+
self._x_max = max([x_a, x_b])
|
|
107
|
+
if len(self._val_f) == len(set(self._val_f)):
|
|
108
|
+
# si los y son diferentes se usa el método de la cuadrática inversa
|
|
109
|
+
self.x = x_a * y_b * y_c / ((y_a - y_b) * (y_a - y_c)) + x_b * y_a * y_c / (
|
|
110
|
+
(y_b - y_a) * (y_b - y_c)) + x_c * y_a * y_b / ((y_c - y_a) * (y_c - y_b))
|
|
111
|
+
else:
|
|
112
|
+
# Se usa el método de la falsa posición
|
|
113
|
+
self.x = (y_a * x_b - y_b * x_a) / (y_a - y_b)
|
|
114
|
+
if (self.x - (3 * x_a + x_b) / 4) * (self.x - x_b) >= 0 or (
|
|
115
|
+
self._biseccion_usada and abs(self.x - x_b) >= abs(x_b - x_c) / 2) or (
|
|
116
|
+
not self._biseccion_usada and abs(self.x - x_b) >= abs(x_c - x_d) / 2):
|
|
117
|
+
self.x = (x_a + x_b) / 2
|
|
118
|
+
self._biseccion_usada = True
|
|
119
|
+
else:
|
|
120
|
+
self._biseccion_usada = False
|
|
121
|
+
y_x = self._f(self.x)
|
|
122
|
+
# x_d = x_c # TODO Revisar el código esta variable porque no se usa
|
|
123
|
+
x_c = x_b
|
|
124
|
+
y_c = y_b
|
|
125
|
+
if np.sign(y_a) == np.sign(y_x):
|
|
126
|
+
x_a = self.x
|
|
127
|
+
y_a = y_x
|
|
128
|
+
else:
|
|
129
|
+
x_b = self.x
|
|
130
|
+
y_b = y_x
|
|
131
|
+
if abs(y_a) < abs(y_b):
|
|
132
|
+
x_t = x_a
|
|
133
|
+
y_t = y_a
|
|
134
|
+
x_a = x_b
|
|
135
|
+
y_a = y_b
|
|
136
|
+
x_b = x_t
|
|
137
|
+
y_b = y_t
|
|
138
|
+
self._val = x_a, x_b, x_c
|
|
139
|
+
self._val_f = y_a, y_b, y_c
|
|
140
|
+
if self._fin_iteracion():
|
|
141
|
+
return
|
|
142
|
+
else:
|
|
143
|
+
self._calcular()
|
|
149
144
|
|
|
150
145
|
def graficar(self, mostrar_sol: bool = True, mostrar_iter: bool = True, mostrar_lin_iter: bool = False,
|
|
151
146
|
n_puntos: int = 100):
|
|
@@ -86,18 +86,16 @@ class FalsaPosicion(Raices):
|
|
|
86
86
|
print("La raíz no está dentro de este rango, pruebe con otro rango de datos")
|
|
87
87
|
sys.exit()
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
else:
|
|
100
|
-
self._x_max = self.x
|
|
89
|
+
self.x = self._x_max - (self._f(self._x_max) * (self._x_min - self._x_max)) / (
|
|
90
|
+
self._f(self._x_min) - self._f(self._x_max))
|
|
91
|
+
if self._fin_iteracion():
|
|
92
|
+
return
|
|
93
|
+
elif np.sign(self._f(self._x_min)) == np.sign(self._f(self.x)):
|
|
94
|
+
self._x_min = self.x
|
|
95
|
+
self._calcular()
|
|
96
|
+
elif np.sign(self._f(self._x_max)) == np.sign(self._f(self.x)):
|
|
97
|
+
self._x_max = self.x
|
|
98
|
+
self._calcular()
|
|
101
99
|
|
|
102
100
|
def graficar(self, mostrar_sol: bool = True, mostrar_iter: bool = True, mostrar_lin_iter: bool = True,
|
|
103
101
|
n_puntos: int = 100):
|
mnspy/ra/303/255ces/muller.py
CHANGED
|
@@ -88,40 +88,34 @@ class Muller(Raices):
|
|
|
88
88
|
-------
|
|
89
89
|
None
|
|
90
90
|
"""
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
self.
|
|
119
|
-
|
|
120
|
-
if self._fin_iteracion():
|
|
121
|
-
break # Convergencia o máximo de iteraciones alcanzado
|
|
122
|
-
|
|
123
|
-
# Actualizar los puntos para la siguiente iteración
|
|
124
|
-
self._x_0_i, self._x_1_i, self._x_2_i = self._x_1_i, self._x_2_i, self.x
|
|
91
|
+
h_0 = self._x_1_i - self._x_0_i
|
|
92
|
+
h_1 = self._x_2_i - self._x_1_i
|
|
93
|
+
d_0 = (self._f(self._x_1_i) - self._f(self._x_0_i)) / h_0
|
|
94
|
+
d_1 = (self._f(self._x_2_i) - self._f(self._x_1_i)) / h_1
|
|
95
|
+
a = (d_1 - d_0) / (h_1 + h_0)
|
|
96
|
+
b = a * h_1 + d_1
|
|
97
|
+
c = self._f(self._x_2_i)
|
|
98
|
+
# ***
|
|
99
|
+
self._a_2 += [a]
|
|
100
|
+
self._a_1 += [d_0]
|
|
101
|
+
self._a_0 += [self._f(self._x_0_i)]
|
|
102
|
+
self._list_x_0 += [self._x_0_i]
|
|
103
|
+
self._list_x_1 += [self._x_1_i]
|
|
104
|
+
self._list_x_2 += [self._x_2_i]
|
|
105
|
+
# ***
|
|
106
|
+
rad = np.sqrt(b ** 2 - 4 * a * c)
|
|
107
|
+
if abs(b + rad) > abs(b - rad):
|
|
108
|
+
den = b + rad
|
|
109
|
+
else:
|
|
110
|
+
den = b - rad
|
|
111
|
+
self.x = self._x_2_i - 2 * c / den
|
|
112
|
+
if self._fin_iteracion():
|
|
113
|
+
return
|
|
114
|
+
else:
|
|
115
|
+
self._x_0_i = self._x_1_i
|
|
116
|
+
self._x_1_i = self._x_2_i
|
|
117
|
+
self._x_2_i = self.x
|
|
118
|
+
self._calcular()
|
|
125
119
|
|
|
126
120
|
def graficar(self, mostrar_sol: bool = True, mostrar_iter: bool = True, mostrar_lin_iter: bool = True,
|
|
127
121
|
n_puntos: int = 100):
|
|
@@ -117,9 +117,11 @@ class NewtonRaphson(Raices):
|
|
|
117
117
|
-------
|
|
118
118
|
None
|
|
119
119
|
"""
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
self.x -= self._f(self.x) / self._df(self.x)
|
|
121
|
+
if self._fin_iteracion():
|
|
122
|
+
return
|
|
123
|
+
else:
|
|
124
|
+
self._calcular()
|
|
123
125
|
|
|
124
126
|
def graficar(self, mostrar_sol: bool = True, mostrar_iter: bool = True, mostrar_lin_iter: bool = True,
|
|
125
127
|
n_puntos: int = 100):
|
|
@@ -74,10 +74,11 @@ class PuntoFijo(Raices):
|
|
|
74
74
|
-------
|
|
75
75
|
None
|
|
76
76
|
"""
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
self.x += self._f(self.x) - self.x
|
|
78
|
+
if self._fin_iteracion():
|
|
79
|
+
return
|
|
80
|
+
else:
|
|
81
|
+
self._calcular()
|
|
81
82
|
|
|
82
83
|
def graficar(self, mostrar_sol: bool = True, mostrar_iter: bool = True, mostrar_lin_iter: bool = True,
|
|
83
84
|
n_puntos: int = 100):
|
mnspy/ra/303/255ces/raices.py
CHANGED
|
@@ -82,7 +82,7 @@ class Raices:
|
|
|
82
82
|
Tipo de error a utilizar para la convergencia:
|
|
83
83
|
- ``'%'``: Error relativo porcentual (por defecto).
|
|
84
84
|
- ``'/'``: Error relativo.
|
|
85
|
-
- ``'n'``: Número de cifras significativas.
|
|
85
|
+
- ``'n'``: Número de cifras significativas. εs = (0.5 * 10^(2-n)) % (Scarborough, 1966)
|
|
86
86
|
"""
|
|
87
87
|
self._f = f
|
|
88
88
|
self._tol = tol
|
mnspy/ra/303/255ces/secante.py
CHANGED
|
@@ -80,13 +80,14 @@ class Secante(Raices):
|
|
|
80
80
|
-------
|
|
81
81
|
None
|
|
82
82
|
"""
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
self.x -= (self._f(self._x_1_i) * (self._x_1_i - self._x_0_i)) / (
|
|
84
|
+
self._f(self._x_1_i) - self._f(self._x_0_i))
|
|
85
|
+
self._x_0_i = self._x_1_i
|
|
86
|
+
self._x_1_i = self.x
|
|
87
|
+
if self._fin_iteracion():
|
|
88
|
+
return
|
|
89
|
+
else:
|
|
90
|
+
self._calcular()
|
|
90
91
|
|
|
91
92
|
def graficar(self, mostrar_sol: bool = True, mostrar_iter: bool = True, mostrar_lin_iter: bool = True,
|
|
92
93
|
n_puntos: int = 100):
|
|
@@ -53,18 +53,18 @@ mnspy/interpolación/inter_spline_cubica.py,sha256=1oBT-t5zVB5RrLx6BkUWweKdwVwI_
|
|
|
53
53
|
mnspy/interpolación/inter_spline_lineal.py,sha256=-UZUBcTLKIZqZw2ZZd2qIyxJK2Q4dqlZxRBdz-0jvuY,5196
|
|
54
54
|
mnspy/interpolación/interpolacion.py,sha256=gV7OoLzGbN-p1L3vr-cXhoYd13vysVpLXpg8JujwfAc,1695
|
|
55
55
|
mnspy/raíces/__init__.py,sha256=8_8u3bPEoHjh804bNVZVbNM2UOv-RiC7TmzCrz6zHCc,1497
|
|
56
|
-
mnspy/raíces/bisección.py,sha256=
|
|
57
|
-
mnspy/raíces/brent.py,sha256=
|
|
58
|
-
mnspy/raíces/falsa_posicion.py,sha256=
|
|
59
|
-
mnspy/raíces/muller.py,sha256=
|
|
60
|
-
mnspy/raíces/newton_raphson.py,sha256=
|
|
61
|
-
mnspy/raíces/punto_fijo.py,sha256=
|
|
62
|
-
mnspy/raíces/raices.py,sha256=
|
|
63
|
-
mnspy/raíces/secante.py,sha256=
|
|
56
|
+
mnspy/raíces/bisección.py,sha256=JHP8o48I58NWNAQwEDUfzotMTJsY4ZkyHaET_fd1AlE,5638
|
|
57
|
+
mnspy/raíces/brent.py,sha256=RwGSRcAeFp-Qy8XMmcEU6UqEcNb0RP1UYdmVMMiXngs,6689
|
|
58
|
+
mnspy/raíces/falsa_posicion.py,sha256=NAqgo9_U1XkWtUc9s9lcV4IpJ_-vxw_3b5p9pzDOQvs,5371
|
|
59
|
+
mnspy/raíces/muller.py,sha256=XkXLk99TrW_0hYam5CrzrmSJi6fJx-KhhaRL7_xLzcs,5886
|
|
60
|
+
mnspy/raíces/newton_raphson.py,sha256=HccOD0TZovQEzBi16Rcsg7gc7tvlrWPNplcpGDL6g04,6431
|
|
61
|
+
mnspy/raíces/punto_fijo.py,sha256=XCRl-rUsuMkYy2baptXT_wPXBLGht-r2_qegAKwv8xo,4635
|
|
62
|
+
mnspy/raíces/raices.py,sha256=GF6QTry--5piS5F2kw0gSnElNEBajdez-tZB8gQOkZM,17556
|
|
63
|
+
mnspy/raíces/secante.py,sha256=mLYNV4dwy2BLveAlehSVdqiAlY0-ORT-tEDlWbjvs3Y,5082
|
|
64
64
|
mnspy/raíces/secante_modificada.py,sha256=0bLgcG8K_O6Ras3vKBIQpUdDlB69tWKHbx_fE8-47SE,5105
|
|
65
65
|
mnspy/raíces/wegstein.py,sha256=23HQ6QuelMNo8S8W1fzha8ozbcy_NdsjK5XLMaH-m38,5397
|
|
66
|
-
mnspy-0.9.
|
|
67
|
-
mnspy-0.9.
|
|
68
|
-
mnspy-0.9.
|
|
69
|
-
mnspy-0.9.
|
|
70
|
-
mnspy-0.9.
|
|
66
|
+
mnspy-0.9.17.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
67
|
+
mnspy-0.9.17.dist-info/METADATA,sha256=twCh69elQkudvd9rk65dmONJMOyh3pPgVVJRFAjE0tY,4641
|
|
68
|
+
mnspy-0.9.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
69
|
+
mnspy-0.9.17.dist-info/top_level.txt,sha256=fbooZdZwS41I8vFuAXnn5qL4_mfc1aPt_DM60ZpvtKE,6
|
|
70
|
+
mnspy-0.9.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|