Bonjour,
J'ai un petit problème avec un exercice d'info.
"calculer les déterminants suivants:
0 1 1 0
0 1 0 1 0 1 0 1 0
0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0
0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0
Donner une instruction Python qui construit cette matrice en taille n et qui en calcule le déterminant."
Je trouve respectivement pour les déterminants -1, 0, 1, 0.
Pour le code, c'est la partie création de la matrice de taille n qui me pose problème:
Pouvez-vous m'aider? Merci!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 import numpy as np import numpy.linalg as alg def MatriceDeTailleN(n): matrice=??? return(matrice) déterminant=np.linalg.det(matrice) return(déterminant)
Partager