import numpy as np A = np.array([[3,1],[-1,2]] ,float) b = np.array([2,-2],float) import numpy as np N=input("N=?") # taille du probleme A=input("A=?") # lecture de la matrice A, p.ex. [[1,2],[3,4]] b=input("b=?") # lecture du vecteur b, p.ex. [0,1] # on définit A,b comme des arrays numpy A=np.asarray(A,float) b=np.asarray(b,float) # on ajoute b comme dernière colonne à A pour obtenir la matrice augmentée Ab Ab=np.column_stack((A,b)) # on verifie print("A=") print(A) print("b=") print(b) print("Ab=") print(Ab) x = np.linalg.solve(A, b) print(x) np.dot(A,b) # produit scalaire matrice vecteur ( c'est différent de A*b! ) np.sum(b) # sommation des composantes du vecteur b from IPython.core.display import HTML def css_styling(): styles = open('custom.css', 'r').read() return HTML(styles) css_styling()