Sunday, July 3, 2016

Solving the Diophantine Equation X(1) ^ 3 - 5 * X(1) ^ 2 + 45 * X(1) - 713=X(2) ^ 9 - 3 * X(2) ^ 8 + 9 * X(2) ^ 7 - 17 * X(2) ^ 6 + 38 * X(2) ^ 5 - 199 * X(2) ^ 4 - 261 * X(2) ^ 3 + 789 * X(2) ^ 2 + 234 * X(2)

Jsun Yui Wong

The computer program listed below seeks to solve the following nonlinear Diophantine equation from Tengely [2, p. 8].  Only integer solution/s are of interest.

X(1) ^ 3 - 5 * X(1) ^ 2 + 45 * X(1) - 713=X(2) ^ 9 - 3 * X(2) ^ 8 + 9 * X(2) ^ 7 - 17 * X(2) ^ 6 + 38 * X(2) ^ 5 - 199 * X(2) ^ 4 - 261 * X(2) ^ 3 + 789 * X(2) ^ 2 + 234 * X(2).

One notes line 112, which is 112 A(J44) = -5000 + FIX(RND * 10000).   These many possibilities for A(J44) are used on purpose to test the present method; line 112 gives cold starts.

0 DEFDBL A-Z
1 DEFINT 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), 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 2


        112 A(J44) = -5000 + FIX(RND * 10000)


    115 NEXT J44

    128 FOR I = 1 TO 10000


        129 FOR KKQQ = 1 TO 2

            130 X(KKQQ) = A(KKQQ)
        131 NEXT KKQQ
        139 FOR IPP = 1 TO FIX(1 + RND * .3)
            140 B = 1 + FIX(RND * 2)

            144 GOTO 166

            150 R = (1 - RND * 2) * A(B)
            160 X(B) = (A(B) + RND ^ 3 * R)
            166 IF RND < .5 THEN X(B) = A(B) - 1 ELSE X(B) = A(B) + 1


        168 NEXT IPP


        208 RHS = (X(2) ^ 9 - 3 * X(2) ^ 8 + 9 * X(2) ^ 7 - 17 * X(2) ^ 6 + 38 * X(2) ^ 5 - 199 * X(2) ^ 4 - 261 * X(2) ^ 3 + 789 * X(2) ^ 2 + 234 * X(2))


        214 N(7) = -ABS(-X(1) ^ 3 + 5 * X(1) ^ 2 - 45 * X(1) + 713 + RHS)


        322 PD1 = N(7)


        1111 IF PD1 <= M THEN 1670
        1452 M = PD1
        1454 FOR KLX = 1 TO 2


            1455 A(KLX) = X(KLX)

        1456 NEXT KLX
        1557 REM GOTO 128
    1670 NEXT I

    1889 IF M < 0 THEN 1999

    1904 PRINT A(1), A(2), 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=-30371 is shown below:

-11      -2      0      -31750

-11      -2      0      -30493

-11      -2      0      -30371

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= -30371 was 24 seconds, not including "Creating .EXE file..." time; the total time was 30 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] Szabolcs Tengely (1976)  Effective Methods for Diophantine Equations.  https://www.math.leidenuniv.nl/scripties/Tengely.pdf

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

[4] Jsun Yui Wong (2013, November 12).  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