The following computer program seeks to solve the following system of nonlinear Diophantine equations:
x(x+y+z) = -36
y(x+y+z) = 27
z(x+y+z) = 90.
This system comes from www.mathalino.com/reviewer/algebra/example-03-simultaneous-equations, [5].
One notes the starting vectors of line 42, which is 42 A(J44) = -100 + FIX(RND * 201).
0 REM DEFDBL A-Z
2 DEFINT I, J, X
3 DIM B(99), N(99), A(99), H(99), L(99), U(99), X(1111), D(111), P(111), PS(33)
12 FOR JJJJ = -32000 TO 32000
15 RANDOMIZE JJJJ
16 M = -1D+37
41 FOR J44 = 1 TO 3
42 A(J44) = -100 + FIX(RND * 201)
43 NEXT J44
128 FOR I = 1 TO 100
129 FOR KKQQ = 1 TO 3
130 X(KKQQ) = A(KKQQ)
131 NEXT KKQQ
133 FOR IPP = 1 TO (1 + FIX(RND * 3))
181 J = 1 + FIX(RND * 3)
183 R = (1 - RND * 2) * A(J)
187 X(J) = A(J) + (RND ^ 3) * R
192 NEXT IPP
439 P1 = -ABS(X(1) * (X(1) + X(2) + X(3)) + 36)
440 P2 = -ABS(X(2) * (X(1) + X(2) + X(3)) - 27)
441 P3 = -ABS(X(3) * (X(1) + X(2) + X(3)) - 90)
462 IF P1 < 0 THEN P1 = P1 ELSE P1 = 0
463 IF P2 < 0 THEN P2 = P2 ELSE P2 = 0
464 IF P3 < 0 THEN P3 = P3 ELSE P3 = 0
466 P = P1 + P2 + P3
1111 IF P <= M THEN 1670
1452 M = P
1454 FOR KLX = 1 TO 3
1455 A(KLX) = X(KLX)
1456 NEXT KLX
1557 GOTO 128
1670 NEXT I
1889 IF M < 0 THEN 1999
1947 PRINT A(1), A(2), A(3), M, JJJJ
1999 NEXT JJJJ
This computer program was run with qb64v1000-win [3]. Copied by hand from the screen, the computer program’s complete output through JJJJ=-28193 is shown below:
4 -3 -10 0 -31919
-4 3 10 0 -31907
-4 3 10 0 -30959
-4 3 10 0 -30843
4 -3 -10 0 -30528
4 -3 -10 0 -30396
-4 3 10 0 -30377
-4 3 10 0 -30330
-4 3 10 0 -30077
4 -3 -10 0 -29931
-4 3 10 0 -29516
-4 3 10 0 -29368
4 -3 -10 0 -29351
-4 3 10 0 -28999
-4 3 10 0 -28696
-4 3 10 0 -28286
-4 3 10 0 -28193
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 [3], the wall-clock time for obtaining the output through JJJJ= -28193 was 3 seconds, not including "Creating .EXEC file..." time.
Acknowledgment
I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.
References
[1] Jean-Marie de Konnick, Armel Mercier, 1001 Problems in Classical Number Theory. American Mathematical Society, Providence, Rhode Island, 2007.
[2] 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.
[3] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64.
[4] 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.
[5] www.mathalino.com/reviewer/algebra/example-03-simultaneous-equations. Retrieved August 9, 2016.
No comments:
Post a Comment