Re: no message from Minimize[] on a weird function(x^x)
- To: mathgroup at smc.vnet.net
- Subject: [mg96743] Re: [mg96724] no message from Minimize[] on a weird function(x^x)
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 23 Feb 2009 05:03:51 -0500 (EST)
- Reply-to: hanlonr at cox.net
f[x_] := x^x
Minimize[f[x], x]
Minimize[x^x,x]
Minimize returns unevaluated because it is trying to provide a symbolic result and cannot solve the problem. You need to simplify the problem by providing the appropriate constraint.
Minimize[{f[x], x > 0}, x]
{E^(-E^(-1)), {x -> 1/E}}
% // N
{0.692201,{x->0.367879}}
As with Minimize, MinValue and ArgMin also need the constraint
{MinValue[f[x], x], ArgMin[f[x], x]}
{MinValue[x^x,x],ArgMin[x^x,x]}
{MinValue[{f[x], x > 0}, x], ArgMin[{f[x], x > 0}, x]}
{E^(-E^(-1)), 1/E}
Numerical techniques do not need the constraint presumably because their search starts with x > 0
FindMinimum[f[x], x]
{0.692201,{x->0.367879}}
FindArgMin[f[x], x]
{0.367879}
FindMinValue[f[x], x]
0.692201
NMinimize[f[x], x]
{0.692201,{x->0.367879}}
NMinValue[f[x], x]
0.692201
Bob Hanlon
---- congruentialuminaire at yahoo.com wrote:
=============
Hello MathGroup:
I have:
f[x_]=x^x
Plot[f[x],{x,-3,3.}]
What makes this a weird function is that when x<0, the function is
discontinuous and non-differentiable and has a global minimum at -1.
To answer the question: "what is the minimum of this function", I
tried
FindMinimum[f[x],{x,2}] (* this appears correct *)
> {0.692201, {x -> 0.367879}}
FindMinimum[f[x],{x,2}] (* this complains about the gradient, but
appears correct *)
> FindMinimum::nrgnum: The gradient is not a vector of real numbers at {x} = {-1.}. >>
> {-1., {x -> -1.}}
NMinimize[f[x], x] (* this gives the minimum in the positive domain *)
> {0.692201, {x -> 0.367879}}
Minimize[f[x], x] (* this gives no answer and no error message *)
> Minimize[x^x, x]
Is this expected behavior?
TIA.
Roger Williams
Franklin Laboratory