Jsun Yui Wong

The computer program listed below tries to find integer solutions of the following nonlinear system taken from Shoup [1, p. 41]; this system can be found also on page 238 of Shoup [2]:

X(1) +X(2) + X(3) + X(4) = 31

X(1)*X(2)+ X(2) *X(3) +X(4)*X(5) = 58

X(1)^2+ X(3) *X(4)-X(2)^2 +X(1)*X(5) = 79

X(1) -X(2)* X(4) + X(3)^2 + X(5)^3 = 17

X(1)*X(3)-X(2)^3 *X(5)- X(5) *X(2) +X(3)^2*X(4) = 234

Line 112, which is 112 A(J44)=-100+FIX( RND*200), tests the present algorithm with this wide range.

One notes that in the present edition line 128 is 128 FOR I=1 TO 4000.

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),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

110 FOR J44=1 TO 5

112 A(J44)=-100+FIX( RND*200)

113 NEXT J44

128 FOR I=1 TO 4000

129 FOR KKQQ=1 TO 5

130 X(KKQQ)=A(KKQQ)

131 NEXT KKQQ

139 FOR IPP=1 TO FIX(1+RND*3)

140 B=1+FIX(RND*5)

144 REM GOTO 167

150 R=(1-RND*2)*A(B)

155 REM IF RND<.5 THEN 160 ELSE 167

160 X(B)=(A(B) +RND^3*R)

165 GOTO 168

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

168 NEXT IPP

261 X(4)= 31# -X(1) -X(2) - X(3)

263 IF (17#-X(1) +X(2)* X(4) - X(3)^2# )<0# THEN 1670

264 X(5)= (17#-X(1) +X(2)* X(4) - X(3)^2# )^(1#/3#)

268 N(1)=X(1)*X(2)+ X(2) *X(3) +X(4)*X(5) -58#

272 N(2)=X(1)^2+ X(3) *X(4)-X(2)^2 +X(1)*X(5) -79#

275 N(3)=X(1)*X(3)-X(2)^3# *X(5)- X(5) *X(2) +X(3)^2#*X(4) -234#

322 PD1=-ABS( N(1))-ABS(N(2) )-ABS( N(3) )

1111 IF PD1<=M THEN 1670

1452 M=PD1

1454 FOR KLX=1 TO 5

1455 A(KLX)=X(KLX)

1456 NEXT KLX

1557 GOTO 128

1670 NEXT I

1889 IF M<-.00001 THEN 1999

1904 PRINT A(1),A(2),A(3),A(4)

1917 PRINT A(5),M,JJJJ

1999 NEXT JJJJ

This BASIC computer program was run via basica/D of Microsoft's GW-BASIC 3.11 interpreter for DOS. The output through JJJJ=-31682 is summarized below. What follows is a hand copy from the computer-monitor screen; immediately below there is no rounding by hand.

-13.86607942507386 -.5355828579871631 -2.075432823539382

47.47709510660041

1.041807671619106 -3.543634735869716D-06 -31802

11.48325049712372 .867033088544543 -3.540483935451769

22.19020034978351

2.30342030188774 -7.979646525768658D-07 -31682

This same run also produced M=-4.385263218331659D-06 at JJJJ=-31995, M=-1.525971791593861D-06 at JJJJ=-31931, and M=-2.579981809525123D-06 at JJJJ=-31857.

On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM, and the IBM basica/D interpreter, version GW BASIC 3.11, the wall-clock time for obtaining the output through JJJJ=-31682 was six minutes.

**Acknowledgment**

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

References

[1] Terry E. Shoup, *A Practical Guide to Computer Methods for Engineers*. Englewood Cliffs, New Jersey: Prentice-Hall, 1979.

[2] Terry E. Shoup, *Applied Numerical Methods for the Microcomputers*. Englewood Cliffs, New Jersey: Prentice-Hall, 1984.

## Comments

You can follow this conversation by subscribing to the comment feed for this post.