octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #53897] poly of conjugate complex pairs should

 From: Rik Subject: [Octave-bug-tracker] [bug #53897] poly of conjugate complex pairs should return a real polynomial Date: Sat, 13 Oct 2018 12:37:01 -0400 (EDT) User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0

```Update of bug #53897 (project octave):

Status:                    None => Need Info

_______________________________________________________

Follow-up Comment #1:

The algorithm in poly.m uses a for loop and repeated multiplications.  It
could be something as simple as, with the inversion of matrices, using
balance() to put the largest factors first, etc.

In this example, if I use sort on the input x then the conjugates are paired
and the result of poly is entirely real without spurious imaginary terms.

See the session below

octave:25> n = 3;
octave:26> fr = 436;
octave:27> x = 1i * 2 * pi * fr * [-n:-1 1:n]
x =

-0.0 - 8218.4i     -0.0 - 5478.9i     -0.0 - 2739.5i      0.0 + 2739.5i
0.0 + 5478.9i      0.0 + 8218.4i

octave:28> N = poly (x)
N =

Columns 1 through 6:

1.0000e+00 + 0.0000e+00i   0.0000e+00 - 1.8190e-12i   1.0507e+08 +
0.0000e+00i   0.0000e+00 + 1.8311e-04i   2.7597e+15 + 0.0000e+00i   0.0000e+00
+ 2.5600e+02i

Column 7:

1.5216e+22 + 0.0000e+00i

octave:29> x2 = sort (x)
x2 =

-0.0 - 2739.5i      0.0 + 2739.5i     -0.0 - 5478.9i      0.0 + 5478.9i
-0.0 - 8218.4i      0.0 + 8218.4i

octave:30> N2 = poly (x2)
N2 =

1.0000e+00   0.0000e+00   1.0507e+08   0.0000e+00   2.7597e+15   0.0000e+00
1.5216e+22

octave:31> roots (N2)
ans =

-0.0 + 8218.4i
-0.0 - 8218.4i
-0.0 + 5478.9i
-0.0 - 5478.9i
-0.0 + 2739.5i
-0.0 - 2739.5i

Should we just sort the input vector 'v' after the input validation in
poly.m?

_______________________________________________________

<https://savannah.gnu.org/bugs/?53897>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

```