-
Notifications
You must be signed in to change notification settings - Fork 0
/
gr4.tex
123 lines (112 loc) · 4.22 KB
/
gr4.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
%\documentstyle [11pt]{mybook}
%\input{latexmac}
%
%\setcounter{chapter}{1}
%\setcounter{section}{3}
%\setcounter{page}{56}
%\begin{document}
\section{Automation}
This is a PASCAL routine to do \( k\rho_i+\rho_j \)
to an augmented matrix.
\begin{center}
\begin{verbatim}
PROCEDURE Pivot(VAR LinSys : AugMat;
k : REAL;
i, j : INTEGER)
VAR
Col : INTEGER;
BEGIN
FOR Col:=1 TO NumVars+1 DO
LinSys[j,Col]:=k*LinSys[i,Col]+LinSys[j,Col];
END;
\end{verbatim}
\end{center}
Of course this is only one part of a whole program, but it
makes the point that Gaussian reduction is ideal for computer coding.
There are pitfalls, however.
For example, some arise from the computer's use of finite-precision
approximations of real numbers.
These systems provide a simple example.
\begin{center}
\setlength{\unitlength}{4pt} % two pairs of lines
\begin{picture}(65,30)(-5,-18)
\thinlines
\multiput(0,0)(40,0){2}{\begin{picture}(20,0)(0,0)
\put(0,0){\line(0,1){10} } % y-axis
\put(0,0){\line(0,-1){10} }
\put(-0.5,3){\line(1,0){1} }
\put(-0.5,6){\line(1,0){1} }
\put(-0.5,9){\line(1,0){1} }
\put(-0.5,-3){\line(1,0){1} }
\put(-0.5,-6){\line(1,0){1} }
\put(-0.5,-9){\line(1,0){1} }
%\put(-2,10){\makebox(0,0)[b]{\small \(y\)} }
\put(0,0){\line(1,0){10} } % x-axis
\put(0,0){\line(-1,0){10} }
\put(3,-0.5){\line(0,1){1} }
\put(6,-0.5){\line(0,1){1} }
\put(9,-0.5){\line(0,1){1} }
\put(-3,-0.5){\line(0,1){1} }
\put(-6,-0.5){\line(0,1){1} }
\put(-9,-0.5){\line(0,1){1} }
%\put(10,2){\makebox(0,0)[b]{\small \(x\)} }
\end{picture} }
\put(0,-13){\makebox(0,0)[t]{\small \(\begin{linsys}{2}
x &+ &2y &= &3 \\
3x &- &2y &= &1
\end{linsys}\) } }
\put(40,-13){\makebox(0,0)[t]{\small \(\begin{linsys}{2}
x &+ &2y &= &3 \\
1.000\,000\,01x &+ &2y &= &3.000\,000\,01
\end{linsys}\) } }
\thicklines
\multiput(9,0)(40,0){2}{\line(-2,1){11} } % lines
\multiput(9,0)(40,0){2}{\line(2,-1){2.5} }
\put(2.4,2.4){\( \bullet \) }
\put(0,-1.5){\line(2,3){8} }
\put(0,-1.5){\line(-2,-3){4} }
\put(42.4,2.4){\( \bullet \)} % lines
\put(49.5,0){\line(-2,1){12} } % lines
\put(48.5,0){\line(2,-1){3} }
\end{picture}
\end{center}
(The second two lines are hard to tell apart.)
Both have \( (1,1) \) as their unique solution.
In the first system, some small change in the numbers will produce only a
small change in the solution:
\begin{equation*}
\begin{linsys}{2}
x &+ &2y &= &3 \\
3x &- &2y &= &1.008
\end{linsys}
\end{equation*}
gives a solution of \( (1.002,0.999) \).
Geometrically, changing one of the lines by a small amount does not change
the intersection point by very much.
That's not true for the second system.
A small change in the coefficients
\begin{equation*}
\begin{linsys}{2}
x &+ &2y &= &3 \\
1.000\,000\,01x &+ &2y &= &3.000\,000\,03
\end{linsys}
\end{equation*}
leads to a completely different answer: \( (3,0) \).
The solution of the second example
varies wildly, depending on a \( 9 \)-th digit.
That's bad news for a machine using \( 8 \) digits to represent reals.
In short, systems that are nearly singular may be hard
to compute with.
Another thing that can go wrong is error propagation.
In a system with a large number of equations (say, 100 or more), small
rounding errors early in the procedure can snowball to overwhelm the
solution at the end.
These issues, and many others like them,
are outside the scope of this book, but remember that
just because Gauss's Method always works in theory and just
because a program correctly implements that method
and just because the answer appears on green-bar paper, doesn't
mean that answer is right.
In practice, always use a package
where experts have worked hard to counter what can go wrong.
%\end{document}