Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Exercice 1
- M=matrix(ZZ,[[2,2,3],[4,-1,7],[3,-2,5]])
- M
- M.nrows()
- M.ncols()
- N1=M;
- N1.swap_rows(1,2);
- M
- N2=copy(M)
- N2.swap_rows(1,2);
- M
- #Exercice 2
- A=matrix(ZZ,[[3,6,9,9,15],[15,20,25,-10,10],[11,32,43,-10,22],[-6,0,1,-1,-1]])
- A
- A_H,u=A.hermite_form(transformation=True)
- A_H
- u
- u*A
- At=A.transpose()
- AtH,v=At.hermite_form(transformation=True)
- show(AtH.transpose(),v.transpose())
- A*v.transpose()
- # rg Imf=3 engendré par les vecteurs (3,0,0,-1),(0,5,1,-3),(0,0,2,1)
- #Ker f est engendré par les deux dernières colonnes de v (18,0,98,131,-141),(0,1,0,1,-1)
- A.right_kernel()
- Y=vector([6,-5,-1,1])
- A\Y
- X=vector([4/5,-81/10,29/5,0,0])
- A*X
- I=matrix(ZZ,[[1,0],[0,1]])
- w=vector([7,3])
- w_second=w_prime
- w_second
- w_second[0],w_second[1]=w_second[1],w_second[0]
- w_second
- #Exercice 3
- def matricedetransvection(q):
- return(matrix(ZZ,[[1,-q],[0,1]]))
- def ReductionColonne2mieux(v):
- I=matrix(ZZ,[[1,0],[0,1]])
- J=matrix(ZZ,[[0,1],[1,0]])
- if v[1]==0:
- return(v,I)
- if v[0]==0:
- v[0],v[1]=v[1],v[0]
- return(v,J)
- if v[0]<0:
- v[0]=-v[0]
- I=I*matrix(ZZ,[[-1,0],[0,1]])
- if v[1]<0:
- v[1]=-v[1]
- I=I*matrix(ZZ,[[1,0],[0,-1]])
- if v[0]==v[1]:
- L=matrix(ZZ,[[1,0],[-1,1]])
- res=L*v
- return(L*I,res)
- if v[0]<v[1]:
- v[0],v[1]=v[1],v[0]
- t=v.coefficients()
- q=t[0]//t[1]
- r=t[0]%t[1]
- while r!=0:
- L=matricedetransvection(q)
- I=L*I
- v=L*v
- v[0],v[1]=v[1],v[0]
- I=J*I
- t=v.coefficients()
- q=t[0]//t[1]
- r=t[0]%t[1]
- L=matricedetransvection(q)
- v=L*v
- I=L*I
- v[0],v[1]=v[1],v[0]
- I=J*I
- return(v,I)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement