14

I want to visualize $\{x_1,x_2,x_3\}\to\{x_1 + 2 x_2, 3 x_3-x_1\}$,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?

yode
  • 26,686
  • 4
  • 62
  • 167
  • 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: http://demonstrations.wolfram.com/SurfaceParametrizationsAndTheirJacobians/) – Michael E2 Jul 03 '16 at 21:42
  • @MichaelE2 Sorry,it seem cann't fully understand you. – yode Jul 03 '16 at 21:46
  • Sorry, I don't know how to respond. "variable square" = "a square you can move about R^3". Otherwise, I'm stumped. – Michael E2 Jul 03 '16 at 21:51

5 Answers5

19

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

Anton Antonov
  • 37,787
  • 3
  • 100
  • 178
11

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

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
8

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

Kuba
  • 136,707
  • 13
  • 279
  • 740
  • I suddently get that quite explanatory right now.Awsome! – yode Jul 06 '16 at 10:47
  • @yode No problem :) p.s. ViewMatrix may be of use too (won't be preserved when rotating but it is something). – Kuba Jul 06 '16 at 11:53
  • @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). – Anton Antonov Jul 06 '16 at 12:09
  • @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 – yode Jul 06 '16 at 12:20
  • 1
    @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... – Anton Antonov Jul 06 '16 at 12:31
4

There are three other ways to do this. Here we use another region instead of Cuboid[].

  • Method 1
Clear[reg, sol];
reg = ImplicitRegion[
   x^6 - 5 x^4 y + 3 x^4 y^2 + 10 x^2 y^3 + 3 x^2 y^4 - y^5 + y^6 + 
     z^2 <= 1, {x, y, z}];
(* reg=Cuboid[] *) 
sol = Resolve[
   Exists[{x1, x2, x3}, {x1, x2, x3} ∈ 
     reg , {u == x1 + 2 x2 , v == 3 x3 - x1}], Reals];
Grid[{{RegionPlot3D[reg, PlotPoints -> 30], 
   RegionPlot[sol, {u, -5, 5}, {v, -5, 5}, PlotPoints -> 30]}}]

enter image description here

  • Method 2
Clear[reg,plot];
reg = ImplicitRegion[
   x^6 - 5 x^4 y + 3 x^4 y^2 + 10 x^2 y^3 + 3 x^2 y^4 - y^5 + y^6 + 
     z^2 <= 1, {x, y, z}];
(*reg=Cuboid[];*)
plot = RegionPlot3D[reg, PlotPoints -> 30];
{plot, Show[
  plot /. {x1_Real, x2_Real, x3_Real} :> {x1 + 2 x2, 3 x3 - x1, 0}, 
  ViewPoint -> {0, 0, 1}, ViewProjection -> "Orthographic", 
  Boxed -> False]}

DynamicModule[{vp = {1.3, -2.4, 2.`}, vv = {0, 0, 1}}, {plot = RegionPlot3D[reg, PlotPoints -> 30, ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic@vv, SphericalRegion -> True], Show[plot /. {x1_Real, x2_Real, x3_Real} :> {x1 + 2 x2, 3 x3 - x1, 0}, ViewPoint -> Dynamic[vp], ViewProjection -> "Orthographic", Boxed -> False]}]

enter image description here

The DynamicModule visualize method come from Rotating few figures in the same manner by hand

  • Method 3 (Only work for some simple solid such as Cuboid.
ParametricRegion[{{x1 + 2 x2, -x1 + 3 x3}, {x1, x2, x3} ∈ 
    Cuboid[]}, {x1, x2, x3}] // Region

enter image description here

cvgmt
  • 72,231
  • 4
  • 75
  • 133
3

In version 13, this requirement is very easy to implement:

VectorDisplacementPlot3D[({{1, 2, 0}, {-1, 0, 3}, {0, 0, 0}} - 
    0.999 IdentityMatrix[3]) . {x, y, z}, {x, -1, 1}, {y, -1, 
  1}, {z, -1, 1}, VectorSizes -> Full, VectorPoints -> "Boundary"]

enter image description here

yode
  • 26,686
  • 4
  • 62
  • 167