[R] Optimization

Stephen Tucker brown_emu at yahoo.com
Tue Jul 17 11:07:05 CEST 2007


f <- function(x)
  (sqrt((x[1]*0.114434)^2+(x[2]*0.043966)^2+(x[3]*0.100031)^2)-0.04)^2

optim(c(0,0,0),f)

see ?optim for details on arguments, options, etc.

--- "massimiliano.talarico" <massimiliano.talarico at poste.it> wrote:

> I'm sorry the function is 
> 
> sqrt((x1*0.114434)^2+(x2*0.043966)^2+(x3*0.100031)^2)=0.04;
> 
> Have you any suggests.
> 
> Thanks,
> Massimiliano
> 
> 
> 
> What is radq?
> 
> --- "massimiliano.talarico"
> <massimiliano.talarico at poste.it> wrote:
> 
> > Dear all,
> > I need a suggest to obtain the max of this function:
> > 
> > Max x1*0.021986+x2*0.000964+x3*0.02913
> > 
> > with these conditions:
> > 
> > x1+x2+x3=1;
> >
> radq((x1*0.114434)^2+(x2*0.043966)^2+(x3*0.100031)^2)=0.04;
> > x1>=0;
> > x1<=1;
> > x2>=0;
> > x2<=1;
> > x3>=0;
> > x3<=1;
> > 
> > Any suggests ?
> > 
> > Thanks in advanced,
> > Massimiliano
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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 stat.math.ethz.ch 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.
>



More information about the R-help mailing list