1
$\begingroup$

I'm faced with the following minimization problem: Find $r\in[0,1]$ that minimizes $\frac{d^2+k^2 (1-2r)r}{2(1-r)r}$, which is bounded by 0 and 1. In addition, $k<d$ holds and each of $d$ and $k$ is bounded by zero and some positive real number, say, $d\in[0,2]$ and $k\in[0,0.5]$.

I'm in need of help to 3D plot the value of $r$ against $d$ and $k$.

Here is what I tried:

Plot3D[NMinimize[{-((d^2 + k^2 (1 - 2 r) r)/(2 (-1 + r) r)), 0 <= d <= 2, 0 <= k <= 0.5, 0 <= r <= 1}, r], {d, 0, 2}, {k, 0, 0.5}]
$\endgroup$
2
$\begingroup$

If I have understood your question correctly, you search for an "r" in the range [0,1], which makes the object function minimal, under the constraints d->[0,2] and k->[0,1/2].

minR = Last @ Minimize[{(d^2 + k^2 (1 - 2 r) r)/(2 (1 - r) r), 0 < r < 1, 0 < d < 2, 0 < k < 1/2}, r]

enter image description here

Plot3D[r /. minR, {d, 0, 2}, {k, 0, 1/2}, PlotRange -> All, AxesLabel -> Automatic]

enter image description here

Furthermore, you get the function value:

value = First @ Minimize[{(d^2 + k^2 (1 - 2 r) r)/(2 (1 - r) r), 0 < r < 1,  0 < d < 2, 0 < k < 1/2}, r]

enter image description here

This value should be minimal and bounded -> [0,1]. That's true for d = k and the object function is reduced to minObjFunc and r = 1:

minObjFunc = 1/2 (2 d^2 + k^2) /. d -> k
(3 k^2)/2

r /. (minR // PiecewiseExpand)[[2]] /. d -> k
1
$\endgroup$
  • $\begingroup$ @rmv: Thanks for your additional comments. I'm not getting your comment about minObjFunc. Sorry but can you please give me a little more hint? $\endgroup$ – ppp Feb 17 at 16:16
  • $\begingroup$ I have to express myself precisely: "Under these conditions, the value of the objective function becomes "minObjFunc ", (first row of the piecewise result) $\endgroup$ – rmw Feb 17 at 18:42
1
$\begingroup$

Although the observation by bill_s is correct, progress can nonetheless be made:

s = MinValue[{(d^2 + k^2 (1 - 2 r) r)/(2 (1 - r) r), 0 < r < 1}, r]
(* Piecewise[{{d^2 + Sqrt[d^4], (k == 0 && d > 0) || (k == 0 && d < 0)}, 
   {(2*d^2 + k^2 - 2*Sqrt[d^2*(d^2 - k^2)])/2, (k > 0 && d == -k) || (k > 0 && d == k) || 
   (k < 0 && d == -k) || (k < 0 && d == k)}, {(2*d^2 + k^2 + 2*Sqrt[d^2*(d^2 - k^2)])/2, 
   (k > 0 && d > k) || (k > 0 && d < -k) || (k < 0 && d > -k) || (k < 0 && d < k)}, 
   {-Infinity, (k > 0 && Inequality[-k, Less, d, Less, k]) || 
   (k < 0 && Inequality[k, Less, d, Less, -k])}}, 0] *)

Plot3D[s, {d, 0, 2}, {k, 0, .5}, ImageSize -> Large, 
    AxesLabel -> {d, k, min}, LabelStyle -> {Black, Bold, 15}]

enter image description here

The solution is negative infinity for k < d and is shown by the plot otherwise.

$\endgroup$
  • $\begingroup$ Thanks! I forgot to add the condition k<d, which I just did in my post. I think I'm not perfectly understanding your work here. I'm sorry but can you please give a little more explanation on what's going on? And I would like to plot with r on the vertical axis. $\endgroup$ – ppp Feb 17 at 5:53
  • $\begingroup$ Another edit: my objective function is bounded by 0 and 1. $\endgroup$ – ppp Feb 17 at 6:02
  • $\begingroup$ @bbgodfrey Please insert the result as an image, it is then clearer to recognize. I get the same result. $\endgroup$ – rmw Feb 17 at 10:17
  • $\begingroup$ @ppp It appears that rmw adequately answered your question. $\endgroup$ – bbgodfrey Feb 17 at 16:59
0
$\begingroup$

If you let d=0 and k=0.2, then the minimization is unbounded:

d = 0; k = 0.2; 
NMinimize[{-((d^2 + k^2 (1 - 2 r) r)/(2 (-1 + r) r)), 
          0 <= d <= 2, 0 <= k <= 0.5, 0 <= r <= 1}, r]

{-\[Infinity], {r -> Indeterminate}}

Since that is right in the middle of the range you are looking at, there is nothing to plot.

$\endgroup$
  • $\begingroup$ Thanks! I have made two edits. In fact, my object function should be bound by 0 and 1. In addition, k<d should hold. Under these additional constraints, do we get more meaningful results? Any comments will be greatly appreciated. $\endgroup$ – ppp Feb 17 at 5:59

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.