Here is an approach using optim().

fn <- function(x, A, B) {
(2*lgamma(x) + lgamma(2*x)+ (x-1)*A + B)^2
}

ans <- optim(par=1, fn, A=1.5, B=1.0, method="BFGS")

You should plug in your values for A and B.  Make sure that the function
value returned ny optim, i.e. ans$val, is close to zero.  If not, try a
different starting value.

Ravi.
----------------------------------------------------------------------------
-------

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 

----------------------------------------------------------------------------
--------


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2008 11:25 AM
To: r-help@r-project.org
Subject: [R] Fwd: Re: Nonlinear equation

> > >From: [EMAIL PROTECTED]
> > >Date: 2008/04/02 Wed AM 09:58:28 CDT
> > >To: r-help@r-project.org
> > >Subject: [R] Nonlinear equation
> > 
> > hi: you need to give an example and details or
> > you won't get much response, if any.

Equation e.g. (A, B are known constants):
3log(gamma(x))-log(gamma(x)*gamma(2x))+(x-1)*A+B=0

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to