<jupyter_start><jupyter_text>Sistema de ecuaciones<jupyter_code>import numpy as np

m_list = [[4,3], [-5,9]]
A = np.array(m_list)

A

# 4x + 3y = 20
# -5x + 9y = 26


np.linalg.inv(A)
inv_A = np.linalg.inv(A)
print(inv_A)
B = np.array([20,26])
X = np.linalg.inv(A).dot(B)

X
B
np.linalg.inv(A)<jupyter_output><empty_output><jupyter_text>Usando solve4x + 3y + 2z = 25-2x + 2y +3z = -103x -5y +2z = -4<jupyter_code>A = np.array([[4,3,2],[-2,2,3],[3,-5,2]])
B = np.array([25,-10,-4])
X = np.linalg.solve(A,B)
X<jupyter_output><empty_output><jupyter_text>Ecuaciones de segundo gradox^2 + -3x -18 = 0<jupyter_code>coeff = [1,-3,-18]
np.roots(coeff)
np.arange(0,9)
np.ones(9)
import matplotlib.pyplot as plt
x = np.arange(0,9)
A = np.array([X,np.ones(9)])
A
y = [19,20,20.5,21.5,22,23,23,25.5,47]
print( A.T, y ) 

w = np.linalg.lstsq(A.T,y)[0]
w
line = w[0]*x + w[1]
line
print(x,line)
plt.plot(x,line,'r-')
plt.plot(x,y,'o')
plt.show()<jupyter_output><empty_output><jupyter_text>Crear una lista de puntos, a partir de dos arrays<jupyter_code>pos = np.array([1,2,3,4,5])
neg = np.array([-1,-2,-3,-4,-5])
pos = np.array([1,2,3,4,5])
np.column_stack((pos,neg))
np.c_[pos,neg]<jupyter_output><empty_output>