Changeset 4889a2 in git
 Timestamp:
 Jan 19, 1999, 11:34:26 AM (25 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 7dc74ad56f66b202480c84d6188177a90e61065a
 Parents:
 f6c713380f345a494946449c99a39906eb272086
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/jordan.lib
rf6c7133 r4889a2 1 1 /////////////////////////////////////////////////////////////////////////////// 2 2 3 version="$Id: jordan.lib,v 1. 5 19990112 08:53:23mschulze Exp $";3 version="$Id: jordan.lib,v 1.6 19990119 10:34:26 mschulze Exp $"; 4 4 info=" 5 5 LIBRARY: jordan.lib PROCEDURES TO COMPUTE THE JORDAN NORMAL FORM … … 7 7 email: mschulze@mathematik.unikl.de 8 8 9 jordan(M[,opt]); eigenvalues and corresponding jordan block size vectors 10 of the constant part of the square matrix M and 11 a jordan basis for the constant part of M 12 jordanmatrix(eb); jordan matrix with eigenvalues eb[1] and corresponding 13 jordan block size vectors eb[2] 14 jordanform(M); jordan normal form of the constant part 15 of the square matrix M 16 invmat(U); inverse matrix of the invertible constant part 17 of the matrix U 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 18 15 "; 19 16 … … 22 19 23 20 proc jordan(matrix M,list #) 24 USAGE: <list<ideal,list<intvec>,module>> ret=jordan(<matrix> M[,<int> opt=0]);25 ASSUME: characteristic polynomial of the constant part of M completely26 factorizable 27 RETURN: eigenvalues ret[1] and, if opt<2, corresponding jordan block28 size vectors ret[2] of the constant part of M and, if opt>0,29 a jordan basis ret[3] for the constant part of M 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 30 27 EXAMPLE: example jordan; shows an example 31 28 { … … 53 50 // get multiplicities mM 54 51 def eM,mM=l[1..2]; 55 kill l; 56 57 // test if factorization complete 52 53 // test if eigenvalues in the coefficient field 58 54 int i; 59 55 for(i=size(eM);i>=1;i) … … 62 58 { 63 59 kill pr; 64 "// unable to factorize characteristic polynomial";60 "//eigenvalues not in the coefficient field"; 65 61 return(); 66 62 } … … 96 92 kill e,m; 97 93 98 // checkoption parameter94 // get option parameter 99 95 int opt=0; 100 96 if(size(#)>0) … … 112 108 module sNi; 113 109 list K; 114 if(opt> 0)110 if(opt>=1) 115 111 { 116 112 module V,K1,K2; 117 113 matrix v[n][1]; 118 114 } 119 if(opt< 2)115 if(opt<=1) 120 116 { 121 117 list bM; … … 136 132 } 137 133 138 if(opt< 2)134 if(opt<=1) 139 135 { 140 136 // compute jordan block size vector corresponding to eigenvalue eM[i] … … 151 147 } 152 148 153 if(opt> 0)149 if(opt>=1) 154 150 { 155 151 // compute generating vectors for jordan basis vectors corresponding to … … 184 180 185 181 // create return list 186 list ret=eM;187 if(opt< 2)188 { 189 ret[2]=bM;190 } 191 if(opt> 0)192 { 193 ret[3]=V;194 } 195 196 return( ret);182 list d=eM; 183 if(opt<=1) 184 { 185 d[2]=bM; 186 } 187 if(opt>=1) 188 { 189 d[3]=V; 190 } 191 192 return(d); 197 193 } 198 194 example … … 207 203 /////////////////////////////////////////////////////////////////////////////// 208 204 209 proc jordanmatrix(list eb)210 USAGE: <matrix> J=jordanmatrix(<list<ideal,list<intvec>> eb);211 RETURN: jordan matrix J with eigenvalues eb[1] and corresponding212 jordan block size vectors eb[2]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] 213 209 EXAMPLE: example jordanmatrix; shows an example 214 210 { 215 211 // check parameters 216 if(size( eb)<2)212 if(size(d)<2) 217 213 { 218 214 "//not enough entries in argument list"; 219 215 return(); 220 216 } 221 def eJ,bJ=eb[1..2]; 217 def eJ,bJ=d[1..2]; 218 kill d; 222 219 if(typeof(eJ)!="ideal") 223 220 { … … 239 236 } 240 237 241 // get size of Jordan matrix238 // get size of jordan matrix 242 239 int i,j,k,n; 243 240 for(i=s;i>=1;i) … … 245 242 if(typeof(bJ[i])!="intvec") 246 243 { 247 "//second entry in argument list not a list of int vecs";244 "//second entry in argument list not a list of integer vectors"; 248 245 return(); 249 246 } … … 262 259 matrix J[n][n]; 263 260 264 // create Jordan matrix261 // create jordan matrix 265 262 int l; 266 263 for(i,l=1,1;i<=s;i++) … … 295 292 296 293 proc jordanform(matrix M) 297 USAGE: <matrix> J=jordanform(<matrix> M);298 ASSUME: characteristic polynomial of the constant part of M completely299 factorizable 300 RETURN: jordan normal form J of the constant part of M 294 USAGE: jordanform(M); M constant square matrix 295 ASSUME: eigenvalues of M in the coefficient field 296 RETURN: jordan normal form of M 297 NOTE: non constant M is replaced by its constant part 301 298 EXAMPLE: example jordanform; shows an example 302 299 { … … 314 311 /////////////////////////////////////////////////////////////////////////////// 315 312 316 proc invmat(matrix U) 317 USAGE: <matrix> invU=invmat(<matrix> U); 318 ASSUME: constant part of U invertible 319 RETURN: inverse matrix invU of the constant part of U 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 320 318 EXAMPLE: example invmat; shows an example 321 319 { 322 320 // test if square matrix 323 int n=nrows( U);324 if(n!=ncols( U))321 int n=nrows(M); 322 if(n!=ncols(M)) 325 323 { 326 324 "//no square matrix"; … … 331 329 def br=basering; 332 330 map zero=br,0; 333 U=zero(U);331 M=zero(M); 334 332 335 333 // compute inverse 336 return(lift( U,freemodule(n)));334 return(lift(M,freemodule(n))); 337 335 } 338 336 example … … 341 339 echo=2; 342 340 ring R=0,x,dp; 343 matrix U[3][3]=3,2,1,0,2,1,0,0,3;344 print( U);345 print(invmat( U));346 } 347 /////////////////////////////////////////////////////////////////////////////// 341 matrix M[3][3]=3,2,1,0,2,1,0,0,3; 342 print(M); 343 print(invmat(M)); 344 } 345 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.