Sharp MZ-80A Owner's Manual page 89

Hide thumbs Also See for MZ-80A:
Table of Contents

Advertisement

99
Run the program and solve the following
system
of
simultaneous linear
equations
in three
unknowns.
'
3xi
-
2
x2
5
x3~
13
5
xi
7
x?
-r
2
a
35
16)
k
JCI
3
x2
xa—
28
When the program
is run
and the coefficient values and
the values which appear on the right-hand side of the equa¬
tions are entered as
shown
in figure, the
following
solution
is obtained:
xi
=
4
X2
=
- 7
x3
--
3
Exercises
1
.
Solve the
following
systems
of simultaneous
linear equations:
xi+
2r?+
3xj-
xi
=
5
xi
-
3x2+ 5x3+ 2 x»=
3
xi—
4x2+
xj+
7
xi=-
7
XI
+
X2
+
1
lxj
3
X4
22
xi+
2
i2+ 4
x.i+
8
x<
+ 16 xs
=
32
xi
f
3xi+ 9
x3
27
X4
+
81 xs= 243
xi
+ 4
X2
+ 16x3
+
64
x<
+-
256 xs
=
1024
xi
+ 5x:r 25XJ+
125xi
-r
625
xs
=
31 25
xi
-i-
6
x;i-
36x3
+ 216x4 +
1296x3
7776
The program constructed above does
not
specify the number of unknowns explicitly. In
practice, however,
the
number of unknowns
is
restricted
by
the space
available
for defining the
necessary arrays (or
the size of the BASIC
text
area).
If you use
it on
actual problems,
however, you will find that
the
program
can solve
systems
of simultaneous
linear
equations
with more than 80 unknowns when
it is used on
the MZ-80A.
Try solving various systems of simultane¬
ous linear
equations
in
which there are a
large
number of unknowns.
2. After
running
program several
times,
you may encounter
the
error
message
Error 2 in 1030.
which indicates
that
an overflow error
occurred
during
execution
of line number 1030. This condition will occur, for
example, if an
attempt
is made
to
solve
the
system
of simultaneous linear
equations:
'
X 1
+
2
X2
+
3
X3
=
26
3xi+ 5x2+ 2x3=— 39
(7)
i
2xi
+
4
i2+
X3
=
27
The overflow condition is caused because
Xi
and
x2
are eliminated simultaneously
from the
third equation during
the first elimination
operation
and the denominator of the division on line number 1030 is set
to
0 during the
second
elimination operation. This
type
of
error
can be avoided if we exchange the second and third
rows
before
entering
data.
Since
the
pivot position
moves diagonally as
program execution
proceeds, undesirable conditions will occur if a
diagonal element happens
to
be
zero.
Try developing
of
countermeasures
for this problem.

Advertisement

Table of Contents
loading

Table of Contents