# MAT232 Calorie Project

## 1857 days ago by jonathan.senning

The goal of this page is to help you understand why small errors in the coefficients of some linear systems can lead to large errors in their solution, while this is not true for other linear systems.

## Lines with nearly identical coefficients are close to parallel

Click on the "cell" (used to enter Sage commands) just below this text and an "evaluate" button will appear just below the cell.  Click on this button.  In a short time a plot will appear that shows the lines

$x+y=5$

$(1+\epsilon)x+y=20$

plotted together with corresponding colors.  When $\epsilon$ is a small number the coefficients of these two equations are nearly nearly identical and the lines are nearly parallel.  We say that $\epsilon$ is a perturbation of the first coefficient.  The slider at the top is used to change $\epsilon$.  We start with $\epsilon=0$ so the two lines are parallel and have no point in common; i.e. there is no solution to the linear system of these two equations.

Try moving the slider to change the value of $\epsilon$ and observe that the lines are no longer parallel and do intersect at a point which represents the solution to the linear system.  Try different values of $\epsilon$ and notice how the solution changes.

var("x,y") A=implicit_plot(x+y==5,(x,-120,120),(y,-120,120),color='blue') t=var('t') @interact def _(t=slider(-0.25,0.25,default=0.0,step_size=0.05,label="$\epsilon$")): B=implicit_plot((1+t)*x+y==20,(x,-120,120),(y,-120,120),color='red') (A+B).show(xmin=-100,xmax=100,ymin=-100,ymax=100)

## Lines with quite different coefficients are far from parallel

Repeat the steps above to get the "evaulate" button to appear and click on it.  The plot that appears shows the lines

$x+y=5$

$(1+\epsilon)x-y=20$

In contrast to the above example, the coefficient on $y$ is $-1$ in the second equation, which causes the red line to initially be perpendicular to the black line.  Clearly this system has a solution.  Use the slider to adjust epsion and notice what impact this has on the solution.

var("x,y") A=implicit_plot(x+y==5,(x,-120,120),(y,-120,120),color='blue') t=var('t') @interact def _(t=slider(-0.25,0.25,default=0.0,step_size=0.05,label="$\epsilon$")): B=implicit_plot((1+t)*x-y==20,(x,-120,120),(y,-120,120),color='red') (A+B).show(xmin=-100,xmax=100,ymin=-100,ymax=100)

## Click to the left again to hide and once more to show the dynamic interactive window