Changeset 0657ac in git


Ignore:
Timestamp:
Feb 11, 1999, 9:52:42 AM (25 years ago)
Author:
Mathias Schulze <mschulze@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
f42bbc7d3e29953c86a6d6c819e2b85e2a0bd9a3
Parents:
8fefd9a73cb2587c8343e8b511c2fd41f9574eb1
Message:
*mschulze: new option opt=-1 for jordan


git-svn-id: file:///usr/local/Singular/svn/trunk@2836 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/jordan.lib

    r8fefd9 r0657ac  
    11///////////////////////////////////////////////////////////////////////////////
    22
    3 version="$Id: jordan.lib,v 1.6 1999-01-19 10:34:26 mschulze Exp $";
     3version="$Id: jordan.lib,v 1.7 1999-02-11 08:52:42 mschulze Exp $";
    44info="
    55LIBRARY: 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
     6AUTHOR:  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
    1512";
    1613
     
    1815///////////////////////////////////////////////////////////////////////////////
    1916
     17///////////////////////////////////////////////////////////////////////////////
     18// PROCEDURE: jordan  A PROCEDURE TO COMPUTE THE JORDAN NORMAL FORM          //
     19// AUTHOR:    Mathias Schulze, email: mschulze@mathematik.uni-kl.de          //
     20///////////////////////////////////////////////////////////////////////////////
     21
    2022proc 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
     24ASSUME:  the eigenvalues of M are in the coefficient field
     25RETURN:  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]
     34NOTE:    a non constant polynomial matrix M is replaced by its constant part
    2735EXAMPLE: example jordan; shows an example
     36"
    2837{
    2938  // test if square matrix
     
    5059  // get multiplicities mM
    5160  def eM,mM=l[1..2];
     61  kill l;
    5262
    5363  // test if eigenvalues in the coefficient field
     
    101111    }
    102112  }
     113  if(opt<0)
     114  {
     115    return(list(eM));
     116  }
    103117
    104118  // define needed variables
     
    134148    if(opt<=1)
    135149    {
    136       // compute jordan block size vector corresponding to eigenvalue eM[i]
     150      // compute Jordan block size vector corresponding to eigenvalue eM[i]
    137151      bMi=0;
    138152      bMi[size(K[2])]=0;
     
    149163    if(opt>=1)
    150164    {
    151       // compute generating vectors for jordan basis vectors corresponding to
     165      // compute generating vectors for Jordan basis vectors corresponding to
    152166      // eigenvalue eM[i]
    153167      if(size(K)>1)
     
    162176      }
    163177
    164       // compute jordan basis vectors corresponding to eigenvalue eM[i] from
     178      // compute Jordan basis vectors corresponding to eigenvalue eM[i] from
    165179      // generating vectors
    166180      for(j=size(K);j>=2;j--)
     
    178192    }
    179193  }
     194  kill l;
    180195
    181196  // create return list
    182   list d=eM;
     197  list l=eM;
    183198  if(opt<=1)
    184199  {
    185     d[2]=bM;
     200    l[2]=bM;
    186201  }
    187202  if(opt>=1)
    188203  {
    189     d[3]=V;
    190   }
    191 
    192   return(d);
     204    l[3]=V;
     205  }
     206
     207  return(l);
    193208}
    194209example
     
    203218///////////////////////////////////////////////////////////////////////////////
    204219
    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]
     220proc jordanmatrix(list l)
     221"USAGE:   jordanmatrix(l); l list of ideal and list of intvecs
     222RETURN:  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]
    209225EXAMPLE: example jordanmatrix; shows an example
     226"
    210227{
    211228  // check parameters
    212   if(size(d)<2)
     229  if(size(l)<2)
    213230  {
    214231    "//not enough entries in argument list";
    215232    return();
    216233  }
    217   def eJ,bJ=d[1..2];
    218   kill d;
     234  def eJ,bJ=l[1..2];
     235  kill l;
    219236  if(typeof(eJ)!="ideal")
    220237  {
     
    236253  }
    237254
    238   // get size of jordan matrix
     255  // get size of Jordan matrix
    239256  int i,j,k,n;
    240257  for(i=s;i>=1;i--)
     
    259276  matrix J[n][n];
    260277
    261   // create jordan matrix
     278  // create Jordan matrix
    262279  int l;
    263280  for(i,l=1,1;i<=s;i++)
     
    292309
    293310proc jordanform(matrix 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
     311"USAGE:   jordanform(M); M constant square matrix
     312ASSUME:  the eigenvalues of M are in the coefficient field
     313RETURN:  the Jordan normal form of M
     314NOTE:    a non constant polynomial matrix M is replaced by its constant part
    298315EXAMPLE: example jordanform; shows an example
     316"
    299317{
    300318  return(jordanmatrix(jordan(M)));
     
    311329///////////////////////////////////////////////////////////////////////////////
    312330
    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
     331proc inversemat(matrix M)
     332"USAGE:   inversemat(M); M constant square matrix
     333ASSUME:  M is invertible
     334RETURN:  the inverse matrix of M
     335NOTE:    a non constant polynomial matrix M is replaced by its constant part
     336EXAMPLE: example inversemat; shows an example
     337"
    319338{
    320339  // test if square matrix
     
    341360  matrix M[3][3]=3,2,1,0,2,1,0,0,3;
    342361  print(M);
    343   print(invmat(M));
    344 }
    345 ///////////////////////////////////////////////////////////////////////////////
     362  print(inversemat(M));
     363}
     364///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.