Linear Algebra and Laboratories

Mathematica code as it appeared in Mathematica in Education,
Volume 2 Number 2, 
Winter 1992/1993

Clifford A. Reiter
Department of Mathematics
Lafayette College
Easton, PA 18042±1781
reiterc@lafcol.lafayette.edu

(Mathematica version 2.1)

Graphics set up

$PrePrint = If[MatrixQ[#1], TableForm[#1], #1]&

SetOptions[Graphics3D,ColorOutput->GrayLevel];

<<Graphics`GraphicsSetUp`

Reshape[x_, n_?NumberQ] := Block[{data = Flatten[List[x]]},
	Take[Flatten[Table[data,{Ceiling[n/Length[data]]}],1],n]]

Reshape[x_, dim_?ListQ] := 
	Block[{i = Length[dim], data = Reshape[x,Times@@dim]}, 
 		While[i > 1,
 			  data = Partition[data,dim[[i]]];
			  i = i - 1];
 		data
 		]

Reshape[{1,0,2,4,-3,6},{3,2}]

Figure 1

rotx[t_]:={{1,0,0},{0,Cos[t],Sin[t]},{0,-Sin[t],Cos[t]}}

sp3[x_] := Show[Graphics3D[Polygon /@ x],
			PlotRange->{{-6,6},{-6,6},{-4,4}},
			Axes->Automatic,
			Lighting->True,
			AxesLabel->{"x","y","z"}]

L3 = {{{0, 0, 0}, {0, 3, 0}, {1, 3, 0}, {1, 0, 0}}, 

   {{0, 0, 0}, {2, 0, 0}, {2, 1, 0}, {0, 1, 0}}, 

   {{0, 0, 1}, {0, 3, 1}, {1, 3, 1}, {1, 0, 1}}, 

   {{0, 0, 1}, {2, 0, 1}, {2, 1, 1}, {0, 1, 1}}, 

   {{0, 0, 0}, {0, 3, 0}, {0, 3, 1}, {0, 0, 1}}, 

   {{1, 0, 0}, {1, 3, 0}, {1, 3, 1}, {1, 0, 1}}, 

   {{0, 0, 0}, {2, 0, 0}, {2, 0, 1}, {0, 0, 1}}, 

   {{0, 1, 0}, {2, 1, 0}, {2, 1, 1}, {0, 1, 1}}, 

   {{2, 0, 0}, {2, 1, 0}, {2, 1, 1}, {2, 0, 1}}, 

   {{0, 3, 0}, {1, 3, 0}, {1, 3, 1}, {0, 3, 1}}, 

   {{0, 0, 0}, {1, 0, 0}, {1, 0, 4}, {0, 0, 4}}, 

   {{0, 1, 0}, {1, 1, 0}, {1, 1, 4}, {0, 1, 4}}, 

   {{0, 0, 0}, {0, 1, 0}, {0, 1, 4}, {0, 0, 4}}, 

   {{1, 0, 0}, {1, 1, 0}, {1, 1, 4}, {1, 0, 4}}, 

   {{0, 0, 4}, {1, 0, 4}, {1, 1, 4}, {0, 1, 4}}}

sp3[L3.rotx[Pi/6]]