Home Online Manual
Top
Back: submat
Forward: tensor
FastBack: Linear algebra
FastForward: linalg_lib
Up: matrix_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.3.1.12 symmat

Procedure from library matrix.lib (see matrix_lib).

Usage:
symmat(n[,id]); n integer, id ideal

Return:
symmetric nxn matrix, with entries from id (default: id=maxideal(1))

Note:
if id has less than n*(n+1)/2 elements, the matrix is filled with 0's, symmat(n); creates the generic symmetric matrix

Example:
 
LIB "matrix.lib";
ring R=0,x(1..10),lp;
print(symmat(4));    // the generic symmetric matrix
==> x(1),x(2),x(3),x(4),
==> x(2),x(5),x(6),x(7),
==> x(3),x(6),x(8),x(9),
==> x(4),x(7),x(9),x(10)
ring R1 = 0,(a,b,c),dp;
matrix A=symmat(4,maxideal(1)^3);
print(A);
==> a3, a2b,a2c,ab2,
==> a2b,abc,ac2,b3, 
==> a2c,ac2,b2c,bc2,
==> ab2,b3, bc2,c3  
int n=3;
ideal i = ideal(randommat(1,n*(n+1) div 2,maxideal(1),9));
print(symmat(n,i));  // symmetric matrix of generic linear forms
==> 4a-8b-2c,-a+b-4c, -8a-9b+c,
==> -a+b-4c, a-9b+9c, 6a-5b+9c,
==> -8a-9b+c,6a-5b+9c,2a+8c    
kill R1;