Suppose I define a function in this way:
function[x_,y_]=Minimize[E^(x^2 + y^2 + z^2 + w^2 + x*y + x*z + x*w + y*z + y*w + z*w), {z,w}]
The output in Mathematica will give me the minimal value of the expression and the values for z and w that minimize the expression. If I want to extract just the minimum value for this output, I can call
function[1,1][[1]]
and this will return the minimal value. Now, suppose I want to define a new function that returns this minimal value, i.e., define:
function2[x_,y_] = function[x,y][[1]]
If I call function2[1,1]
, I don't get the minimal value that was output when calling function[1,1][[1]]
, but rather an expression involving the variables z and w. Is there any way to fix this and accomplish my goal of defining a new function that extracts the minimal value from Minimize?
?NumericQ
on the parametersx
andy
. (2) Definefunction2
with:=
instead of=
. $\endgroup$:=
and=
areSetDelayed
andSet
$\endgroup$