| > | restart;
|
Exercice 2
question a)
| > | Permut_ligne:=proc(i,j,A)
local B,k,t; t:=taille(A); B:=array(1..t[1],1..t[2]); B:=evalm(A); for k from 1 to t[2] do B[i,k]:=A[j,k]; B[j,k]:=A[i,k]; on ne modifie que la i-eme et j-eme lignes de B od; evalm(B); end: |
| > |
| > | question b) |
| > | Dilat_ligne:=proc(a,i,A)
local k,t,B; t:=taille(A); B:=array(1..t[1],1..t[2]); B:=evalm(A); for k from 1 to t[2] do B[i,k]:=a*A[i,k]; on ne modifie que la i-eme ligne de B od; evalm(B); end: |
| > |
| > | question c) |
| > | Transvect_ligne:=proc(i,a,j,A)
local k,t,B; t:=taille(A); B:=array(1..t[1],1..t[2]); B:=evalm(A); for k from 1 to t[2] do B[i,k]:=A[i,k]+a*A[j,k]; on ne modifie que la i-eme ligne de B od; evalm(B); end: |
| > |
| > |
| > | question d) |
| > | CherchePivot_colonne:=proc(A,i)
local t,k; t:=taille(A); if is(i>t[1])then RETURN(IMPOSSIBLE); fi; la procédure ne fonctionne que si l'indice i ne dépasse pas le nombre de colonnes for k from i to t[1] do if is(A[k,i]<>0) then RETURN(k); fi; renvoi le premier indice correspondant à un coefficent non nul à partir de aii dans la colonne i od; RETURN(0); sinon renvoi 0 end: |
| > |
question e)
| > | Permut_colonne:=proc(i,j,A)
local B,k,t; t:=taille(A); B:=array(1..t[1],1..t[2]); B:=evalm(A); for k from 1 to t[1] do B[k,i]:=A[k,j]; B[k,j]:=A[k,i]; on ne modifie que la i-eme et j-eme colonnes de B od; evalm(B); end: |
| > |