<html><body><div style="color:#000; background-color:#fff; font-family:bookman old style, new york, times, serif;font-size:16px"><div id="yui_3_16_0_1_1431897106834_13765"><span id="yui_3_16_0_1_1431897106834_13870">Pessoal,</span></div><div id="yui_3_16_0_1_1431897106834_13765" dir="ltr"><span id="yui_3_16_0_1_1431897106834_13869">como devo escrever a função fxy para que o optim pegue fxy e maximize mesma? Estou pesquisando aqui, mas não consegui. Este é um exemplo apenas para fins didáticos! </span></div><div id="yui_3_16_0_1_1431897106834_13765" dir="ltr">x = seq(-2,2,length=20) <br></div><div id="yui_3_16_0_1_1431897106834_13779" class="" style="">y = seq(-2,2,length=20) </div><div id="yui_3_16_0_1_1431897106834_13779" class="" style="">f = function(x,y){ </div><div id="yui_3_16_0_1_1431897106834_13779" class="" style=""> fxy = -x^2 - y^2 </div><div id="yui_3_16_0_1_1431897106834_13779" class="" style=""> return(fxy) </div><div id="yui_3_16_0_1_1431897106834_13779" class="" style="">} </div><div id="yui_3_16_0_1_1431897106834_13779" class="" style="">z = outer(x,y,f) </div><div id="yui_3_16_0_1_1431897106834_13779" class="" style="">persp(x,y,z,theta=30,phi=30, col="green",xlab="x",ylab="Y",zlab="Produção") # Gostaria de acrescentar a escala no eixo!</div><div id="yui_3_16_0_1_1431897106834_13779" class="" style=""><br class="" style=""></div><div id="yui_3_16_0_1_1431897106834_13779" class="" style=""><br class="" style=""></div><div id="yui_3_16_0_1_1431897106834_13779" class="" style="">fxy=function(x,y) -x^2 - y^2</div><div id="yui_3_16_0_1_1431897106834_13779" class="" style=""><br class="" style=""></div><div id="yui_3_16_0_1_1431897106834_13779" class="" style="">optim(c(2,2),fxy, method="BFGS", control=list(fnscale=-1)) </div><div dir="ltr" class="" style="" id="yui_3_16_0_1_1431897106834_13834"><br class="" style=""></div><div id="yui_3_16_0_1_1431897106834_13781"><div id="yui_3_16_0_1_1431897106834_13780" dir="ltr">
obrigado <br>
<br><br></div></div></div></body></html>