|\^/| Maple 2022 (X86 64 LINUX) ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2022 \ MAPLE / All rights reserved. Maple is a trademark of <____ ____> Waterloo Maple Inc. | Type ? for help. > GetSymMat := proc(n,x) > local A,i,j,k; > A := Matrix(n,n); > k := 1; > for i to n do > A[i,i] := x[k]; k++; > for j from i+1 to n do > A[i,j] := x[k]; > A[j,i] := x[k]; > k++; > od; > od; > A; > end: > numterms := proc(f) > if f=0 then 0 elif type(f,`+`) then nops(f) else 1 fi; > end: > with(LinearAlgebra): # Test > S3 := GetSymMat(3,x); [x[1] x[2] x[3]] [ ] S3 := [x[2] x[4] x[5]] [ ] [x[3] x[5] x[6]] > det := Determinant(S3); 2 2 2 det := x[1] x[4] x[6] - x[1] x[5] - x[2] x[6] + 2 x[2] x[3] x[5] - x[3] x[4] > numterms(det); 5 > for n from 3 to 9 do > Sn := GetSymMat(n,x); > det := Determinant(Sn); > printf("n=%d #det(Sn)=%d\n",n,numterms(det)); > od: n=3 #det(Sn)=5 n=4 #det(Sn)=17 n=5 #det(Sn)=73 n=6 #det(Sn)=388 n=7 #det(Sn)=2461 n=8 #det(Sn)=18155 memory used=300.8MB, alloc=270.2MB, time=2.21 n=9 #det(Sn)=152531 > quit memory used=458.3MB, alloc=316.9MB, time=3.04