Bill Allombert on Wed, 06 Apr 2022 11:47:56 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Problem with mateigen() command.


n Wed, Apr 06, 2022 at 08:56:25AM +0000, Venkataraman Subramaniam wrote:
> The mateigen gives wrong answer for the input [1,0,-1;0,1,0;-1,0,-1]
> Pari]  m=[1,0,-1;0,1,0;-1,0,-1]
> 
> %1 = (
> 1  0 -1
> 0  1 0
> -1 0 -1
> )
> Pari]  mateigen(m)
> 
> 
> %2 = (
> 0 0.41421356237309504880168872420969807857 -2.4142135623730950488016887242096980786
> 1 0                                        0
> 0 1                                        1
> )

Hello Venkataraman,
Would you elaborate what is wrong exactly  ?

? M=[1,0,-1;0,1,0;-1,0,-1]
%1 =
[ 1 0 -1]

[ 0 1  0]

[-1 0 -1]

? P=mateigen(M)
%2 =
[0 0.41421356237309504880168872420969807857 -2.4142135623730950488016887242096980786]

[1                                        0 0]

[0                                        1 1]

? P^-1*M*P
%3 =
[1                                        0 0]

[0 -1.4142135623730950488016887242096980786 -5.877471754111437540 E-39]

[0                7.346839692639296925 E-40 1.4142135623730950488016887242096980786]


This seems good to me ?
If you want also the eigenvalues, you can use mateigen(M,1).

If you like to avoid floating points, you can check matfrobenius
that gives the Frobenius form of the matrix.

(maybe we could have a variant of mateigen that returns polmod instead of complex).

Cheers,
Bill.