rs = seq(23, 26, length.out=100) real_pt = c() for( r in rs ){ pr = polyroot( c(160*(r-1), 8*(r+10), 41, 3) ) crt_1 = pr[1] # by inspection these are the two complex roots crt_2 = pr[3] real_pt = c(real_pt, Re(pr[1])) } plot(rs, real_pt, type='l', xlab='r', ylab='real part of root') abline(h=0, col='red') grid()