John Cremona on Sat, 14 Jan 2023 15:57:03 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: The companion matrix of a polynomial. |
Hi here,
In GAP, the following command can be used to compute a companion
matrix of the polynomial:
gap> A:=[ [ 1, -4, 0 ], [ 1, 0, -2 ], [ 3, 1, 0 ] ];;
gap> CompanionMat(A);
[ [ [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ], [ -1, 4, 0 ] ], [ [ [
1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ], [ -1, 0, 2 ] ] ]
When I try the similar operation in GP, the corresponding error will
be triggered:
? A=[ 1, -4, 0; 1, 0, -2; 3, 1, 0 ]
%1 =
[1 -4 0]
[1 0 -2]
[3 1 0]
? matcompanion(A)
*** at top-level: matcompanion(A)
*** ^---------------
*** matcompanion: incorrect type in matcompanion (t_MAT).
*** Break loop: type 'break' to go back to GP prompt
break>
Any tips for doing this in GP?
Regards,
Zhao
--
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province