Re: [R] Fwd: Re: Nonlinear equation

From: Ravi Varadhan <rvaradhan_at_jhmi.edu>
Date: Wed, 02 Apr 2008 11:48:28 -0400

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: rvaradhan_at_jhmi.edu

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



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

> > >From: robert-mcfadden@o2.pl
> > >Date: 2008/04/02 Wed AM 09:58:28 CDT
> > >To: r-help_at_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_at_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_at_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. Received on Wed 02 Apr 2008 - 15:53:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Apr 2008 - 16:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive