Tải bản đầy đủ (.pdf) (4 trang)

Tài liệu Enumeration of Kinematic Structures According to Function P10 ppt

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (48.46 KB, 4 trang )

Appendix A
Solving
m
Linear Equations in
n
Unknowns
In this appendix, we develop a procedure for solving a system of m linear equations
in n variables subject to a constraint that all the variables are nonnegative integers.
We first discuss a method for solving one equation in n unknowns. Then, we extend
the method to solving a system of m equations in n unknowns.
A.1 Solving One Equation in n Unknowns
Consider the following linear equation:
c
1
x
1
+ c
2
x
2
+ c
3
x
3
+···+c
n
x
n
= k, (A.1)
where x
i


s are the variables and c
i
s are the coefficients. The c
i
s are nonnegative
integers and k is a positive integer. We wish to solve for x
i
, for i = 1, 2,...,n
subject to a constraint that all x
i
s must be nonnegative integers. In addition, the
following constraint may be imposed:
x
i
≤ q
i
(constant) . (A.2)
Since there are n unknowns in one equation, we may choose n − 1 number of
unknowns arbitrarily and solve Equation (A.1) for the remaining unknown, provided
that all the solutions are nonnegative integers. This can be accomplished by a com-
puter program using a nested-do loops algorithm to vary the value of each x
i
and
check for the validity of the solutions. A more rigorous procedure for solving one
linear equation in two unknowns can be found in [1].
© 2001 by CRC Press LLC
Table A.1
A Nested-do Loops Algorithm for Solving One Linear
Equation in n Unknowns.
FOR

I
1
=0TO
q
1
x(1) = I
1
FOR
I
2
=0TO
q
2
x(2) = I
2
FOR
I
3
=0TO
q
3
x(3) = I
3
.
.
.
FOR
I
n−1
=0TO

q
n−1
x(n − 1) = I
n−1
x(n) = (k − c(1) ∗ x(1) − ...
−c(n − 1) ∗ x(n − 1))/c(n).
IF
x(n) < 0
, DISCARD THE SOLUTION.
IF
x(n) ≥ 0
, SAVE THE SOLUTION.
NEXT
I
n−1
.
.
.
NEXT
I
3
NEXT
I
2
NEXT
I
1
A.2 Solving m Equations in n Unknowns
Next, we consider a system of m linear equations in n unknowns:
c

11
x
1
+ c
12
x
2
+···+c
1n
x
n
= k
1
,
c
21
x
1
+ c
22
x
2
+···+c
2n
x
n
= k
2
,
.

.
. (A.3)
c
m1
x
1
+ c
m2
x
2
+···+c
mn
x
n
= k
m
,
where the coefficients c
ij
s are nonnegative integers, the constants k
i
s are positive
integers, and n>m. Furthermore, the solutions to the system of equations are
subject to a constraint that all the variables x
i
, for i = 1, 2,...,n, must be nonnegative
integers. Writing Equation (A.3) in matrix form yields
C x = 0 , (A.4)
© 2001 by CRC Press LLC
where

C =





c
11
c
12
c
13
... c
1n
−k
1
c
21
c
22
c
23
... c
2n
−k
2
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
c
m1
c
m2
c
n3
... c
mn
−k
m





,

x =
[
x
1
,x
2
,...,x
n
, 1
]
T
.
Applying Gauss elimination, Equation (A.4) can be reduced to an upper triangular
form:
G x = 0 , (A.5)
where
G =





g
11
g
12
g
13
... ... g
1n

p
1
0 g
22
g
23
... ... g
2n
p
2
00
.
.
.
.
.
. ...
.
.
.
.
.
.
000g
m,m
... g
mn
p
m






.
The last row in Equation (A.5) contains n − m + 1 unknowns which can be solved
by the procedure outlined in the preceding section. Once x
m
,...,x
n
are known, the
remaining unknowns are found by back substitution.
Example A.1 We wish to solve the following two equations for all possible nonneg-
ative integers of x
i
s
x
1
+ x
2
+ x
3
= 6 , (A.6)
2x
1
+ 3x
2
+ 4x
3
= 16 . (A.7)

Subtracting Equation (A.6)×2 from Equation (A.7), we obtain
x
2
+ 2x
3
= 4 . (A.8)
Equation (A.8) contains two unknowns. Since both 2x
3
and 4 are even numbers, x
2
must be an even number. Let x
2
assume the values of 0, 2, and 4, one at a time, and
solve Equation (A.8) for x
3
. Once x
3
is found, we solve Equation (A.6) for x
1
.Asa
result, we obtain the three solutions:
Solution
x
1
x
2
x
3
1 402
2 321.

3 240
© 2001 by CRC Press LLC
References
[1] Gelfond, A.O., 1981, Solving Equations in Integers, Translated by Sheinin,
O.B., Mir Publisher, Moscow.
© 2001 by CRC Press LLC

×