Changeset 0657ac in git
- Timestamp:
- Feb 11, 1999, 9:52:42 AM (25 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- f42bbc7d3e29953c86a6d6c819e2b85e2a0bd9a3
- Parents:
- 8fefd9a73cb2587c8343e8b511c2fd41f9574eb1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/jordan.lib
r8fefd9 r0657ac 1 1 /////////////////////////////////////////////////////////////////////////////// 2 2 3 version="$Id: jordan.lib,v 1. 6 1999-01-19 10:34:26mschulze Exp $";3 version="$Id: jordan.lib,v 1.7 1999-02-11 08:52:42 mschulze Exp $"; 4 4 info=" 5 5 LIBRARY: jordan.lib PROCEDURES TO COMPUTE THE JORDAN NORMAL FORM 6 by Mathias Schulze 7 email: mschulze@mathematik.uni-kl.de 8 9 jordan(M[,opt]); eigenvalues, corresponding jordan block size vectors, 10 and jordan basis of constant square matrix M 11 jordanmatrix(d); jordan matrix with eigenvalues d[1] and corresponding 12 jordan block size vectors d[2] 13 jordanform(M); jordan normal form of constant square matrix M 14 invmat(M); inverse matrix of invertible constant matrix M 6 AUTHOR: Mathias Schulze, email: mschulze@mathematik.uni-kl.de 7 8 jordan(M[,opt]); eigenvalues, Jordan block sizes, transformation matrix of M 9 jordanmatrix(l); Jordan matrix with eigenvalues l[1], Jordan block sizes l[2] 10 jordanform(M); Jordan normal form of constant square matrix M 11 inversemat(M); inverse matrix of invertible constant matrix M 15 12 "; 16 13 … … 18 15 /////////////////////////////////////////////////////////////////////////////// 19 16 17 /////////////////////////////////////////////////////////////////////////////// 18 // PROCEDURE: jordan A PROCEDURE TO COMPUTE THE JORDAN NORMAL FORM // 19 // AUTHOR: Mathias Schulze, email: mschulze@mathematik.uni-kl.de // 20 /////////////////////////////////////////////////////////////////////////////// 21 20 22 proc jordan(matrix M,list #) 21 USAGE: jordan(M[,opt]); M constant square matrix, opt integer 22 ASSUME: eigenvalues of M in the coefficient field 23 RETURN: list with first entry the eigenvalues of of M, second entry, 24 if opt<=1, the list of corresponding jordan block size vectors of M, 25 and third entry, if opt>=1, a jordan basis of M 26 NOTE: non constant M is replaced by its constant part 23 "USAGE: jordan(M[,opt]); M constant square matrix, opt integer 24 ASSUME: the eigenvalues of M are in the coefficient field 25 RETURN: a list l with 3 entries of type ideal, list of intvecs, matrix with 26 l[1] : eigenvalues of M 27 l[2][i][j] : size of j-th Jordan block with eigenvalue l[1][i] 28 l[3] : transformation matrix U with U^(-1)*M*U in Jordan normal form 29 which entries of l are computed depends on opt: 30 opt=-1 : compute l[1] 31 opt= 0 : compute l[1] and l[2] (default) 32 opt= 1 : compute l[1],l[2] and l[3] 33 opt= 2 : compute l[1] and l[3] 34 NOTE: a non constant polynomial matrix M is replaced by its constant part 27 35 EXAMPLE: example jordan; shows an example 36 " 28 37 { 29 38 // test if square matrix … … 50 59 // get multiplicities mM 51 60 def eM,mM=l[1..2]; 61 kill l; 52 62 53 63 // test if eigenvalues in the coefficient field … … 101 111 } 102 112 } 113 if(opt<0) 114 { 115 return(list(eM)); 116 } 103 117 104 118 // define needed variables … … 134 148 if(opt<=1) 135 149 { 136 // compute jordan block size vector corresponding to eigenvalue eM[i]150 // compute Jordan block size vector corresponding to eigenvalue eM[i] 137 151 bMi=0; 138 152 bMi[size(K[2])]=0; … … 149 163 if(opt>=1) 150 164 { 151 // compute generating vectors for jordan basis vectors corresponding to165 // compute generating vectors for Jordan basis vectors corresponding to 152 166 // eigenvalue eM[i] 153 167 if(size(K)>1) … … 162 176 } 163 177 164 // compute jordan basis vectors corresponding to eigenvalue eM[i] from178 // compute Jordan basis vectors corresponding to eigenvalue eM[i] from 165 179 // generating vectors 166 180 for(j=size(K);j>=2;j--) … … 178 192 } 179 193 } 194 kill l; 180 195 181 196 // create return list 182 list d=eM;197 list l=eM; 183 198 if(opt<=1) 184 199 { 185 d[2]=bM;200 l[2]=bM; 186 201 } 187 202 if(opt>=1) 188 203 { 189 d[3]=V;190 } 191 192 return( d);204 l[3]=V; 205 } 206 207 return(l); 193 208 } 194 209 example … … 203 218 /////////////////////////////////////////////////////////////////////////////// 204 219 205 proc jordanmatrix(list d) 206 USAGE: jordanmatrix(d); d list of ideal and list of integer vectors 207 RETURN: jordan matrix with eigenvalues d[1] and corresponding jordan block 208 size vectors d[2] 220 proc jordanmatrix(list l) 221 "USAGE: jordanmatrix(l); l list of ideal and list of intvecs 222 RETURN: the Jordan matrix J with 223 l[1] : eigenvalues of J 224 l[2][i][j] : size of j-th Jordan block with eigenvalue l[1][i] 209 225 EXAMPLE: example jordanmatrix; shows an example 226 " 210 227 { 211 228 // check parameters 212 if(size( d)<2)229 if(size(l)<2) 213 230 { 214 231 "//not enough entries in argument list"; 215 232 return(); 216 233 } 217 def eJ,bJ= d[1..2];218 kill d;234 def eJ,bJ=l[1..2]; 235 kill l; 219 236 if(typeof(eJ)!="ideal") 220 237 { … … 236 253 } 237 254 238 // get size of jordan matrix255 // get size of Jordan matrix 239 256 int i,j,k,n; 240 257 for(i=s;i>=1;i--) … … 259 276 matrix J[n][n]; 260 277 261 // create jordan matrix278 // create Jordan matrix 262 279 int l; 263 280 for(i,l=1,1;i<=s;i++) … … 292 309 293 310 proc jordanform(matrix M) 294 USAGE: jordanform(M); M constant square matrix295 ASSUME: eigenvalues of Min the coefficient field296 RETURN: jordan normal form of M297 NOTE: non constantM is replaced by its constant part311 "USAGE: jordanform(M); M constant square matrix 312 ASSUME: the eigenvalues of M are in the coefficient field 313 RETURN: the Jordan normal form of M 314 NOTE: a non constant polynomial matrix M is replaced by its constant part 298 315 EXAMPLE: example jordanform; shows an example 316 " 299 317 { 300 318 return(jordanmatrix(jordan(M))); … … 311 329 /////////////////////////////////////////////////////////////////////////////// 312 330 313 proc invmat(matrix M) 314 USAGE: invmat(M); M constant square matrix 315 ASSUME: M invertible 316 RETURN: inverse matrix of M 317 NOTE: non constant M is replaced by its constant part 318 EXAMPLE: example invmat; shows an example 331 proc inversemat(matrix M) 332 "USAGE: inversemat(M); M constant square matrix 333 ASSUME: M is invertible 334 RETURN: the inverse matrix of M 335 NOTE: a non constant polynomial matrix M is replaced by its constant part 336 EXAMPLE: example inversemat; shows an example 337 " 319 338 { 320 339 // test if square matrix … … 341 360 matrix M[3][3]=3,2,1,0,2,1,0,0,3; 342 361 print(M); 343 print(inv mat(M));344 } 345 /////////////////////////////////////////////////////////////////////////////// 362 print(inversemat(M)); 363 } 364 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.