A Computer Program Solving a Nonlinear Diophantine System of 10 Integer Unknowns and 9 Equations

Jsun Yui Wong

Based on the computer program in Wong [3], the following computer program seeks to solve the nonlinear system of nine equations on page 745 of Perez, Amaya, and Correa [1]. Only integer solutions are of interest.

0 DEFDBL A-Z
1 DEFINT I, J, K

2 DIM B(99), N(99), A(2002), H(99), L(99), U(99), X(2002), D(111), P(111), PS(33), J(99), AA(99), HR(32), HHR(32), LHS(44), PLHS(44), LB(22), UB(22), PX(44), J44(44), PN(22), NN(22)
88 FOR JJJJ = -32000 TO 32000
89 RANDOMIZE JJJJ
90 M = -3D+30
111 FOR J44 = 1 TO 10
112 A(J44) = CINT(RND * 20)

113 NEXT J44

128 FOR I = 1 TO 1000
129 FOR KKQQ = 1 TO 10
130 X(KKQQ) = A(KKQQ)
131 NEXT KKQQ
139 FOR IPP = 1 TO FIX(1 + RND * 3)
140 B = 1 + FIX(RND * 10)
144 GOTO 167

160 R = (1 – RND * 2) * A(B)

167 IF RND < .5 THEN X(B) = A(B) – 1 ELSE X(B) = A(B) + 1

168 NEXT IPP
177 X(1) = -3 + X(3) – 2 * X(5) + X(7) + X(9)
179 X(10) = (-24 – X(1) ^ 2 + 2 * (X(2) + X(4)) ^ 3 – X(5) + 3 * X(6) + X(7) – 4 * X(9)) / 15
183 X(8) = -8 + X(2) + (2 * X(4)) ^ 2 – 6 * X(6) + 2 * X(10)
192 FOR J44 = 1 TO 10
193 IF X(J44) < 0 THEN GOTO 1670

194 NEXT J44

196 N(11) = 31 – 2 * X(1) – (X(2) + 3 * X(4)) ^ 3 – (5 * X(7)) ^ 2 + 6 * X(8) – X(9) + 9 * X(10)

197 N(12) = -16 – X(1) + 3 * X(2) – 4 * X(4) – X(6) + 6 * X(7) – X(8) + 2 * X(9)
199 N(13) = 27 – (2 * X(1) + X(2)) ^ 2 – 3 * X(3) + 10 * X(5) + (X(6) + 3 * X(7)) ^ 3 + X(8) + 6 * X(9)
201 N(14) = 23 – 5 * X(1) – 2 * X(2) + 8 * X(4) + 3 * X(5) – 4 * X(6) – X(7) + X(9)
203 N(15) = -9 – 3 * X(1) – 2 * X(2) + 5 * X(3) + X(4) ^ 4 + 2 * X(5) – X(6) – 4 * X(7) + 10 * X(8) – 8 * X(9)
205 N(16) = -25 – 3 * X(1) + (2 * X(2)) ^ 2 – 10 * X(3) + 9 * X(4) – 3 * X(5) – X(6) + 2 * X(7) + 8 * X(8) – 12 * X(9) + 5 * X(10)

329 PD1 = -ABS(N(11)) – ABS(N(12)) – ABS(N(13)) – ABS(N(14)) – ABS(N(15)) – ABS(N(16))

466 P = PD1

1111 IF P <= M THEN 1670
1452 M = P
1454 FOR KLX = 1 TO 10
1455 A(KLX) = X(KLX)
1456 NEXT KLX
1551 NN(11) = N(11)
1552 NN(12) = N(12)
1553 NN(13) = N(13)
1554 NN(14) = N(14)
1555 NN(15) = N(15)
1556 NN(16) = N(16)
1557 REM GOTO 128

1670 NEXT I
1889 IF M < 0 THEN 1999

1904 PRINT A(1), A(2), A(3)
1906 PRINT A(4), A(5), A(6)
1907 PRINT A(7), A(8), A(9), A(10)
1917 PRINT M, JJJJ
1919 PRINT NN(11), NN(12), NN(13), NN(14)
1920 PRINT NN(15), NN(16)
1999 NEXT JJJJ

This computer program was run with qb64v1000-win [2]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-16129 is shown below:

3    4    5
0    1    1
1    2    2    6
0       -22855
0    0    0    0
0    0

3    4    5
0    1    1
1    2    2    6
0       -18174
0    0    0    0
0    0

3    4    5
0    1    1
1    2    2    6
0    -16129
0    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 [2], the wall-clock time for obtaining the output through JJJJ= -16129 was 40 seconds.

Acknowledgment

I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.

References

[1] O. Perez, I. Amaya, R. Correa (2013), Numerical Solution of Certain Exponential and Non-linear Diophantine Systems of Equations by Using a Discrete Particles Swarm Optimization Algorithm. Applied Mathematics and Computation, Volume 225, 1 December 2013, Pages 737-746.

[2] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.

[3] Jsun Yui Wong (2013, November 11). Solving Nonlinear Systems of Equations with the Domino Method, Second Edition. http://myblogsubstance.typepad.com/substance/2013/11/solving-nonlinear-systems-of-equations-with-the-domino-method-second-edition.html