Chapter 4 - Applications of Linear Systems and Matrices

Section 4.1 - Applications of Linear Systems to Geometry

Example 4.1.1

P={-7,9};Q={2,-13};T={8,5};

PtsPlot=Graphics[{PointSize[0.05],Blue,Point[{P,Q,T}]},Axes->True,PlotRange->{{-20,12},{-20,15}}];

TxtPlot=Graphics[{Black,Text["P",{-8,10}],Text["Q",{2,-11}],Text["T",{9,6}]}];

EqnCircle=d x+e y+f==-((x^2)+(y^2))

Eqn1=EqnCircle/.{x->P[[1]],y->P[[2]]}

Eqn2=EqnCircle/.{x->Q[[1]],y->Q[[2]]}

Eqn3=EqnCircle/.{x->T[[1]],y->T[[2]]}

Soln=Solve[{Eqn1,Eqn2,Eqn3},{d,e,f}]

CircleEqn=(EqnCircle/.Soln)[[1]]

CircPlot=ContourPlot[Evaluate[{CircleEqn}],{x,-20,12},{y,-20,15},ContourStyle->{Red,Thickness[0.01]},PlotRange->All,Axes->True,Frame->False,AspectRatio->1];

Show[CircPlot,PtsPlot,TxtPlot]

CompleteSquare[f_,x_]:=Module[{a,b,c},
{c,b,a}=CoefficientList[f,x];
a (((x+b/2/a))^2)+Simplify[(c-(b^2)/4/a)]]

StdForm=CompleteSquare[CompleteSquare[-CircleEqn[[2]]+CircleEqn[[1]],x],y]==0

EqnCircleTwo=(((x-H))^2)+(((y-K))^2)==(R^2);

Eqn4=EqnCircleTwo/.{x->P[[1]],y->P[[2]]}

Eqn5=EqnCircleTwo/.{x->Q[[1]],y->Q[[2]]}

Eqn6=EqnCircleTwo/.{x->T[[1]],y->T[[2]]}

SolnTwo=Solve[{Eqn4,Eqn5,Eqn6},{H,K,R}]

EqnCircleTwo/.N[%[[2]]]

N[StdForm]

Example 4.1.2

P={5,-8,13};Q={-7,2,4};R={16,10,-9};

PtsPlot=Graphics3D[{PointSize[0.06],Blue,Point[{P,Q,R}]},Axes->True,PlotRange->{{-20,20},{-20,20},{-20,20}},Boxed->False];

TxtPlot=Graphics3D[{Black,Text["P",{5,-8,14}],Text["Q",{-7,2,5}],Text["R",{16,10,-8}]},Boxed->False];

EqnPlane=e x+f y+g z==1;

EqnPlane1=EqnPlane/.{x->P[[1]],y->P[[2]],z->P[[3]]}

EqnPlane2=EqnPlane/.{x->Q[[1]],y->Q[[2]],z->Q[[3]]}

EqnPlane3=EqnPlane/.{x->R[[1]],y->R[[2]],z->R[[3]]}

Soln=Solve[{EqnPlane1,EqnPlane2,EqnPlane3},{e,f,g}]

PlaneEqn=(EqnPlane/.Soln)[[1]]

PlanePlot=ContourPlot3D[Evaluate[PlaneEqn],{x,-20,20},{y,-20,20},{z,-20,20},Mesh->None,ContourStyle->Red,Boxed->False];

Show[PtsPlot,TxtPlot,PlanePlot,Axes->True,Boxed->True]

Example 4.1.3

ConicThrough5Points[a_,b_,c_,d_,e_,x_,y_]:=Block[{eqns,conic,b1,c1,d1,e1,f1},eqns=((x^2)+b1 x y+c1 (y^2)+d1 x+e1 y+f1==0)/.{{x->a[[1]],y->a[[2]]},{x->b[[1]],y->b[[2]]},{x->c[[1]],y->c[[2]]},{x->d[[1]],y->d[[2]]},{x->e[[1]],y->e[[2]]}};
conic=((x^2)+b1 x y+c1 (y^2)+d1 x+e1 y+f1==0)/.Solve[eqns,{b1,c1,d1,e1,f1}][[1]];
Return[conic]];

ConicFrame[pt1_]:=Block[{rawgraphics,conic,conicplot,x,y,pt},pt={0,1/2}+(pt1-{0,1/2})/Norm[pt1-{0,1/2}];
rawgraphics={PointSize[.02],Black,Point[{{0,0},{0,1},{1,0},{1,1}}],Red,Point[pt],Black,Circle[{0,1/2},1]};
conic=ConicThrough5Points[{1,1},{0,0},{1,0},{0,1},pt,x,y];
conicplot=ContourPlot[Evaluate[conic],{x,-5,5},{y,-5,5},Frame->False,Axes->True,AxesOrigin->{0,0},PlotPoints->75];
Return[Show[conicplot,Graphics[rawgraphics],PlotLabel->conic]]]

Manipulate[ConicFrame[spot],{{spot,{-1/3,3/2}},Locator,Appearance->None},SaveDefinitions->True]