Using mathematica to understand linear algebra

What is the reason why this does not work, as you can see there is three unknown and I want to see the planes. I have looked through the user manual but there is something that I am not realising!

Could someone please take the time to correct this code and explain where I went wrong?

ParametricPlot3D[{{2 x – y, -x + 2y – z, 0 – 3 y + 4 z}}, {x, -20,
20}, {y, -20, 20}, {z, -20, 20},
PlotStyle -> {{Yellow, Opacity[0.5]}, {Blue, Opacity[0.5]}},
Mesh -> None, BoxRatios -> {1, 1, 1},
AxesLabel -> {Style[“x”, 16], Style[“y”, 16], Style[“z”, 16]}]

=================

1

 

Can you explain in words what you are trying to plot?
– Szabolcs
Oct 8 ’14 at 16:13

2

 

First, you have error in the API, you wrote {{2 x – y, -x + 2y – z, 0 – 3 y + 4 z}, {x, -20, 20}} notice, you included a range specs inside the functions. i.e. you included {x, -20, 20} where it does not belong. Second, what is the parameters you are using? The helps shows that max of 2 parameters can be used, u and v. Are you sure ParametricPlot3D is what you want to use?
– Nasser
Oct 8 ’14 at 16:29

  

 

The error with the range is obviously wrong, I basically want to plot a 3D graph where the planes meet. Mostly to use as a visualization, I just do not get how to do it, as 3D plot only take on two variables?
– ALEXANDER
Oct 8 ’14 at 16:40

  

 

@Szabolcs I am trying to visualise the intersection with the planes
– ALEXANDER
Oct 8 ’14 at 16:46

  

 

@ALEXANDER Could you possibly turn each plane into z=rhs, where rhs is multiples of x, y and a constants? Then you could Plot3D the list of the three right hand sides.
– Bill
Oct 9 ’14 at 1:01

=================

1 Answer
1

=================

I am trying to visualise the intersection with the planes

Remove[“Global`*”];
eq1 = 2 x – y == 0;
eq2 = -x + 2 y – z == 0;
eq3 = -3 y + 4 z == 0;
lim = 10;
spec = {{x, -lim, lim}, {y, -lim, lim}, {z, -lim, lim}};
lbl = {“x”, “y”, “z”};

p1 = ContourPlot3D[Evaluate@eq1, Evaluate[Sequence @@ spec],
PlotLabel -> “2 x-y”, AxesLabel -> lbl, ContourStyle -> Red];
p2 = ContourPlot3D[Evaluate@eq2, Evaluate[Sequence @@ spec],
PlotLabel -> “-x+2y-z”, AxesLabel -> lbl, ContourStyle -> Blue];
p3 = ContourPlot3D[Evaluate@eq3, Evaluate[Sequence @@ spec],
PlotLabel -> “-3 y+4 z”, AxesLabel -> lbl];

Grid[{{p1, p2, p3}}, Frame -> All]

{b, a} = CoefficientArrays[{eq1, eq2, eq3}, {x, y, z}];
sol = LinearSolve[a, -b] // N (*find point of intersection*)
Show[p1, p2, p3, Graphics3D[{Red, Sphere[sol]}],
PlotLabel -> “point where surfaces meet)”]

2

 

Nice example, +1! However Sphere looks better then Point in 3D.
– ybeltukov
Oct 8 ’14 at 19:03

  

 

@ybeltukov thanks for the hint. I changed the point to sphere. yes, it looks better.
– Nasser
Oct 8 ’14 at 19:20

  

 

What would be a good way to plot the line of intersection if that were the case?
– Ben Allgeier
Oct 10 ’14 at 12:28