[R] solving x in a polynomial function

2013-03-01 Thread Mike Rennie
Hi there, Does anyone know how I solve for x from a given y in a polynomial function? Here's some example code: ##example file a-1:10 b-c(1,2,2.5,3,3.5,4,6,7,7.5,8) po.lm-lm(a~b+I(b^2)+I(b^3)+I(b^4)); summary(po.lm) (please ignore that the model is severely overfit- that's not the point).

Re: [R] solving x in a polynomial function

2013-03-01 Thread Jeff Newmiller
help.search(polynomial) --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live:

Re: [R] solving x in a polynomial function

2013-03-01 Thread Rui Barradas
Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8) dat - data.frame(a = a, b = b) # for lm(), it's better to use a df po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm) realroots - function(model, b){ is.zero - function(x, tol =

Re: [R] solving x in a polynomial function

2013-03-01 Thread arun
1, 2013 3:18 PM Subject: Re: [R] solving x in a polynomial function Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8) dat - data.frame(a = a, b = b)  # for lm(), it's better to use a df po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm) realroots

Re: [R] solving x in a polynomial function

2013-03-01 Thread Mike Rennie
- From: Rui Barradas ruipbarra...@sapo.pt To: Mike Rennie mikerenni...@gmail.com Cc: r-help Mailing List r-help@r-project.org Sent: Friday, March 1, 2013 3:18 PM Subject: Re: [R] solving x in a polynomial function Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8

Re: [R] solving x in a polynomial function

2013-03-01 Thread Peter Ehlers
-project.org Sent: Friday, March 1, 2013 3:18 PM Subject: Re: [R] solving x in a polynomial function Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8) dat - data.frame(a = a, b = b) # for lm(), it's better to use a df po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary

Re: [R] solving x in a polynomial function

2013-03-01 Thread Mike Rennie
, 2013 3:18 PM Subject: Re: [R] solving x in a polynomial function Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8) dat - data.frame(a = a, b = b) # for lm(), it's better to use a df po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm) realroots

Re: [R] solving x in a polynomial function

2013-03-01 Thread Mike Rennie
, 2013 3:18 PM Subject: Re: [R] solving x in a polynomial function Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8) dat - data.frame(a = a, b = b) # for lm(), it's better to use a df po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm

Re: [R] solving x in a polynomial function

2013-03-01 Thread William Dunlap
PM To: Peter Ehlers Cc: R help Subject: Re: [R] solving x in a polynomial function Hi Peter, With the edit you suggested, now I'm just getting back the value of a that I put in, not the expected value of b... cbind(a,b) a b [1,] 1 1.0 [2,] 2 2.0 [3,] 3 2.5 [4,] 4

Re: [R] solving x in a polynomial function

2013-03-01 Thread Rui Barradas
: r-help Mailing List r-help@r-project.org Sent: Friday, March 1, 2013 3:18 PM Subject: Re: [R] solving x in a polynomial function Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8) dat - data.frame(a = a, b = b) # for lm(), it's better to use a df po.lm - lm(a~b+I(b^2

Re: [R] solving x in a polynomial function

2013-03-01 Thread Rui Barradas
Message - From: Rui Barradas ruipbarra...@sapo.pt To: Mike Rennie mikerenni...@gmail.com Cc: r-help Mailing List r-help@r-project.org Sent: Friday, March 1, 2013 3:18 PM Subject: Re: [R] solving x in a polynomial function Hello, Try the following. a - 1:10 b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7