From: Matt J on
"Boby Philip" <philipboby(a)yahoo.co.in> wrote in message <i04pr9$fof$1(a)fred.mathworks.com>...
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i04osp$eul$1(a)fred.mathworks.com>...
> > "Boby Philip" <philipboby(a)yahoo.co.in> wrote in message <i043eh$4p3$1(a)fred.mathworks.com>...
> > > I face the problem of getting NaN values for characteristic polynomial coefficients when I use poly function of the matlab for a 270x270 sparse matrix. Plz suggest some ways to overcome this problem.
> > =================
> >
> > And you checked that nnz(~isfinite(YourMatrix)) is zero?
>
> Hi Matt
> ya,I have obtained it as zero..


And what about when you try

poly(eig(full(YourMatrix)))
From: John D'Errico on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i04t9e$ojt$1(a)fred.mathworks.com>...
> "Boby Philip" <philipboby(a)yahoo.co.in> wrote in message <i04pr9$fof$1(a)fred.mathworks.com>...
> > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i04osp$eul$1(a)fred.mathworks.com>...
> > > "Boby Philip" <philipboby(a)yahoo.co.in> wrote in message <i043eh$4p3$1(a)fred.mathworks.com>...
> > > > I face the problem of getting NaN values for characteristic polynomial coefficients when I use poly function of the matlab for a 270x270 sparse matrix. Plz suggest some ways to overcome this problem.
> > > =================
> > >
> > > And you checked that nnz(~isfinite(YourMatrix)) is zero?
> >
> > Hi Matt
> > ya,I have obtained it as zero..
>
>
> And what about when you try
>
> poly(eig(full(YourMatrix)))

The result of that operation is irrelevant, as it is impossible
to obtain this polynomial in a meaningful form in double
precision. For example, for a smaller problem than that
posed by the op, try this:

n = 100;
E = sort(rand(n,1),'descend');
[E,roots(poly(E))]
ans =
0.99756 2.814 + 0.25859i
0.97913 2.814 - 0.25859i
0.97273 2.6951 + 0.71081i
0.97126 2.6951 - 0.71081i
0.95417 2.4606 + 1.0752i
0.93603 2.4606 - 1.0752i
0.93448 2.1488 + 1.3404i
0.92736 2.1488 - 1.3404i
0.92233 2.4661
0.91749 1.8055 + 1.4951i
0.90636 1.8055 - 1.4951i
0.89589 1.4726 + 1.5556i
0.89445 1.4726 - 1.5556i
....

It works nicely of course for small n, on the order of 5 or so.
But for n = 270, complete, meaningless crapola.

John
From: Matt J on
"Boby Philip" <philipboby(a)yahoo.co.in> wrote in message <i043eh$4p3$1(a)fred.mathworks.com>...
> I face the problem of getting NaN values for characteristic polynomial coefficients when I use poly function of the matlab for a 270x270 sparse matrix. Plz suggest some ways to overcome this problem.
=============

The problem seems to occur, even for small matrices, whenever you have very large matrix entries with correspondingly large eigenvalues. The conversion of eigenvalues to polynomial coefficients involves subtraction operations that get contaminated by overflow. This results in NaNs and other nonfinite ceofficient values, as in the following example,

A=rand(3)-.5;
Abig=10^200*A;

>>poly(Abig)

ans =

1.0e+198 *

0.0000 -6.2965 NaN Inf


Post-normalization will not help, as the following shows. You would at minimum need to prevent the matrix entries from ever getting that big

>> poly(Abig/max(abs(Abig))), poly(A)

ans =

1.0000 -0.2091 -0.0791 0.0171


ans =

1.0000 -0.0630 -0.1478 0.0043
From: Matt J on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i05abh$gne$1(a)fred.mathworks.com>...

> Post-normalization will not help, as the following shows. You would at minimum need to prevent the matrix entries from ever getting that big
>
> >> poly(Abig/max(abs(Abig))), poly(A)
================

Forget it. The normalization should have been as follows, which seems to be fine.

>> poly(Abig*A(1)/Abig(1)),poly(A)

ans =

1.0000 -0.7861 0.2318 -0.0217


ans =

1.0000 -0.7861 0.2318 -0.0217
From: Boby Philip on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i05bbc$jro$1(a)fred.mathworks.com>...
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i05abh$gne$1(a)fred.mathworks.com>...
>
> > Post-normalization will not help, as the following shows. You would at minimum need to prevent the matrix entries from ever getting that big
> >
> > >> poly(Abig/max(abs(Abig))), poly(A)
> ================
>
> Forget it. The normalization should have been as follows, which seems to be fine.
>
> >> poly(Abig*A(1)/Abig(1)),poly(A)
>
> ans =
>
> 1.0000 -0.7861 0.2318 -0.0217
>
>
> ans =
>
> 1.0000 -0.7861 0.2318 -0.0217
%%%%%%%%%%%%%%%%%%%%
Hi Matt,
??? Error using ==> eig
NaN or Inf prevents convergence.

Error in ==> poly at 26
e = eig(x);
this is the message I get when i executed above command