[Scilab-users] improve accuracy of roots

Federico Miyara fmiyara at fceia.unr.edu.ar
Thu Jan 10 00:31:44 CET 2019


Dear all,

Consider this code:

// Define polynomial variable
p = poly(0, 'p', 'roots');

// Define fourth degree polynomial
R = (1 + p)^4;

// Find its roots
z = roots(R)

The result (Scilab 6.0.1) is

  z  =

   -1.0001886
   -1. + 0.0001886i
   -1. - 0.0001886i
   -0.9998114

It should be something closer to

   -1.
   -1.
   -1.
   -1.

Using these roots

C = coeff((p-z(1))*(p-z(2))*(p-z(3))*(p-z(4)))

yield seemingly accurate coefficients
  C  =

    1.   4.   6.   4.   1.


but

C - [1  4  6 4 1]

shows the actual error:

ans  =

    3.775D-15   1.243D-14   1.155D-14   4.441D-15   0.

This is acceptable for the coefficients, but the error in the roots is 
too large. Somehow the errors cancel out when  assembling back the 
polynomial but each individual zero should be closer to the theoretical 
value

Is there some way to improve the accuracy?

Regards,

Federico Miyara




---
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus




More information about the users mailing list