I am using the following code to determine the maximum of a function:
f[x_] = Log[3/10, 3 - 2 x - x^2]
xr = FunctionDomain[f[x], x]
Maximize[{f[x], xr}, x]
As the maximum value does not exist, a warning message is returned:
Maximize::natt: The maximum is not attained at any point satisfying the given constraints.
I want to modify the code such that it doesn't give a warning message, but prints
The function does not have a maximum value in this interval
when the maximum does not exist, and give the maximum otherwise.
{Limit[f[x], x -> -3], Limit[f[x], x -> -1]}
$\endgroup$Check
already appears in following questions of yours: mathematica.stackexchange.com/q/282329/1871 mathematica.stackexchange.com/q/284016/1871 mathematica.stackexchange.com/q/282327/1871 mathematica.stackexchange.com/q/282362/1871. $\endgroup$