1
$\begingroup$

For didactic purposes I solve with Mathematica the following problem (see Vasilyev's box on p. 17): when the area of the projection of a rotating cuboid in the three-dimensional space with coordinates x,y,zonto the xOy plane is maximum? (The problem has the exact symbolic answer, but I don't know an accurate proof of that.) I consider a concrete cuboid 1 x 3 x 2 since Mathematica (and other CASes) does not operate with abstract geometric objects. I rotate its vertices by EulerMatrix. Then I find their projections, cutting the third coordinate, and find the area of the convex hull of the projected vertices. Here is my code.

ClearAll["Global`*"];
f[\[Alpha]_,\[Beta]_,\[Gamma]_]:= Area[ConvexHullMesh[Table[(EulerMatrix[{\[Alpha],\[Beta],\[Gamma]}].x)[[1;;2]], 
{x, {{0, 0, 0}, {1, 0, 0}, {0, 3, 0}, {1, 3, 0}, {0, 0, 2}, {1, 0, 2}, {0, 3, 2}, {1, 3, 2}}}]]]
f[-Pi/4, Pi/3, Pi/6]
(*6.86603*)
NMaximize[{f[a, b, c],a >= -Pi && a <= Pi && b >= 0 && b <= Pi && c >= -Pi && 
c <= Pi}, {a, b, c}, Method -> "DifferentialEvolution"]
(*{7.,{a->-2.55692,b->1.12789,c->-0.321751}}*)

and a lot of error communications. To be sure,

NMaximize[{f[a, b, c],a >= -Pi && a <= Pi && b >= 0 && b <= Pi && c >= -Pi && 
c <= Pi}, {a, b, c}, Method -> "RandomSearch"]
(*{7., {a -> -1.73782, b -> 2.01371, c -> 0.321751}}*)

(a lot of error communications as a bonus) and

NMinimize[{f[a, b, c],a >= -Pi && a <= Pi && b >= 0 && b <= Pi && c >= -Pi && 
c <= Pi}, {a, b, c}, Method -> "RandomSearch"]
(*{2., {a -> -2.01037, b -> 1.5708, c -> 1.5708}}*)

The question arises: is it possible to obtain the exact solution with help of Mathematica?

$\endgroup$
3
  • $\begingroup$ Use the largest x-section? That would be diagonal length x diagonal half-length. $\endgroup$ – Daniel Lichtblau Nov 13 '20 at 16:48
  • $\begingroup$ @DanielLichtblau: Thank you for your interest to the question. I don't understand your comment at all. Can you elaborate it? TIA. $\endgroup$ – user64494 Nov 13 '20 at 19:14
  • $\begingroup$ I don't have a proof, if that's what you are asking. Clearly it's a lower bound though. $\endgroup$ – Daniel Lichtblau Nov 14 '20 at 16:54
1
$\begingroup$

There seems to be some bug in "Area". If I write my own area function, I get at least a result without crashing the kernel:

Note, the first rotation about the z axis has no effect on the area in the x/y plane and need not be maximized.

area[a1_, a2_ /; NumericQ[a2], a3_] := Module[{},
  cub = {{0, 0, 0}, {1, 0, 0}, {0, 3, 0}, {1, 3, 0}, {0, 0, 2}, {1, 0,
      2}, {0, 3, 2}, {1, 3, 2}};
  heron[p1_, p2_, p3_] := 
   Module[{n1 = Norm[p1 - p2], n2 = Norm[p2 - p3], n3 = Norm[p3 - p1],
      s},
    s = Total[n1 + n2 + n3]/2;
    Sqrt[s (s - n1) (s - n2) (s - n3)]
    ];
  pts = ConvexHullMesh[
      Transpose[EulerMatrix[{a1, a2, a3}].Transpose@cub][[All, 
        1 ;; 2]]]["BoundaryPolygons"][[1, 1]];
  heron[First[pts], ##] & @@@ Partition[Rest@pts, 2, 1] // Total
  ]
NMaximize[area[0, a2, a3], {a2, a3}]
$\endgroup$
6
  • $\begingroup$ First, thank you for the valuable note "the first rotation about the z axis has no effect on the area in the x/y plane ". Second, my code does not crash any kernel. Third, I am interested in an exact answer. $\endgroup$ – user64494 Nov 13 '20 at 13:01
  • $\begingroup$ @user64494 Your code did crash the kernel on Windows10 Mathematica v12.1.1.0 for me starting from a blank notebook. $\endgroup$ – flinty Nov 13 '20 at 13:07
  • $\begingroup$ @flinty:The executed code in nb. file on demand through Dropbox. $\endgroup$ – user64494 Nov 13 '20 at 13:12
  • $\begingroup$ @DaielHuber: However,+1. $\endgroup$ – user64494 Nov 13 '20 at 13:21
  • $\begingroup$ @flinty: Exclude f[-Pi/4, Pi/3, Pi/6] from the code. Then after 'Beep" NMaximize continues its work and produces the output attached by me and a lot of messages. However, the execution of syntactically correct code is not stable. $\endgroup$ – user64494 Nov 13 '20 at 13:41

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.