Chapter 3 - Gauss-Jordan Elimination and Reduced Row Echelon Form

Section 3.3 - Sensitivity of Solutions to Error in the Linear System

Example 3.3.1

N[Solve[{6 x+9 y==5,-2 x+7 y==3},{x,y}]]

N[Solve[{6.1 x+9 y==5,-2 x+7 y==3},{x,y}]]

Example 3.3.2

(Ae={{187,790,5},{201,850,37}})//MatrixForm

N[RowReduce[Ae]]//MatrixForm

(Aa={{187,790,5},{201.1,850,37}})//MatrixForm

N[RowReduce[Aa]]//MatrixForm

Expand[N[Solve[187 x+790 y==5,y]]]

Expand[N[Solve[201 x+850 y==37,y]]]

Example 3.3.3

Ae={{0.23671,1,0.00633},{0.23647,1,0.04353}};

RAe=RowReduce[Ae];

ExactSoln=RAe[[All,-1]]

As={{0.23671,1,0.00633},{0.23647+R,1,0.04353}};

ApproxSoln=RowReduce[As][[All,-1]]

ErrorFunc=Sqrt[(((ExactSoln[[1]]-ApproxSoln[[1]]))^2)+(((ExactSoln[[2]]-ApproxSoln[[2]]))^2)];

Plot[ErrorFunc,{R,-1,1},PlotRange->{{-0.3,0.3},{120,180}},PlotStyle->{{Red,Thickness[0.01]}},AxesOrigin->{-0.3,120}]

SolutionPlot[r_]:= Block[{originalsolution,currentsolution,r1solution,distance,pointgraphics,errorplot, pointplot,x,y,r1},r1solution={x,y}/. Solve[ {23671/100000x+y==633/100000,(23647/100000+r1)x+y==4353/100000},{x,y}][[1]];originalsolution= {x,y}/.Solve[ {23671/100000x+y==633/100000,(23647/100000)x+y==4353/100000},{x,y}][[1]];
currentsolution=r1solution/. r1->r;
distance=Norm[r1solution-originalsolution];
pointgraphics=Graphics[{Arrowheads[.1],PointSize[.04],Red, Point[originalsolution],Blue,Point[currentsolution], Green, Arrow[{originalsolution, currentsolution}]}];
pointplot=Show[pointgraphics, PlotRange->{{-1000,-150},{0,250}}, Axes->True,  AxesLabel->{x,y}, AspectRatio->2/3, ImageSize->250];
Return[Show[GraphicsArray[{{Show[pointplot,AxesOrigin-> {-1000,0}]}}]]]]

Manipulate[SolutionPlot[r],{{r,0},0,.0002,.000001},SaveDefinitions->  True]

Example 3.3.4

Ae={{5.,-2,8,15},{-3,9,11,-4},{2,7,18.7,20}};

RAe=RowReduce[Ae];

ExactSoln=RAe[[All,-1]]

Aa={{5.,-2,8,15},{-3,9,11,-4},{2,7,18.9,20}};

RAa=RowReduce[Aa];

ApproxSoln=RAa[[All,-1]]

(As={{5.,-2,8,15},{-3,9,11,-4},{2,7,18.7+R,20}})//MatrixForm

ApproxSoln=RowReduce[As][[All,-1]]

ErrorFunc=Sqrt[(((ExactSoln[[1]]-ApproxSoln[[1]]))^2)+(((ExactSoln[[2]]-ApproxSoln[[2]]))^2)+(((ExactSoln[[3]]-ApproxSoln[[3]]))^2)];

Plot[ErrorFunc,{R,-1,1},PlotRange->{{-1,1},{0,1000}},PlotStyle-> {{Red,Thickness[0.01]}},AxesOrigin-> {0,0},AspectRatio-> 1/3]

SolutionPlot3D[r_]:=Block[{originalsolution,currentsolution,r1solution,distance,pointgraphics,errorplot,pointplot,x,y,z,r1},r1solution={x,y,z}/.Solve[{5 x-2 y+8 z==15,-3 x+9 y+11 z==-4,2 x+7 y+(18.7+r1) z==20},{x,y,z}][[1]];
originalsolution={x,y,z}/.Solve[{5 x-2 y+8 z==15,-3 x+9 y+11 z==-4,2 x+7 y+18.7 z==20},{x,y,z}][[1]];
currentsolution=r1solution/.r1->r;
distance=Norm[r1solution-originalsolution];
pointgraphics=Graphics3D[{Arrowheads[.1],PointSize[.05],Thickness[0.01],Red,Point[originalsolution],Blue,Point[currentsolution],Green,Arrow[{originalsolution,currentsolution}]}];
pointplot=Show[pointgraphics,PlotRange-> {{0,500},{0,500},{-200,0}},Axes-> True,AspectRatio-> 1,ImageSize-> {200,200},ViewPoint-> {12,-10,8}];
Return[Show[GraphicsArray[{{Show[pointplot]}}]]]]

Manipulate[SolutionPlot3D[r],{{r,0},0,0.25,.001},SaveDefinitions-> True]

Example 3.3.5

Ae={{3,2,-4,2},{-6,-4,8.1,-1},{3,1.95,-4,3}};

RAe=RowReduce[Ae];

ExactSoln=RAe[[All,-1]]

(As={{3,2,-4,2},{3,2,-(4+R),1/2},{3,(2+S),-4,3}})//MatrixForm

RAs=RowReduce[As];

ApproxSoln=RowReduce[As][[All,-1]]

ApproxSoln/.{R->0.05,S->-0.05}

ErrorFunc=Sqrt[(((ExactSoln[[1]]-ApproxSoln[[1]]))^2)+(((ExactSoln[[2]]-ApproxSoln[[2]]))^2)+(((ExactSoln[[3]]-ApproxSoln[[3]]))^2)];

Plot3D[ErrorFunc,{R,-0.3,0.3},{S,-0.3,0.3},Mesh-> None,AspectRatio-> 2/3,ClippingStyle-> None]

ContourPlot[ErrorFunc,{R,0.04,0.06},{S,-0.06,-0.04}, Contours-> {0,1,2,3,4,5,6,7,8,9,10}]