ASHUTOSH KAUSHAL
ASHUTOSH KAUSHAL

Reputation: 3

how can I print values of x and y for the minimum value of z of this 3d plot

enter image description here

cone<- function(x,y){   ((x^2)+(y^2)-(x*y)) } x<- y<-
seq(-0.5,0.5,length=50) z<- outer(x,y,cone) z library(plotly) fig <-
plot_ly(x = x, y = y, z = z) %>% add_surface() fig min(z) print(x,y)

Upvotes: 0

Views: 60

Answers (1)

Emmanuel Hamel
Emmanuel Hamel

Reputation: 2213

You can consider the following approach :

library(DEoptim)

cone <- function(param)
{
  x <- param[1]
  y <- param[2]
  val <- (x ^ 2 + y ^ 2 - x * y)
  return(val)
}

obj_DEoptim <- DEoptim(fn = cone, lower = c(-10, -10), upper = c(10, 10))
obj_DEoptim$optim$bestmem

        par1         par2 
4.250299e-19 4.816155e-19 

Upvotes: 0

Related Questions