Skip to content
Prev 318558 / 398503 Next

solving x in a polynomial function

Hi guys,

Perhaps on the right track? However, not sure if it's correct. I fixed
the bug that A.K. indicated above (== vs =), but the values don't seem
right. From the original data, an a of 3 should give b of 2.5.
+         is.zero <- function(x, tol = .Machine$double.eps^0.5) abs(x) < tol
+         if(names(model)[1] == "(Intercept)")
+                 r <- polyroot(c(coef(model)[1] - b, coef(model)[-1]))
+         else
+                 r <- polyroot(c(-b, coef(model)))
+         Re(r[is.zero(Im(r))])
+ }
1
1.69

So I think there's a calculation error somehwere.
On 3/1/13, arun <smartpink111 at yahoo.com> wrote: