Examples for 'base::polyroot'


Find Zeros of a Real or Complex Polynomial

Aliases: polyroot

Keywords: math

### ** Examples

polyroot(c(1, 2, 1))
[1] -1-0i -1+0i
round(polyroot(choose(8, 0:8)), 11) # guess what!
[1] -1+0i -1+0i -1+0i -1+0i -1+0i -1+0i -1+0i -1+0i
for (n1 in 1:4) print(polyroot(1:n1), digits = 4)
complex(0)
[1] -0.5+0i
[1] -0.3333+0.4714i -0.3333-0.4714i
[1] -0.0721+0.6383i -0.6058-0.0000i -0.0721-0.6383i
polyroot(c(1, 2, 1, 0, 0)) # same as the first
[1] -1-0i -1+0i

[Package base version 4.2.3 Index]