Re: [R] simple problems

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu, 6 Dec 2007 18:42:06 -0500

On Dec 6, 2007 6:13 PM, Emmanuel Charpentier <charpent_at_bacbuc.dyndns.org> wrote:
> Gabor Grothendieck a écrit :
> > On Dec 6, 2007 3:26 PM, marciarr <marcia.rocha_at_gmail.com> wrote:
>
> [ Snip.... ]
>
> >> 2- how do I solve a simple equation? Considering the equation y= exp(-x)^12,
> >> I would like to find the values of x for, for example, y=0.01, so
> >> exp(-x)^12=0.01. How do I do that using R?
> >> I know those a probably very, very simple questions, but for which I do not
> >> seem to find the answer.
> >
> > Search between 0 and 1 for the root of the indicated function:
> >
> > uniroot(function(x) 0.1 - exp(-x)^12, 0:1)
>
> I beg your pardon ?
>
> I'd rather use high-school algebra/analysis :
> log(exp(-x)^12)=log(0.01)
> 12log(exp(-x)=log(0.01)
> -12x=log(0.01)
> x=-log(0.01)/12=log(100)/12
>
> Rushing for a sophisticated numerical tool without thinking for an
> explicit solution is easy, fast, lazy (I do that every day ...), but
> deprives you of the process of understanding the problem.
>

The posting instructions ask for minimal code and its likely that the poster did not literally mean that that was the eventual problem.



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 Thu 06 Dec 2007 - 23:45:41 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 Fri 07 Dec 2007 - 00:30:18 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.