I would like to solve the following function in R: G <- function(k) (2*(1 - k)*(1 + 2*k)^.5)/(1+3*k) I want to be able to find "k" for a given "G" Thanks! Francois Aucoin [[alternative HTML version deleted]]
On Mon, Jun 2, 2008 at 4:31 PM, Fran?ois Aucoin <frank.aucoin at gmail.com> wrote:> I would like to solve the following function in R: > > G <- function(k) (2*(1 - k)*(1 + 2*k)^.5)/(1+3*k) > > I want to be able to find "k" for a given "G"Consider G(k)-g. With plot look for intervals where the roots lie in. Afterwards, use uniroot to get the roots. Paul
Fran?ois Aucoin <frank.aucoin <at> gmail.com> writes:> > I would like to solve the following function in R: > > G <- function(k) (2*(1 - k)*(1 + 2*k)^.5)/(1+3*k) >G <- function(k) (2*(1 - k)*(1 + 2*k)^.5)/(1+3*k) GZero <-function(k,G0) G(k)-G0 plot(1:100,G(1:100)) uniroot(GZero,c(0,100),G=-5) Dieter