2
$\begingroup$

I have a problem in this form

enter image description here

To solve this I have tried this

f1[y_] := 2 - (y - 1)^2;
f2[x_, y_] := x + 1 - (y - 2)^2;
f[x_, y_] := Max[f1[y], f2[x, y]];

The line below then seems to solve the problem:

Reduce[f[x, y] >= f[x, Interval[0, 4]], {x, y}, Reals]

My question is, is this the right procedure to treat the problem? And if so, then how to plot this region?

$\endgroup$
  • $\begingroup$ RegionPlot[ Evaluate@Reduce[f[x, y] >= f[x, Interval[0, 4]], {x, y}, Reals], {x, -4, 4}, {y, -4, 4}] or expr = Reduce[f[x, y] >= f[x, Interval[0, 4]], {x, y}, Reals]; RegionPlot[expr, {x, -4, 4}, {y, -4, 4}]? $\endgroup$ – kglr Apr 22 '15 at 14:40
3
$\begingroup$

First our definitions:

f[x_, y_] := Max[2 - (y - 1)^2, x + 1 - (y - 2)^2]
Γ = Interval[{0, 4}]

The definition of $G(x)$ is (adjusting the notation slightly):

$$ \{y\in\Gamma:\forall_{z\in\Gamma}f(x,y)\geq f(x,z)\} $$

In English, this is

The set of $y$ (in $\Gamma$) for which $f(x,y)$ is no less than $f(x,z)$ for any $z$ in $\Gamma$.

We can make (most of) this statement in Mathematica:

ForAll[z, z ∈ Interval[{0, 4}], f[x, y] >= f[x, z]]
Reduce[%]
(* (y == 1 && x <= 1) || (y == 2 && x >= 1) *)

(This seems not to work in Mathematica 9, but an alternate and equivalent formulation exists:)

ForAll[z, 0 <= z <= 4, f[x, y] >= f[x, z]]
Reduce[%]
(* (y == 1 && x <= 1) || (y == 2 && x >= 1) *)

This is actually a different solution that what you came up with. It implies:

$$ G(x) = \left\{\begin{array}{ll}\{1\}&x<1 \\ \{1,2\}&x=1 \\ \{2\}&x>1\end{array}\right. $$

We can plot this like so:

soln = Solve[%, y]
Plot[Evaluate[y /. soln], {x, 0, 4}]

enter image description here

As for why this is the behavior, we can make an easy little Manipulate to explore the solution:

Manipulate[Plot[{f[x, y], f[x, z]}, {z, 0, 4}], {x, 0, 4}, {y, 0, 4}]

enter image description here

Note that what the problem is really asking is for the values of $y$ that maximize $f(x,y)$. We can see that $f$ has two local maxima, the peaks of the two parabolas. As $x$ changes, one moves up and the other moves down, but they don't shift left and right. Therefore $y$ that maximizes $f$ will stay at the location of the first peak until the peaks are equal, then it will switch to the location of the second peak.

$\endgroup$
  • $\begingroup$ I receive an error: Reduce@ForAll[z, Element[z, [CapitalGamma]], f[x, y] >= f[x, z]] Gives Reduce::naqs4(blah blah) is not a quantified system of equations and inequalities $\endgroup$ – Morry Apr 22 '15 at 15:19
  • $\begingroup$ I defined $\Gamma$, did you copy that part? (Or just replace it with Interval[{0,4}]) $\endgroup$ – 2012rcampion Apr 22 '15 at 15:21
  • $\begingroup$ I did that.... And I even did the replacement but still the same problem!! $\endgroup$ – Morry Apr 22 '15 at 15:23
  • $\begingroup$ @Morry What version are you using? And what is the result of ForAll before the Reduce? $\endgroup$ – 2012rcampion Apr 22 '15 at 15:24
  • $\begingroup$ db.tt/FIHpbOGb Mathematica 9 $\endgroup$ – Morry Apr 22 '15 at 15:27
0
$\begingroup$

No idea if this is the right thing to do, but here's my approach:

red = Reduce[f[x, y] >= f[x, Interval[0, 4]], {x, y}]

(* (x <= 0 && 0 <= y <= 2) || (0 < x < 4 && 0 <= y <= 2 + Sqrt[x]) || (x >= 4 && 0 <= y <= 4) *)

For a first idea what's going on:

ContourPlot[f[x, y], {x, -4, 4}, {y, -4, 4}]

enter image description here

And finally RegionPlot to show a plot in which red is True:

RegionPlot[Evaluate@red, {x, -4, 4}, {y, -4, 4}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.