Macaulay2 » Documentation
Packages » Macaulay2Doc :: diagonalMatrix(Ring,ZZ,ZZ,List)
next | previous | forward | backward | up | index | toc

diagonalMatrix(Ring,ZZ,ZZ,List) -- make a diagonal matrix from a list

Synopsis

Description

i1 : R = QQ[a..d];
i2 : diagonalMatrix{a,b,c,3/4}

o2 = | a 0 0 0   |
     | 0 b 0 0   |
     | 0 0 c 0   |
     | 0 0 0 3/4 |

             4      4
o2 : Matrix R  <-- R
i3 : diagonalMatrix(3,5,{a,b,3/4})

o3 = | a 0 0   0 0 |
     | 0 b 0   0 0 |
     | 0 0 3/4 0 0 |

             3      5
o3 : Matrix R  <-- R
i4 : diagonalMatrix(R,{1,2,3})

o4 = | 1 0 0 |
     | 0 2 0 |
     | 0 0 3 |

             3      3
o4 : Matrix R  <-- R

See also

Ways to use this method: