import numpy as np # numpy es para numeros (no cadenas u objetos) n = 3 m = 2 print(np.empty((n, m))) # Matriz vacĂ­a, con valores residuales de la memoria print(np.zeros((n, m))) # Matriz de ceros print(np.ones((n, m))) # Matriz de unos print(np.zeros((3, 3, 3))) print(np.arange(27).reshape((3, 3, 3))) # matriz multidimensional import numpy as np # Use numpy.allclose() to check if two arrays are equal # to each other within a tolerance. print(np.allclose([1e10, 1e-7], [1.00001e10, 1e-8])) print(np.allclose([1e10, 1e-8], [1.00001e10, 1e-9])) # Use numpy.isclose() to check if the elements of two arrays # are equal to each other within a tolerance print(np.isclose([1e10, 1e-7], [1.00001e10, 1e-8])) print(np.isclose([1e10, 1e-8], [1.00001e10, 1e-9])) import pytest import numpy as np np.array([0.1, 0.2]) + np.array([0.2, 0.4]) == pytest.approx(np.array([0.3, 0.6])) print({"a": 0.1 + 0.2, "b": 0.2 + 0.4} == pytest.approx({"a": 0.3, "b": 0.6}))