Skip to content
Prev 166688 / 398502 Next

How to get solution of following polynomial?

RON70 <ron_michael70 <at> yahoo.com> writes:
Ravi means 'PolynomF' which is an improved version of the old polynomial
package.

You do not need to recreate the polynomial from points. Instead, calculate 
the exact polynomial:

    library(PolynomF)
    z <- polynom()

    p11 <- 1 - A1[1,1]*z - A2[1,1]*z^2 - A3[1,1]*z^3 - A4[1,1]*z^4
    # ...
    p <- p11*p22 - p12*p21

There is probably a shorter way to generate these four polynoms p11, ..., p22.
Anyway, the result is

    p
    # 1 - 1.18*x + 0.2777*x^2 - 0.2941*x^3 - 0.1004*x^4 + 0.3664*x^5 -
    #     0.0636*x^6 + 0.062*x^7 - 0.068*x^8

    solve(p)
    # [1] -1.365976+0.000000i -0.737852-1.639581i -0.737852+1.639581i
    # [4] -0.012071-1.287727i -0.012071+1.287727i  1.000000+0.000000i
    # [7]  1.388794-0.281841i  1.388794+0.281841i

and the real solutions are 1.0 and -1.365976 !

Regards,  Hans Werner