12
$\begingroup$

I want to visualize $\{x1,x2,x3\}\to\{x1 + 2 x2, 3 x3-x1\}$,but we cannot use ParametricPlot like following,because this map have three parameters.

ParametricPlot[{x1+2x2,3x3-x1},{x1,-10,10},{x2,-10,10},{x3,-10,10}]

We will get some error informations.The current method is plot some discrete points to know it:

Graphics[Point[
  Level[Table[{x1 + 2 x2, 3 x3 - x1}, {x1, -10, 10, .5}, {x2, -10, 
     10, .5}, {x3, -10, 10, .5}], {3}]]]

Are there better solution can visualize it not just by some discrete points?

$\endgroup$
4
  • $\begingroup$ You could map a variable square in R^3 to its image, and show both side by side, while manipulating the square. It's a linear map, so nothing very complicated is going on. (Here's the same idea applied to the reverse direction, R^2 -> R3: demonstrations.wolfram.com/…) $\endgroup$ – Michael E2 Jul 3 '16 at 21:42
  • $\begingroup$ @MichaelE2 Sorry,it seem cann't fully understand you. $\endgroup$ – yode Jul 3 '16 at 21:46
  • $\begingroup$ Sorry, I don't know how to respond. "variable square" = "a square you can move about R^3". Otherwise, I'm stumped. $\endgroup$ – Michael E2 Jul 3 '16 at 21:51
  • $\begingroup$ @Kuba Your comments make me deeply impressive always. $\endgroup$ – yode Jul 4 '16 at 11:05
4
$\begingroup$

Let's show how a unit cube is projected, that is quite explanatory:

Table[
  ParametricPlot[{x1 + 2 x2, 3 x3 - x1}, {#, 0, 1}, {#2, 0, 1}], 
  {#3, {0, 1}}
] & @@@ {{x1, x2, x3}, {x1, x3, x2}, {x2, x3, x1}} // Flatten // Show[
   #,
   Graphics @  Table[
      Inset[{##}, {#1 + 2 #2, 3 #3 - #1}] & @@ p, 
      {p, Tuples[{0, 1}, {3}]}
   ],
   PlotRange -> All, Axes -> False, PlotRangePadding -> Scaled[.1]
] &

enter image description here

We can try to use ViewMatrix to show it too:

p = N @ {{1, 2, 0, 0}, {-1, 0, 3, 0}, {0, 0, 1, 0}, {0, 0, 0, 30}};

{x1, x2, x3} = IdentityMatrix[3];

 t = N @ TransformationMatrix @ TranslationTransform[3 {1, 1, 2}];

Graphics3D[{
  Thick,
  FaceForm@Opacity@.3, EdgeForm@Thick, Cuboid[{1, 1, 1}], Cuboid[],
  Sphere[{-1, -1, -1}]
  },
 Boxed -> True, ViewMatrix -> {t, p}, 
 PlotRange -> 3
 ]

enter image description here

$\endgroup$
5
  • $\begingroup$ I suddently get that quite explanatory right now.Awsome! $\endgroup$ – yode Jul 6 '16 at 10:47
  • $\begingroup$ @yode No problem :) p.s. ViewMatrix may be of use too (won't be preserved when rotating but it is something). $\endgroup$ – Kuba Jul 6 '16 at 11:53
  • $\begingroup$ @yode Kudos to Kuba :) for the clarifying answer, but I thought the unit cube projection plot insight in this answer is also obtained from the first plot of my answer by following the numbers of the points (e.g. the ones at the corners). $\endgroup$ – Anton Antonov Jul 6 '16 at 12:09
  • $\begingroup$ @AntonAntonov I'm sorry for change the acceptation, :)I just think this coordinate map reveal the nature more distinct.Of course,we can know the rule as your following numbers of the points $\endgroup$ – yode Jul 6 '16 at 12:20
  • 1
    $\begingroup$ @yode Please do not be sorry for changing the acceptance (in this case and in general)! Better and more relevant answers should be able appear later. I mostly wrote my previous comment, I think, because it is/was not clear from your question are you looking for a nice visualization or for an enlightening one, is it for personal use or for a presentation. Although, , of course, being that specific might restrict the answers too much... $\endgroup$ – Anton Antonov Jul 6 '16 at 12:31
17
$\begingroup$

I am not sure is this an answer you are looking for, but the following graph does visualize the mapping.

cubePoints3D = 
  Flatten[Table[{x1 , x2,  x3 }, {x1, -10, 10, 5}, {x2, -10, 
          10, 5}, {x3, -10, 10, 5}], 2];
cubePoints2D = 
  Function[{x1, x2, x3}, {x1 + 2 x2, 3 x3 - x1}] @@@ cubePoints3D;
offset = {0, 0, 50};
cubePoints2Dto3D = Map[Append[#, 0] + offset &, cubePoints2D];

Graphics3D[{GrayLevel[0.4],
  Line[cubePoints2Dto3D],
  PointSize[0.02],
  MapIndexed[{Blend[{Blue, Red, Yellow}, #2[[1]]/
       Length[cubePoints2Dto3D]], Point[#1]} &, cubePoints3D],
  Gray, FaceForm[None], Red, PointSize[0.02], 
  MapIndexed[{Blend[{Blue, Red, Yellow}, #2[[1]]/
       Length[cubePoints2Dto3D]], Point[#1]} &, cubePoints2Dto3D],
  Black, MapIndexed[Text[#2[[1]], #1, 2 {1, 1}] &, cubePoints2Dto3D],
  GrayLevel[0.9], 
  MapThread[Arrow[{#1, #2}] &, {cubePoints3D, cubePoints2Dto3D}],
  Black, MapIndexed[
   Text[Style[#2[[1]], Background -> White], #1, 0 {1, 1}] &, 
   cubePoints3D]}, Boxed -> False, ImageSize -> 1000]

enter image description here

And here is a variation with more points, no labels, and a sample of arrows:

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Well, at least it's pretty. Reminds me of a description of an experimental 64-CPU chip in 1980s that supposedly had a "hypercube" configuration of connectivity (i.e. a 4-cube array mapped into a 3D chip). Of course, this image is one dimension less. $\endgroup$ – Michael E2 Jul 4 '16 at 0:20
  • $\begingroup$ Good effect. :) $\endgroup$ – yode Jul 4 '16 at 0:39
  • $\begingroup$ @yode Thanks, hopefully it is also useful ! $\endgroup$ – Anton Antonov Jul 4 '16 at 0:41
8
$\begingroup$

How about a vector field approach?

VectorPlot3D[{x1 + 2 x2, 3 x3 - x1, 0}, {x1, -10, 10}, {x2, -10, 
  10}, {x3, -10, 10}]

enter image description here

Animate[
 VectorPlot[{x1 + 2 x2, 3 x3 - x1}, {x1, -10, 10}, {x2, -10, 10}, 
  PlotLabel -> StringTemplate["x3 = ``"][x3]],
 {x3, -10, 10}
 ]

enter image description here

Animate[
 StreamPlot[{x1 + 2 x2, 3 x3 - x1}, {x1, -10, 10}, {x2, -10, 10}, 
  PlotLabel -> StringTemplate["x3 = ``"][x3]],
 {x3, -10, 10}
 ]

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.