[R] Memory leak in R v1.5.1?

Ravi Varadhan rvaradha at jhsph.edu
Tue Aug 6 19:27:10 CEST 2002


Try:

> silly.fn <- function(x) { (x[1]-5)^2 + (x[2]-2)^2 }
> optim( par=c(3,1) , silly.fn )

you'll get the correct answer.

Ravi.



----- Original Message -----
From: Adaikalavan Ramasamy <ramasamy at stats.ox.ac.uk>
Date: Tuesday, August 6, 2002 12:25 pm
Subject: Re: [R] Memory leak in R v1.5.1?

> Hi ! I am trying to minimise a function over 2 variables 
> simultaneously. Is
> this possible ? I have only recently been introduced to optim() and
> optimise() function. Here is simple example of what I tried to do :
> 
> silly.fn <- function(x,y) { (x-5)^2 + (y-2)^2 }
> optim( par=c(3,1) , silly.fn )
> 
> Analytically, the answer should be (5,2) but the computer is 
> asking for the
> y value. Is there a function to do the minimisation simultaneously 
> in S-PLUS
> or R ?
> 
> Many thanks, Adai.
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> .-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-
> FAQ.htmlSend "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-
> 
request at stat.math.ethz.ch_._._._._._._._._._._._._._._._._._._._._._._._
._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list