Saturday, February 18, 2017
How To Find Integer Solutions (If Any) Of A Nonlinear System Of Equations, Improved Edition
Jsun Yui Wong
The computer program listed below seeks to find integer solutions (if any) of the first problem on page 177 of Conley [4], which is to solve
X(1)^2 + 3 * X(2) + 5 * X(4) + 6 * X(3) + 7 * X(6)) =5492,
2 * X(1) * X(2) * X(3) + X(4) + X(5) + X(6)= 1114 X(5) = 638213,
X(1) + X(2) + X(3) + 9 * X(4) + 11 * X(5) + X(6)=2787,
3 * X(1) + 4 * X(2) + X(3) + X(4) + 6 * X(5) + 7 * X(6)=1768,
13 * X(1) + X(2) * X(3) * X(4) + X(5) * X(6)=844252,
where 0<=X(i)>=200 and X(i)'s are whole numbers.
0 DEFDBL A-Z
3 DEFINT J, K, X
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
77 IF JJJJ > -32000 THEN GOTO 88 ELSE GOTO 91
88 IF RND < .05 THEN GOTO 91 ELSE GOTO 128
91 FOR KK = 1 TO 6
94 A(KK) = 100
95 NEXT KK
128 FOR I = 1 TO 1250000
129 FOR K = 1 TO 6
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 1 + FIX(RND * 6)
182 REM IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
1005 N88 = 5492 - 3 * X(2) - 5 * X(4) - 6 * X(3) - 7 * X(6) - X(1) ^ 2
1006 N89 = 638213 - 2 * X(1) * X(2) * X(3) - X(4) - X(6) - X(5)
1009 N91 = -1768 + 3 * X(1) + 4 * X(2) + X(3) + X(4) + 6 * X(5) + 7 * X(6)
1113 REM
1117 N93 = -2787 + X(1) + X(2) + X(3) + 9 * X(4) + 11 * X(5) + X(6)
1119 N94 = -844252 + 13 * X(1) + X(2) * X(3) * X(4) + X(5) * X(6)
1335 P = -ABS(N91) - ABS(N93) - ABS(N94) - ABS(N88) - ABS(N89)
1499 IF P <= M THEN 1670
1657 FOR KEW = 1 TO 6
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1664 NN88 = N88: NN89 = N89: NN91 = N91: NN93 = N93: NN94 = N94
1670 NEXT I
1888 IF M < 0 THEN 1999
1917 PRINT A(1), A(2), A(3), A(4), A(5), A(6), M, JJJJ, NN88, NN89, NN91, NN93, NN94
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [10]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-27462 is shown below:
58 47 117 152 102
750 0 -31268 0 0
0 0 0
58 47 117 152 102
750 0 -31267 0 0
0 0 0
58 47 117 152 102
750 0 -31266 0 0
0 0 0
58 47 117 152 102
750 0 -30638 0 0
0 0 0
58 47 117 152 102
750 0 -30441 0 0
0 0 0
58 47 117 152 102
750 0 -30440 0 0
0 0 0
58 47 117 152 102
750 0 -27462 0 0
0 0 0
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [10], the wall-clock time through
JJJJ=-27462 was one hour and forty minutes.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] W. Conley, Computer Optimization Techniques, Revised Edition. Petrocelli Books, Inc., NY/Princeton, 1984.
[5] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[6] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[7] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[8] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[9] Terry E. Shoup, Applied Numerical Methods for the Microcomputer, Prentice-Hall, 1984.
[10] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
Wednesday, February 15, 2017
How To Find Integer Solutions (If Any) Of A Nonlinear System Of Equations--Yet Another System
Jsun Yui Wong
The computer program listed below seeks to find integer solutions (if any) of the first problem on page 177 of Conley [4], which is to solve
X(1)^2 + 3 * X(2) + 5 * X(4) + 6 * X(3) + 7 * X(6)) =5492,
2 * X(1) * X(2) * X(3) + X(4) + X(5) + X(6)= 1114 X(5) = 638213,
X(1) + X(2) + X(3) + 9 * X(4) + 11 * X(5) + X(6)=2787,
3 * X(1) + 4 * X(2) + X(3) + X(4) + 6 * X(5) + 7 * X(6)=1768,
13 * X(1) + X(2) * X(3) * X(4) + X(5) * X(6)=844252,
where 0<=X(i)>=200 and X(i)'s are whole numbers.
0 DEFDBL A-Z
3 DEFINT J, K, X
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 1 TO 6
94 A(KK) = FIX(RND * 201)
95 NEXT KK
128 FOR I = 1 TO 2000000
129 FOR K = 1 TO 6
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 1 + FIX(RND * 6)
182 IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
1001 REM
1004 X(1) = (5492 - 3 * X(2) - 5 * X(4) - 6 * X(3) - 7 * X(6)) ^ .5
1114 X(5) = 638213 - 2 * X(1) * X(2) * X(3) - X(4) - X(6)
1009 N91 = -1768 + 3 * X(1) + 4 * X(2) + X(3) + X(4) + 6 * X(5) + 7 * X(6)
1113 REM
1117 N93 = -2787 + X(1) + X(2) + X(3) + 9 * X(4) + 11 * X(5) + X(6)
1119 N94 = -844252 + 13 * X(1) + X(2) * X(3) * X(4) + X(5) * X(6)
1335 P = -ABS(N91) - ABS(N92) - ABS(N93) - ABS(N94)
1499 IF P <= M THEN 1670
1657 FOR KEW = 1 TO 6
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1664 NN91 = N91: NN92 = N92: NN93 = N93: NN94 = N94
1670 NEXT I
1888 IF M < -1400 THEN 1999
1917 PRINT A(1), A(2), A(3), A(4), A(5), A(6), M, JJJJ, JJJJ, JJJJ, NN91, NN92, NN93, NN94
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [10]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-29108 is shown below:
53 82 96 105 86
198 -1314 -30920 -30920 -30920
822 0 -467 25
55 139 46 129 111
169 -1029 -29865 -29865 -29865
977 0 4 48
58 47 117 152 102
75 0 -29108 -29108 -29108
0 0 0 0
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [10], the wall-clock time through
JJJJ=-29108 was two hours.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] W. Conley, Computer Optimization Techniques, Revised Edition. Petrocelli Books, Inc., NY/Princeton, 1984.
[5] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[6] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[7] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[8] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[9] Terry E. Shoup, Applied Numerical Methods for the Microcomputer, Prentice-Hall, 1984.
[10] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
The computer program listed below seeks to find integer solutions (if any) of the first problem on page 177 of Conley [4], which is to solve
X(1)^2 + 3 * X(2) + 5 * X(4) + 6 * X(3) + 7 * X(6)) =5492,
2 * X(1) * X(2) * X(3) + X(4) + X(5) + X(6)= 1114 X(5) = 638213,
X(1) + X(2) + X(3) + 9 * X(4) + 11 * X(5) + X(6)=2787,
3 * X(1) + 4 * X(2) + X(3) + X(4) + 6 * X(5) + 7 * X(6)=1768,
13 * X(1) + X(2) * X(3) * X(4) + X(5) * X(6)=844252,
where 0<=X(i)>=200 and X(i)'s are whole numbers.
0 DEFDBL A-Z
3 DEFINT J, K, X
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 1 TO 6
94 A(KK) = FIX(RND * 201)
95 NEXT KK
128 FOR I = 1 TO 2000000
129 FOR K = 1 TO 6
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 1 + FIX(RND * 6)
182 IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
1001 REM
1004 X(1) = (5492 - 3 * X(2) - 5 * X(4) - 6 * X(3) - 7 * X(6)) ^ .5
1114 X(5) = 638213 - 2 * X(1) * X(2) * X(3) - X(4) - X(6)
1009 N91 = -1768 + 3 * X(1) + 4 * X(2) + X(3) + X(4) + 6 * X(5) + 7 * X(6)
1113 REM
1117 N93 = -2787 + X(1) + X(2) + X(3) + 9 * X(4) + 11 * X(5) + X(6)
1119 N94 = -844252 + 13 * X(1) + X(2) * X(3) * X(4) + X(5) * X(6)
1335 P = -ABS(N91) - ABS(N92) - ABS(N93) - ABS(N94)
1499 IF P <= M THEN 1670
1657 FOR KEW = 1 TO 6
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1664 NN91 = N91: NN92 = N92: NN93 = N93: NN94 = N94
1670 NEXT I
1888 IF M < -1400 THEN 1999
1917 PRINT A(1), A(2), A(3), A(4), A(5), A(6), M, JJJJ, JJJJ, JJJJ, NN91, NN92, NN93, NN94
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [10]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-29108 is shown below:
53 82 96 105 86
198 -1314 -30920 -30920 -30920
822 0 -467 25
55 139 46 129 111
169 -1029 -29865 -29865 -29865
977 0 4 48
58 47 117 152 102
75 0 -29108 -29108 -29108
0 0 0 0
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [10], the wall-clock time through
JJJJ=-29108 was two hours.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] W. Conley, Computer Optimization Techniques, Revised Edition. Petrocelli Books, Inc., NY/Princeton, 1984.
[5] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[6] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[7] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[8] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[9] Terry E. Shoup, Applied Numerical Methods for the Microcomputer, Prentice-Hall, 1984.
[10] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
Tuesday, February 14, 2017
How to Find Integer Solutions (if any) of a Nonlinear Systems of Equations
Jsun Yui Wong
The computer program listed below seeks to find integer solutions (if any) of the following nonlinear system, which is based on the nonlinear system of five variables on page 238 of Shoup [8].
X(1) + X(2) + X(3) + X(4) = 31,
X(1) * X(2) + X(2) * X(3) + X(4) * X(5) = 52,
X(1) ^ 2 + X(3) * X(4) - X(2) ^ 2 + X(1) * X(5) = 86,
X(1) - X(2) * X(4) + X(3) ^ 2 + X(5) ^ 3 = 19,
X(1) * X(3) - X(2) ^ 3 * X(5) - X(5) * X(2) + X(3) ^ 2 * X(4) = 240.
0 DEFDBL A-Z
3 DEFINT J, K
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 1 TO 5
94 A(KK) = -10 + FIX(RND * 20)
95 NEXT KK
128 FOR I = 1 TO 3000000
129 FOR K = 1 TO 5
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 1 + FIX(RND * 5)
182 IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
1001 X(4) = 31 - X(1) - X(2) - X(3)
1004 REM
1111 N96 = -52 + X(1) * X(2) + X(2) * X(3) + X(4) * X(5)
1116 N97 = -86 + X(1) ^ 2 + X(3) * X(4) - X(2) ^ 2 + X(1) * X(5)
1118 N98 = -19 + X(1) - X(2) * X(4) + X(3) ^ 2 + X(5) ^ 3
1119 N99 = -240 + X(1) * X(3) - X(2) ^ 3 * X(5) - X(5) * X(2) + X(3) ^ 2 * X(4)
1335 P = -ABS(N96) - ABS(N97) - ABS(N98) - ABS(N99)
1499 IF P <= M THEN 1670
1657 FOR KEW = 1 TO 5
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1666 NN96 = N96: NN97 = N97: NN98 = N98: NN99 = N99
1670 NEXT I
1888 IF M < -29 THEN 1999
1917 PRINT A(1), A(2), A(3), A(4), A(5), M, JJJJ, NN96, NN97, NN98, NN99
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [9]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-31997 is shown below:
2 0 3 26 2
0 -32000 0 0 0
0
2 0 3 26 2
0 -31999 0 0 0
0
2 0 3 26 2
0 -31997 0 0 0
0
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [9], the wall-clock time through
JJJJ=-31997 was 25 seconds, not including "Creating .EXE file..." time.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[5] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[6] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[7] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[9] Terry E. Shoup, Applied Numerical Methods for the Microcomputer, Prentice-Hall, 1984.
[9] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
Sunday, February 12, 2017
Computer Solutions/Integer Solutions of Nonlinear Systems of Equations
Jsun Yui Wong
The two computer programs listed below seek to solve a continuous case and an integer case of two nonlinear systems of equations, respectively. The first case comes from page 44 of Greenspan and Casulli [4] and is as follows:
-10 * X(1) + 5 * X(2) - EXP(X(1)),
5 * X(1) - 10 * X(2) + 5 * X(3) - EXP(X(2)),
5 * X(2) - 10 * X(3) + 5 * X(4) - EXP(X(3)),
5*X(3) - 10 * X(4) - EXP(X(4))=0.
0 DEFDBL A-Z
3 DEFINT J, K
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 1 TO 4
94 A(KK) = -10 + FIX(RND * 21)
95 NEXT KK
128 FOR I = 1 TO 500000
129 FOR K = 1 TO 4
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 1 + FIX(RND * 4)
182 REM IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
291 FOR j44 = 1 TO 4
293 IF X(j44) > 30 THEN 1670
299 NEXT j44
333 X(3) = (10 * X(4) + EXP(X(4))) / 5
334 IF X(3) > 30 THEN 1670
336 N96 = 5 * X(1) - 10 * X(2) + 5 * X(3) - EXP(X(2))
338 N97 = 5 * X(2) - 10 * X(3) + 5 * X(4) - EXP(X(3))
344 N98 = -10 * X(1) + 5 * X(2) - EXP(X(1))
1335 P = -ABS(N96) - ABS(N97) - ABS(N98)
1499 IF P <= M THEN 1670
1657 FOR KEW = 1 TO 4
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1670 NEXT I
1888 IF M < -.000001 THEN 1999
1917 PRINT A(1), A(2), A(3), A(4), M, JJJJ
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [8]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-31982 is shown below:
-.282813848003122 -.4148956819788955 -.4148956819702162
-.2828138479984057 -3.60628082951564D-10 -31985
-.2828138480373464 -.414895681997618 -.4148956820101716
-.2828138480169833 -7.031838999971285D-10 -31983
-.2828138480379652 -.4148956820071726 -.4148956819847773
-.282813848005176 -6.283482067992452D-10 -31982
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [8], the wall-clock time through JJJJ=-31982 was 15 seconds, not including "Creating .EXE file..." time.
The second case--shown below--comes from page 47 of Greenspan and Casulli [4]:
X(1) +X(2) + X(3) + X(4) =0,
LOG(X(1)) + X(2) + LOG(X(3)) + X(4) = -2,
X(1) * X(2) * X(3) - X(4) =0,
X(1) - EXP(X(2)) + X(3) + EXP(X(4)) =2.
0 DEFDBL A-Z
3 DEFINT J, K
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 1 TO 4
94 A(KK) = -50 + FIX(RND * 101)
95 NEXT KK
128 FOR I = 1 TO 1000
129 FOR K = 1 TO 4
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 1 + FIX(RND * 4)
182 IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
1001 X(1) = -X(2) - X(3) - X(4)
1002 IF X(1) < .01 THEN 1670
1003 IF X(3) < .01 THEN 1670
1004 N96 = LOG(X(1)) + X(2) + LOG(X(3)) + X(4) + 2
1007 N97 = X(1) * X(2) * X(3) - X(4)
1009 N98 = X(1) - EXP(X(2)) + X(3) + EXP(X(4)) - 2
1335 P = -ABS(N96) - ABS(N97) - ABS(N98)
1499 IF P <= M THEN 1670
1657 FOR KEW = 1 TO 4
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1670 NEXT I
1888 IF M < -1 THEN 1999
1917 PRINT A(1), A(2), A(3), A(4), M, JJJJ
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [8]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-31911 is shown below:
1 -1 1 -1 0
-31982
1 -1 1 -1 0
-31947
1 -1 1 -1 0
-31936
1 -1 1 -1 0
-31926
1 -1 1 -1 0
-31923
1 -1 1 -1 0
-31917
1 -1 1 -1 0
-31911
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [8], the wall-clock time through JJJJ=-31911 was 2 seconds, not including "Creating .EXE file..." time.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[5] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[6] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[7] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[8] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
Thursday, February 9, 2017
Solving a Nonlinear System of Equations
Jsun Yui Wong
The computer program listed below seeks to solve simultaneously the following nonlinear system of equations from page 665 of Burden, Faires, and Burden [1, p. 665, Exercise 6]:
4 * X(1) -X( 2) +X(3) = X(1) * X(4),
-X(1) + 3 * X(2) - 2 * X(3) = X(2) * X(4),
X(1) - 2 * X(2) + 3 * X(3) = X(3) * X(4),
X(1) ^ 2 + X(2) ^ 2 + X(3) ^ 2 = 1.
0 DEFDBL A-Z
3 DEFINT J, K
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 96 TO 99
94 A(KK) = -20 + FIX(RND * 150)
95 NEXT KK
128 FOR I = 1 TO 8000
129 FOR K = 96 TO 99
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 96 + FIX(RND * 9)
182 REM IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
331 X(98) = X(96) * X(99) + X(97) - 4 * X(96)
335 REM N98 = X(96) ^ 2 - 625 * X(97) ^ 2 - 1 / 4
339 REM N99 = EXP(-X(96) * X(97)) + 20 * X(98) + (10 * 3.141592654 - 3) / 3
351 N97 = -X(97) * X(99) - X(96) + 3 * X(97) - 2 * X(98)
353 N98 = -X(98) * X(99) + X(96) - 2 * X(97) + 3 * X(98)
355 REM N98 = -X(98) * X(99) + X(97) - 4 * X(96)
359 N99 = -1 + X(96) ^ 2 + X(97) ^ 2 + X(98) ^ 2
1335 P = -ABS(N98) - ABS(N99) - ABS(N97)
1499 IF P <= M THEN 1670
1657 FOR KEW = 96 TO 99
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1670 NEXT I
1888 IF M < -.0000001 THEN 1999
1917 PRINT A(96), A(97), A(98), A(99), M, JJJJ
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [8]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-30366 is shown below:
-2.493654401671402D-15 .7071068014058323 .7071068014058398
.9999999980999506 -5.98758606780458D-08 -31892
8.33475294629724D-18 .7071067794128311 .7071067794128311
1.000000018454071 -3.111482494474582D-08 -31647
7.720047542022925D-10 .707106789031514 .7071067867154998
1.000000005454302 -2.663362473018802D-08 -31561
3.038262892746562D-09 .7071067999755675 .707106790860779
1.00000002148609 -7063893669385927D-08 -30989
4.231662939811113D-10 .7071067906077655 .7071067893382665
.9999999970098467 -2.908354898334712D-08 -30691
0 -.7071067723044366 -.7071067723044366
1.00000000499632 -3.218826598465926D-08 -30366
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [8], the wall-clock time through
JJJJ=-30366 was 30 seconds.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[5] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[6] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[7] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[8] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
Tuesday, February 7, 2017
Simultaneously Solving a Nonlinear System of Transcendental Equations
Jsun Yui Wong
The computer program listed below seeks to solve simultaneously the following nonlinear system of equations from Burden, Faires,and Burden [1, p. 656, Exercise 7d]:
6*X(1) - 2 * COS(X(2) * X(3)) - 1 = 0,
9 * X(2) + (X(1) ^ 2 + SIN(X(3)) + 1.06) ^ .5 + .9 = 0,
60 * X(3) + 3 * EXP(-X(1) * X(2)) + 10 * 3.141592654 - 3 = 0.
0 DEFDBL A-Z
3 DEFINT J, K
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 91 TO 98
94 A(KK) = -20 + FIX(RND * 150)
95 NEXT KK
128 FOR I = 1 TO 8000
129 FOR K = 91 TO 98
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 91 + FIX(RND * 8)
182 REM IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
331 X(96) = (2 * COS(X(97) * X(98)) + 1) / 6
335 N98 = 9 * X(97) + (X(96) ^ 2 + SIN(X(98)) + 1.06) ^ .5 + .9
339 N99 = 3 * EXP(-X(96) * X(97)) + 60 * X(98) + (10 * 3.141592654 - 3)
1335 P = -ABS(N98) - ABS(N99)
1499 IF P <= M THEN 1670
1657 FOR KEW = 96 TO 98
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1670 NEXT I
1888 IF M < -.000001 THEN 1999
1917 PRINT A(96), A(97), A(98), M, JJJJ
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [8]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-30739 is shown below:
.4981446846090066 -.1996058948931147 -.5288259765133804
-7.301866214139618D-08 -31894
.4981446845080947 -.1996058989003793 -.5288259802917031
-1.850737475616996D-07 -30848
.4981446846603527 -.1996058928890903 -.5288259744982781
-2.096859361336691D-07 -30739
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [8], the wall-clock time through
JJJJ=-30739 was 30 seconds.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[5] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[6] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[7] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[8] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
The computer program listed below seeks to solve simultaneously the following nonlinear system of equations from Burden, Faires,and Burden [1, p. 656, Exercise 7d]:
6*X(1) - 2 * COS(X(2) * X(3)) - 1 = 0,
9 * X(2) + (X(1) ^ 2 + SIN(X(3)) + 1.06) ^ .5 + .9 = 0,
60 * X(3) + 3 * EXP(-X(1) * X(2)) + 10 * 3.141592654 - 3 = 0.
0 DEFDBL A-Z
3 DEFINT J, K
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 91 TO 98
94 A(KK) = -20 + FIX(RND * 150)
95 NEXT KK
128 FOR I = 1 TO 8000
129 FOR K = 91 TO 98
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 91 + FIX(RND * 8)
182 REM IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 1.99) ELSE X(B) = A(B) + FIX(1 + RND * 1.99)
191 NEXT IPP
331 X(96) = (2 * COS(X(97) * X(98)) + 1) / 6
335 N98 = 9 * X(97) + (X(96) ^ 2 + SIN(X(98)) + 1.06) ^ .5 + .9
339 N99 = 3 * EXP(-X(96) * X(97)) + 60 * X(98) + (10 * 3.141592654 - 3)
1335 P = -ABS(N98) - ABS(N99)
1499 IF P <= M THEN 1670
1657 FOR KEW = 96 TO 98
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1670 NEXT I
1888 IF M < -.000001 THEN 1999
1917 PRINT A(96), A(97), A(98), M, JJJJ
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [8]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-30739 is shown below:
.4981446846090066 -.1996058948931147 -.5288259765133804
-7.301866214139618D-08 -31894
.4981446845080947 -.1996058989003793 -.5288259802917031
-1.850737475616996D-07 -30848
.4981446846603527 -.1996058928890903 -.5288259744982781
-2.096859361336691D-07 -30739
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [8], the wall-clock time through
JJJJ=-30739 was 30 seconds.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[5] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[6] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[7] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[8] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
Sunday, January 22, 2017
Simultaneously Solving in General Integers a Nonlinear System of 42 Simultaneous Equations, Including Transcendental Equations, in 41 General Integer Variables
Jsun Yui Wong
The computer program listed below seeks to solve simultaneously the following nonlinear system of equations:
X(44)^ + X(45)^2 + X(46)^2 +...+ X(84)^2 = 636,
-1 + LOG(X(82)) - X(83) - X(84) =0,
X(84) = -2 + X(82) ^ 2 + X(83) ^ 2,
X(82) + EXP(X(83)) + X(84) - 1 =0,
X(78) = -X(79) - X(80) - X(81),
LOG(X(78)) + X(79) + LOG(X(80)) + X(81) + 2 =0,
X(78) * X(79) * X(80) - X(81) =0,
X(78) - EXP(X(79)) + X(80) + EXP(X(81)) - 2 =0,
X(74) = -X(75) ^ 3 + 5 * X(75) ^ 2 + X(75) + 10,
-29 + X(74) + X(75) ^ 3 + X(75) ^ 2 - 14 * X(75) =0,
X(76) = -X(77) ^ 3 + 5 * X(77) ^ 2 + 2 * X(77) + 11,
-29 + X(76) + X(77) ^ 3 + X(77) ^ 2 - 14 * X(77)=0,
-5 + 10 * X(71) - 2 * X(72) ^ 2 + X(72) - 2 * X(73) ^ 2 = 0,
-12 + 8 * X(72) ^ 2 + 4 * X(73) ^ 2 = 0,
8 + 8 * X(72) * X(73) = 0,
X(67) = -10 + X(65) ^ 2 + 10 * X(66),
-12 + 15 * X(65) + X(66) - 4 * X(67) = 0,
24 + X(66) - 25 * X(67) = 0,
-7 + 10 * X(68) - 2 * X(69) ^ 2 + X(69) - 2 * X(70) ^ 2 = 0,
-12 + 8 * X(69) ^ 2 + 4 * X(70) ^ 2 = 0,
8 + 8 * X(69) * X(70) = 0,
X(54) = -X(52) ^ 2,
X(52) * COS(X(53)) - X(54) = 0,
(EXP(X(52) + X(54))) * SIN(X(53) / 2) + X(54) = 0,
X(55) ^ 5 + X(56) ^ 3 * X(57) ^ 4 + 1 = 0,
X(55) * X(56) * X(57) = 0,
X(57) ^ 4 - 1 = 0,
X(44) * X(45) * X(46) * X(47) * X(48) * X(49) * X(50) * X(51) = 1,
X(44) = -2 * X(45) - X(46) - X(47) - X(48) - X(49) - X(50) - X(51) + 9,
2 * X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + 2 * X(46) + X(47) + X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + 2 * X(47) + X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + X(47) + 2 * X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + X(47) + X(48) + 2 * X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + 2 * X(50) + X(51) = 9,
-18 - X(61) * (X(61) + 1) + 2 * X(62) =0,
-25 + (X(61) - 1) ^ 2 + (X(62) - 6) ^ 2=0,
X(63) ^ 2 - 10 * X(63) + X(64) ^ 2 + 8=0,
X(63) * X(64) ^ 2 + X(63) - 10 * X(64) + 8=0,
X(41) ^ 2 + X(42) - 37 = 0,
X(41) - X(42) ^ 2 - 5 = 0,
X(41) + X(42) + X(43) - 3 = 0,
and
-10<= Integers X(i)<= 20 for i= 44 through 84.
Equation 2 to equation 8 above are based on page 47 of Greenspan and Casulli [4]. The next four equations are based on page 510 of Burden and Faires [3], and the next nine are based on page 604 of Burden and Faires [2]. The next six equations come from Johnson and Riess [5]-- the first three from p. 194 and the other three from p. 198. The next eight equations are based on p. 510 of Burden and Faires [3, p. 510]. The last seven equations come from p. 648 and p. 649 of Burden, Faires, and Burden [1].
One notes line 13 and line 189, which are 13 A(KNEW) = -10 + FIX(RND * 30.98) and
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 5.99) ELSE X(B) = A(B) + FIX(1 + RND * 5.99), respectively.
0 REM DEFDBL A-Z
3 DEFINT J, K, X
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
13 A(KNEW) = -10 + FIX(RND * 30.98)
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 44 TO 84
94 A(KK) = A(KNEW)
95 NEXT KK
128 FOR I = 1 TO 200000
129 FOR K = 44 TO 84
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 44 + FIX(RND * 41)
182 IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
187 REM IF RND < .25 THEN X(B) = A(B) + RND * R ELSE IF RND < .333 THEN X(B) = A(B) + RND ^ 4 * R ELSE IF RND < .5 THEN X(B) = A(B) + RND ^ 7 * R ELSE X(B) = CINT(A(B))
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 5.99) ELSE X(B) = A(B) + FIX(1 + RND * 5.99)
191 NEXT IPP
255 FOR J45 = 44 TO 84
256 IF X(J45) < -10 THEN X(J45) = A(J45)
257 IF X(J45) > 20 THEN X(J45) = A(J45)
259 NEXT J45
451 X(54) = -X(52) ^ 2
453 N44 = X(52) * COS(X(53)) - X(54)
455 N45 = (EXP(X(52) + X(54))) * SIN(X(53) / 2) + X(54)
461 N46 = X(55) ^ 5 + X(56) ^ 3 * X(57) ^ 4 + 1
463 N47 = X(55) * X(56) * X(57)
465 N48 = X(57) ^ 4 - 1
499 X(44) = -2 * X(45) - X(46) - X(47) - X(48) - X(49) - X(50) - X(51) + 9
501 N35 = 2 * X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + X(50) + X(51) - 9
504 N38 = X(44) + X(45) + 2 * X(46) + X(47) + X(48) + X(49) + X(50) + X(51) - 9
505 N39 = X(44) + X(45) + X(46) + 2 * X(47) + X(48) + X(49) + X(50) + X(51) - 9
506 N40 = X(44) + X(45) + X(46) + X(47) + 2 * X(48) + X(49) + X(50) + X(51) - 9
507 N41 = X(44) + X(45) + X(46) + X(47) + X(48) + 2 * X(49) + X(50) + X(51) - 9
508 N42 = X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + 2 * X(50) + X(51) - 9
509 N43 = X(44) * X(45) * X(46) * X(47) * X(48) * X(49) * X(50) * X(51) - 1
601 X(58) = X(59) ^ 2 + 5
602 N49 = X(58) ^ 2 + X(59) - 37
604 N50 = X(58) + X(59) + X(60) - 3
651 N51 = -18 - X(61) * (X(61) + 1) + 2 * X(62)
652 N52 = -25 + (X(61) - 1) ^ 2 + (X(62) - 6) ^ 2
661 N53 = X(63) ^ 2 - 10 * X(63) + X(64) ^ 2 + 8
663 N54 = X(63) * X(64) ^ 2 + X(63) - 10 * X(64) + 8
671 X(67) = -10 + X(65) ^ 2 + 10 * X(66)
673 N55 = -12 + 15 * X(65) + X(66) - 4 * X(67)
675 N56 = 24 + X(66) - 25 * X(67)
681 N57 = -7 + 10 * X(68) - 2 * X(69) ^ 2 + X(69) - 2 * X(70) ^ 2
683 N58 = -12 + 8 * X(69) ^ 2 + 4 * X(70) ^ 2
685 N59 = 8 + 8 * X(69) * X(70)
691 N60 = -5 + 10 * X(71) - 2 * X(72) ^ 2 + X(72) - 2 * X(73) ^ 2
693 N61 = -12 + 8 * X(72) ^ 2 + 4 * X(73) ^ 2
695 N62 = 8 + 8 * X(72) * X(73)
751 X(74) = -X(75) ^ 3 + 5 * X(75) ^ 2 + X(75) + 10
755 N63 = -29 + X(74) + X(75) ^ 3 + X(75) ^ 2 - 14 * X(75)
851 X(76) = -X(77) ^ 3 + 5 * X(77) ^ 2 + 2 * X(77) + 11
855 N64 = -29 + X(76) + X(77) ^ 3 + X(77) ^ 2 - 14 * X(77)
901 X(78) = -X(79) - X(80) - X(81)
902 IF X(78) < .1 THEN GOTO 1670
903 IF X(80) < .1 THEN GOTO 1670
904 N66 = LOG(X(78)) + X(79) + LOG(X(80)) + X(81) + 2
906 N67 = X(78) * X(79) * X(80) - X(81)
909 N68 = X(78) - EXP(X(79)) + X(80) + EXP(X(81)) - 2
921 X(84) = -2 + X(82) ^ 2 + X(83) ^ 2
923 IF X(82) < .1 THEN GOTO 1670
925 N69 = -1 + LOG(X(82)) - X(83) - X(84)
927 N70 = X(82) + EXP(X(83)) + X(84) - 1
951 SUMJAN = 0
963 FOR JJAN = 44 TO 84
955 SUMJAN = SUMJAN + X(JJAN) ^ 2
958 NEXT JJAN
1287 P = -ABS(N44) - ABS(N45) - ABS(N46) - ABS(N47) - ABS(N48) - ABS(N49) - ABS(N50) - ABS(N51) - ABS(N52) - ABS(N53) - ABS(N54) - ABS(N55) - ABS(N56) - ABS(N57) - ABS(N58) - ABS(N59) - ABS(N60) - ABS(N61) - ABS(N62) - ABS(N63) - ABS(N64) - ABS(N65) - ABS(N66) - ABS(N67) - ABS(N68) - ABS(N69) - ABS(N70) - ABS(N33) - ABS(N34) - ABS(N35) - ABS(N36) - ABS(N37) - ABS(N38) - ABS(N39) - ABS(N40) - ABS(N41) - ABS(N42) - ABS(N43) - ABS(SUMJAN - 636)
1451 IF P <= M THEN 1670
1657 FOR KEW = 44 TO 84
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1670 NEXT I
1888 IF M < -4 THEN 1999
1917 PRINT A(44), A(45), A(46), A(47), A(48), A(49), A(50), A(51), M, JJJJ
1918 PRINT A(52), A(53), A(54), A(55), A(56), A(57), A(58), A(59), A(60), A(61), A(62), A(63), A(64), A(65), A(66), A(67), A(68), A(69), A(70), A(71), A(72), A(73), A(74), A(75), A(76), A(77), A(78), A(79), A(80), A(81), A(82), A(83), A(84)
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [8]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-6187 is shown below:
1 1 1 1 1
1 1 1 -4 -29356
0 0 0 0 -1
1 6 1 -4 -2
10 1 1 1 1
1 1 -1 1 1
1 -1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 -3.012512 -28188
1 3 -1 -1 0
-1 6 1 -2 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 0 -16280
0 0 0 -1 0
1 6 1 -4 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 -1.479426 -12332
0 -1 0 0 -1
1 6 1 -4 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 0 -6187
0 0 0 -1 0
1 6 1 -4 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [8], the wall-clock time through JJJJ=-6187 was ten hours.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[5] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[6] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[7] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[8] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
The computer program listed below seeks to solve simultaneously the following nonlinear system of equations:
X(44)^ + X(45)^2 + X(46)^2 +...+ X(84)^2 = 636,
-1 + LOG(X(82)) - X(83) - X(84) =0,
X(84) = -2 + X(82) ^ 2 + X(83) ^ 2,
X(82) + EXP(X(83)) + X(84) - 1 =0,
X(78) = -X(79) - X(80) - X(81),
LOG(X(78)) + X(79) + LOG(X(80)) + X(81) + 2 =0,
X(78) * X(79) * X(80) - X(81) =0,
X(78) - EXP(X(79)) + X(80) + EXP(X(81)) - 2 =0,
X(74) = -X(75) ^ 3 + 5 * X(75) ^ 2 + X(75) + 10,
-29 + X(74) + X(75) ^ 3 + X(75) ^ 2 - 14 * X(75) =0,
X(76) = -X(77) ^ 3 + 5 * X(77) ^ 2 + 2 * X(77) + 11,
-29 + X(76) + X(77) ^ 3 + X(77) ^ 2 - 14 * X(77)=0,
-5 + 10 * X(71) - 2 * X(72) ^ 2 + X(72) - 2 * X(73) ^ 2 = 0,
-12 + 8 * X(72) ^ 2 + 4 * X(73) ^ 2 = 0,
8 + 8 * X(72) * X(73) = 0,
X(67) = -10 + X(65) ^ 2 + 10 * X(66),
-12 + 15 * X(65) + X(66) - 4 * X(67) = 0,
24 + X(66) - 25 * X(67) = 0,
-7 + 10 * X(68) - 2 * X(69) ^ 2 + X(69) - 2 * X(70) ^ 2 = 0,
-12 + 8 * X(69) ^ 2 + 4 * X(70) ^ 2 = 0,
8 + 8 * X(69) * X(70) = 0,
X(54) = -X(52) ^ 2,
X(52) * COS(X(53)) - X(54) = 0,
(EXP(X(52) + X(54))) * SIN(X(53) / 2) + X(54) = 0,
X(55) ^ 5 + X(56) ^ 3 * X(57) ^ 4 + 1 = 0,
X(55) * X(56) * X(57) = 0,
X(57) ^ 4 - 1 = 0,
X(44) * X(45) * X(46) * X(47) * X(48) * X(49) * X(50) * X(51) = 1,
X(44) = -2 * X(45) - X(46) - X(47) - X(48) - X(49) - X(50) - X(51) + 9,
2 * X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + 2 * X(46) + X(47) + X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + 2 * X(47) + X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + X(47) + 2 * X(48) + X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + X(47) + X(48) + 2 * X(49) + X(50) + X(51) = 9,
X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + 2 * X(50) + X(51) = 9,
-18 - X(61) * (X(61) + 1) + 2 * X(62) =0,
-25 + (X(61) - 1) ^ 2 + (X(62) - 6) ^ 2=0,
X(63) ^ 2 - 10 * X(63) + X(64) ^ 2 + 8=0,
X(63) * X(64) ^ 2 + X(63) - 10 * X(64) + 8=0,
X(41) ^ 2 + X(42) - 37 = 0,
X(41) - X(42) ^ 2 - 5 = 0,
X(41) + X(42) + X(43) - 3 = 0,
and
-10<= Integers X(i)<= 20 for i= 44 through 84.
Equation 2 to equation 8 above are based on page 47 of Greenspan and Casulli [4]. The next four equations are based on page 510 of Burden and Faires [3], and the next nine are based on page 604 of Burden and Faires [2]. The next six equations come from Johnson and Riess [5]-- the first three from p. 194 and the other three from p. 198. The next eight equations are based on p. 510 of Burden and Faires [3, p. 510]. The last seven equations come from p. 648 and p. 649 of Burden, Faires, and Burden [1].
One notes line 13 and line 189, which are 13 A(KNEW) = -10 + FIX(RND * 30.98) and
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 5.99) ELSE X(B) = A(B) + FIX(1 + RND * 5.99), respectively.
0 REM DEFDBL A-Z
3 DEFINT J, K, X
4 DIM X(342), A(342), L(333), K(333)
12 FOR JJJJ = -32000 TO 32000
13 A(KNEW) = -10 + FIX(RND * 30.98)
14 RANDOMIZE JJJJ
16 M = -1D+317
91 FOR KK = 44 TO 84
94 A(KK) = A(KNEW)
95 NEXT KK
128 FOR I = 1 TO 200000
129 FOR K = 44 TO 84
131 X(K) = A(K)
132 NEXT K
155 FOR IPP = 1 TO FIX(1 + RND * 3)
181 B = 44 + FIX(RND * 41)
182 IF RND < -.1 THEN 183 ELSE GOTO 189
183 R = (1 - RND * 2) * A(B)
186 X(B) = A(B) + (RND ^ 3) * R
187 REM IF RND < .25 THEN X(B) = A(B) + RND * R ELSE IF RND < .333 THEN X(B) = A(B) + RND ^ 4 * R ELSE IF RND < .5 THEN X(B) = A(B) + RND ^ 7 * R ELSE X(B) = CINT(A(B))
188 GOTO 191
189 IF RND < .5 THEN X(B) = A(B) - FIX(1 + RND * 5.99) ELSE X(B) = A(B) + FIX(1 + RND * 5.99)
191 NEXT IPP
255 FOR J45 = 44 TO 84
256 IF X(J45) < -10 THEN X(J45) = A(J45)
257 IF X(J45) > 20 THEN X(J45) = A(J45)
259 NEXT J45
451 X(54) = -X(52) ^ 2
453 N44 = X(52) * COS(X(53)) - X(54)
455 N45 = (EXP(X(52) + X(54))) * SIN(X(53) / 2) + X(54)
461 N46 = X(55) ^ 5 + X(56) ^ 3 * X(57) ^ 4 + 1
463 N47 = X(55) * X(56) * X(57)
465 N48 = X(57) ^ 4 - 1
499 X(44) = -2 * X(45) - X(46) - X(47) - X(48) - X(49) - X(50) - X(51) + 9
501 N35 = 2 * X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + X(50) + X(51) - 9
504 N38 = X(44) + X(45) + 2 * X(46) + X(47) + X(48) + X(49) + X(50) + X(51) - 9
505 N39 = X(44) + X(45) + X(46) + 2 * X(47) + X(48) + X(49) + X(50) + X(51) - 9
506 N40 = X(44) + X(45) + X(46) + X(47) + 2 * X(48) + X(49) + X(50) + X(51) - 9
507 N41 = X(44) + X(45) + X(46) + X(47) + X(48) + 2 * X(49) + X(50) + X(51) - 9
508 N42 = X(44) + X(45) + X(46) + X(47) + X(48) + X(49) + 2 * X(50) + X(51) - 9
509 N43 = X(44) * X(45) * X(46) * X(47) * X(48) * X(49) * X(50) * X(51) - 1
601 X(58) = X(59) ^ 2 + 5
602 N49 = X(58) ^ 2 + X(59) - 37
604 N50 = X(58) + X(59) + X(60) - 3
651 N51 = -18 - X(61) * (X(61) + 1) + 2 * X(62)
652 N52 = -25 + (X(61) - 1) ^ 2 + (X(62) - 6) ^ 2
661 N53 = X(63) ^ 2 - 10 * X(63) + X(64) ^ 2 + 8
663 N54 = X(63) * X(64) ^ 2 + X(63) - 10 * X(64) + 8
671 X(67) = -10 + X(65) ^ 2 + 10 * X(66)
673 N55 = -12 + 15 * X(65) + X(66) - 4 * X(67)
675 N56 = 24 + X(66) - 25 * X(67)
681 N57 = -7 + 10 * X(68) - 2 * X(69) ^ 2 + X(69) - 2 * X(70) ^ 2
683 N58 = -12 + 8 * X(69) ^ 2 + 4 * X(70) ^ 2
685 N59 = 8 + 8 * X(69) * X(70)
691 N60 = -5 + 10 * X(71) - 2 * X(72) ^ 2 + X(72) - 2 * X(73) ^ 2
693 N61 = -12 + 8 * X(72) ^ 2 + 4 * X(73) ^ 2
695 N62 = 8 + 8 * X(72) * X(73)
751 X(74) = -X(75) ^ 3 + 5 * X(75) ^ 2 + X(75) + 10
755 N63 = -29 + X(74) + X(75) ^ 3 + X(75) ^ 2 - 14 * X(75)
851 X(76) = -X(77) ^ 3 + 5 * X(77) ^ 2 + 2 * X(77) + 11
855 N64 = -29 + X(76) + X(77) ^ 3 + X(77) ^ 2 - 14 * X(77)
901 X(78) = -X(79) - X(80) - X(81)
902 IF X(78) < .1 THEN GOTO 1670
903 IF X(80) < .1 THEN GOTO 1670
904 N66 = LOG(X(78)) + X(79) + LOG(X(80)) + X(81) + 2
906 N67 = X(78) * X(79) * X(80) - X(81)
909 N68 = X(78) - EXP(X(79)) + X(80) + EXP(X(81)) - 2
921 X(84) = -2 + X(82) ^ 2 + X(83) ^ 2
923 IF X(82) < .1 THEN GOTO 1670
925 N69 = -1 + LOG(X(82)) - X(83) - X(84)
927 N70 = X(82) + EXP(X(83)) + X(84) - 1
951 SUMJAN = 0
963 FOR JJAN = 44 TO 84
955 SUMJAN = SUMJAN + X(JJAN) ^ 2
958 NEXT JJAN
1287 P = -ABS(N44) - ABS(N45) - ABS(N46) - ABS(N47) - ABS(N48) - ABS(N49) - ABS(N50) - ABS(N51) - ABS(N52) - ABS(N53) - ABS(N54) - ABS(N55) - ABS(N56) - ABS(N57) - ABS(N58) - ABS(N59) - ABS(N60) - ABS(N61) - ABS(N62) - ABS(N63) - ABS(N64) - ABS(N65) - ABS(N66) - ABS(N67) - ABS(N68) - ABS(N69) - ABS(N70) - ABS(N33) - ABS(N34) - ABS(N35) - ABS(N36) - ABS(N37) - ABS(N38) - ABS(N39) - ABS(N40) - ABS(N41) - ABS(N42) - ABS(N43) - ABS(SUMJAN - 636)
1451 IF P <= M THEN 1670
1657 FOR KEW = 44 TO 84
1658 A(KEW) = X(KEW)
1659 NEXT KEW
1661 M = P
1670 NEXT I
1888 IF M < -4 THEN 1999
1917 PRINT A(44), A(45), A(46), A(47), A(48), A(49), A(50), A(51), M, JJJJ
1918 PRINT A(52), A(53), A(54), A(55), A(56), A(57), A(58), A(59), A(60), A(61), A(62), A(63), A(64), A(65), A(66), A(67), A(68), A(69), A(70), A(71), A(72), A(73), A(74), A(75), A(76), A(77), A(78), A(79), A(80), A(81), A(82), A(83), A(84)
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [8]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-6187 is shown below:
1 1 1 1 1
1 1 1 -4 -29356
0 0 0 0 -1
1 6 1 -4 -2
10 1 1 1 1
1 1 -1 1 1
1 -1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 -3.012512 -28188
1 3 -1 -1 0
-1 6 1 -2 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 0 -16280
0 0 0 -1 0
1 6 1 -4 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 -1.479426 -12332
0 -1 0 0 -1
1 6 1 -4 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
1 1 1 1 1
1 1 1 0 -6187
0 0 0 -1 0
1 6 1 -4 -2
10 1 1 1 1
1 1 1 -1 1
-1 1 15 -1 15
-1 1 -1 1 -1
1 0 -1
Above there is no rounding by hand; it is just straight copying by hand from the screen.
On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and with qb64v1000-win [8], the wall-clock time through JJJJ=-6187 was ten hours.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] R. Burden, J. Faires, A. Burden, Numerical Analysis, Tenth Edition. Cengage Learning, 2016.
[2] R. Burden, J. Faires, Numerical Analysis, Sixth Edition. Brooks/Cole Publishing Company, 1996.
[3] R. Burden, J. Faires, Numerical Analysis, Third Edition. PWS Publishers, 1985.
[4] D. Greenspan, V. Casulli, Numerical Analysis for Applied Mathematics, Science, and Engineering. Addison-Wesley Publishing Company, 1988
[5] L. W. Johnson, R. D. Riess, Numerical Analysis, Second Edition. Addison-Wesley Publishing Company, 1982
[6] Microsoft Corp. BASIC, second edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.
[7] William H. Mills, A System of Quadratic Diophantine Equations, Pacific Journal of Mathematics, 3 (1953), pp. 209-220.
[8] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
Subscribe to:
Posts (Atom)