Jsun Yui Wong
The following computer program tries to solve the nonlinear nine-parameter example problem in Reference 1 [1, pp. 87-89 and pp. 274-275]. Line 111 through line 119 below are noteworthy.
0 DEFSNG A-Z
3 DEFINT I,J,K
4 DIM X(66),A(66),L(33),K(33)
75 FOR JJJJ=-32000 TO 32000
84 RANDOMIZE JJJJ
87 M=-1.7E+38
111 A(1)=RND
112 A(2)=RND
113 A(3)=RND
114 A(4)=RND
115 A(5)=RND
116 A(6)=RND
117 A(7)=RND
118 A(8)=RND
119 A(9)=RND
126 REM IMAR=10+FIX(RND*32700)
128 FOR I=1 TO 3270
129 FOR K=1 TO 9
131 X(K)=A(K)
132 NEXT K
181 J=1+FIX(RND*9)
183 R=RND*3*(1-RND*2)*A(J)
191 IF RND<.14 THEN X(J)=A(J)+RND^5*R ELSE IF RND<.17 THEN X(J)=A(J)+R ELSE IF RND<.2 THEN X(J)=A(J)+RND*R ELSE IF RND<.25 THEN X(J)=A(J)+RND^2*R ELSE IF RND<.33 THEN X(J)=A(J)+RND^3*R ELSE IF RND<.5 THEN X(J)=A(J)+RND^4*R ELSE X(J)=A(J)+RND^6*R
301 X(10)=-5.10595 +X(1)/(X(2)+0) +X(3)*.001 +X(4)*.001^2 +X(5)*.001^3 +(X(6)+X(7)*.001^2)*.001*EXP(-0/( X(8)+X(9)*.001^2) )
302 X(11)=-6.38705 +X(1)/(X(2)+0) +X(3)*.740803 +X(4)*.740803^2 +X(5)*.740803^3 +(X(6)+X(7)*.740803^2)*.740803*EXP(-0/( X(8)+X(9)*.740803^2) )
303 X(12)=-7.38511 +X(1)/(X(2)+0) +X(3)*1.40747 +X(4)*1.40747^2 +X(5)*1.40747^3 +(X(6)+X(7)*1.40747^2)*1.40747*EXP(-0/( X(8)+X(9)*1.40747^2) )
304 X(13)=-5.79057 +X(1)/(X(2)+0) +X(3)*.363166 +X(4)*.363166^2 +X(5)*.363166^3 +(X(6)+X(7)*.363166^2)*.363166*EXP(-0/( X(8)+X(9)*.363166^2) )
305 X(14)=-5.10716 +X(1)/(X(2)+0) +X(3)*.001 +X(4)*.001^2 +X(5)*.001^3 +(X(6)+X(7)*.001^2 )*.001*EXP(-0/( X(8)+X(9)*.001^2) )
306 X(15)=-6.36113 +X(1)/(X(2)+0) +X(3)*.8055 +X(4)*.8055^2 +X(5)*.8055^3 +(X(6)+X(7)*.8055^2)*.8055*EXP(-0/( X(8)+X(9)*.8055^2) )
307 X(16)=-7.97329 +X(1)/(X(2)+0) +X(3)*1.86809 +X(4)*1.86809^2 +X(5)*1.86809^3 +(X(6)+X(7)*1.86809^2)*1.86809*EXP(-0/( X(8)+X(9)*1.86809^2) )
308 X(17)=-10.4725 +X(1)/(X(2)+0) +X(3)*3.2851 +X(4)*3.2851^2 +X(5)*3.2851^3 +(X(6)+X(7)*3.2851^2)*3.2851*EXP(-0/( X(8)+X(9)*3.2851^2))
309 X(18)=-11.9272 +X(1)/(X(2)+0) +X(3)*3.90747 +X(4)*3.90747^2 +X(5)*3.90747^3 +(X(6)+X(7)*3.90747^2)*3.90747*EXP(-0/( X(8)+X(9)*3.90747^2) )
310 X(19)=-12.4262 +X(1)/(X(2)+0) +X(3)*4.12547 +X(4)*4.12547^2 +X(5)*4.12547^3 +(X(6)+X(7)*4.12547^2)*4.12547*EXP(-0/( X(8)+X(9)*4.12547^2))
311 X(20)=-9.156299 +X(1)/(X(2)+0) +X(3)*2.57203 +X(4)*2.57203^2 +X(5)*2.57203^3 +(X(6)+X(7)*2.57203^2)*2.57203*EXP(-0/( X(8)+X(9)*2.57203^2) )
401 X(21)=-4.54223 +X(1)/(X(2)+25) +X(3)*.001 +X(4)*.001^2 +X(5)*.001^3 +(X(6)+X(7)*.001^2)*.001*EXP(-25/( X(8)+X(9)*.001^2) )
402 X(22)=-5.82452 +X(1)/(X(2)+25) +X(3)*.8055 +X(4)*.8055^2 +X(5)*.8055^3 +(X(6)+X(7)*.8055^2)*.8055*EXP(-25/( X(8)+X(9)*.8055^2) )
403 X(23)=-6.70515 +X(1)/(X(2)+25) +X(3)*1.50592 +X(4)*1.50592^2 +X(5)*1.50592^3 +(X(6)+X(7)*1.50592^2)*1.50592*EXP(-25/( X(8)+X(9)*1.50592^2) )
404 X(24)=-7.71659 +X(1)/(X(2)+25) +X(3)*2.33996 +X(4)*2.33996^2 +X(5)*2.33996^3 +(X(6)+X(7)*2.33996^2)*2.33996*EXP(-25/( X(8)+X(9)*2.33996^2) )
405 X(25)=-5.29782 +X(1)/(X(2)+25) +X(3)*.422941 +X(4)*.422941^2 +X(5)*.422941^3 +(X(6)+X(7)*.422941^2)*.422941*EXP(-25/( X(8)+X(9)*.422941^2) )
406 X(26)=-6.22654 +X(1)/(X(2)+25) +X(3)*1.16837 +X(4)*1.16837^2 +X(5)*1.16837^3 +(X(6)+X(7)*1.16837^2)*1.16837*EXP(-25/( X(8)+X(9)*1.16837^2) )
407 X(27)=-7.57338 +X(1)/(X(2)+25) +X(3)*2.23729 +X(4)*2.23729^2 +X(5)*2.23729^3 +(X(6)+X(7)*2.23729^2)*2.23729*EXP(-25/( X(8)+X(9)*2.23729^2) )
408 X(28)=-10.354 +X(1)/(X(2)+25) +X(3)*4.21689 +X(4)*4.21689^2 +X(5)*4.21689^3 +(X(6)+X(7)*4.21689^2)*4.21689*EXP(-25/( X(8)+X(9)*4.21689^2) )
409 X(29)=-11.9844 +X(1)/(X(2)+25) +X(3)*5.06429 +X(4)*5.06429^2 +X(5)*5.06429^3 +(X(6)+X(7)*5.06429^2)*5.06429*EXP(-25/( X(8)+X(9)*5.06429^2) )
410 X(30)=-12.4435 +X(1)/(X(2)+25) +X(3)*5.28088 +X(4)*5.28088^2 +X(5)*5.28088^3 +(X(6)+X(7)*5.28088^2)*5.28088*EXP(-25/( X(8)+X(9)*5.28088^2) )
411 X(31)=-9.52333 +X(1)/(X(2)+25) +X(3)*3.64727 +X(4)*3.64727^2 +X(5)*3.64727^3 +(X(6)+X(7)*3.64727^2)*3.64727*EXP(-25/( X(8)+X(9)*3.64727^2) )
412 X(32)=-8.34496 +X(1)/(X(2)+25) +X(3)*2.81394 +X(4)*2.81394^2 +X(5)*2.81394^3 +(X(6)+X(7)*2.81394^2)*2.81394*EXP(-25/( X(8)+X(9)*2.81394^2) )
501 X(33)=-5.17275 +X(1)/(X(2)+37.8) +X(3)*.5168221 +X(4)*.5168221^2 +X(5)*.5168221^3 +(X(6)+X(7)*.5168221^2)*.5168221*EXP(-37.8/( X(8)+X(9)*.5168221^2) )
502 X(34)=-6.64963 +X(1)/(X(2)+37.8) +X(3)*1.73799 +X(4)*1.73799^2 +X(5)*1.73799^3 +(X(6)+X(7)*1.73799^2)*1.73799*EXP(-37.8/( X(8)+X(9)*1.73799^2) )
503 X(35)=-5.80754 +X(1)/(X(2)+37.8) +X(3)*1.00873 +X(4)*1.00873^2 +X(5)*1.00873^3 +(X(6)+X(7)*1.00873^2)*1.00873*EXP(-37.8/( X(8)+X(9)*1.00873^2) )
504 X(36)=-7.74101 +X(1)/(X(2)+37.8) +X(3)*2.74924 +X(4)*2.74924^2 +X(5)*2.74924^3 +(X(6)+X(7)*2.74924^2)*2.74924*EXP(-37.8/(X(8)+X(9)*2.74924^2) )
505 X(37)=-6.23206 +X(1)/(X(2)+37.8) +X(3)*1.37582 +X(4)*1.37582^2 +X(5)*1.37582^3 +(X(6)+X(7)*1.37582^2)*1.37582*EXP(-37.8/( X(8)+X(9)*1.37582^2) )
506 X(38)=-4.6606 +X(1)/(X(2)+37.8) +X(3)*.191084 +X(4)*.191084^2 +X(5)*.191084^3 +(X(6)+X(7)*.191084^2)*.191084*EXP(-37.8/( X(8)+X(9)*.191084^2) )
507 X(39)=-4.29865 +X(1)/(X(2)+37.8) +X(3)*.001 +X(4)*.001^2 +X(5)*.001^3 +(X(6)+X(7)*.001^2)*.001*EXP(-37.8/( X(8)+X(9)*.001^2) )
508 X(40)=-7.96731 +X(1)/(X(2)+37.8) +X(3)*2.92294 +X(4)*2.92294^2 +X(5)*2.92294^3 +(X(6)+X(7)*2.92294^2)*2.92294*EXP(-37.8/( X(8)+X(9)*2.92294^2) )
509 X(41)=-9.34225 +X(1)/(X(2)+37.8) +X(3)*4.0446 +X(4)*4.0446^2 +X(5)*4.0446^3 +(X(6)+X(7)*4.0446^2)*4.0446*EXP(-37.8/( X(8)+X(9)*4.0446^2) )
510 X(42)=-10.5109 +X(1)/(X(2)+37.8) +X(3)*4.8498 +X(4)*4.8498^2 +X(5)*4.8498^3 +(X(6)+X(7)*4.8498^2)*4.8498*EXP(-37.8/( X(8)+X(9)*4.8498^2) )
511 X(43)=-11.8215 +X(1)/(X(2)+37.8) +X(3)*5.60578 +X(4)*5.60578^2 +X(5)*5.60578^3 +(X(6)+X(7)*5.60578^2)*5.60578*EXP(-37.8/( X(8)+X(9)*5.60578^2) )
512 X(44)=-13.068 +X(1)/(X(2)+37.8) +X(3)*6.27385 +X(4)*6.27385^2 +X(5)*6.27385^3 +(X(6)+X(7)*6.27385^2)*6.27385*EXP(-37.8/( X(8)+X(9)*6.27385^2) )
513 X(45)=-8.80445 +X(1)/(X(2)+37.8) +X(3)*3.63672 +X(4)*3.63672^2 +X(5)*3.63672^3 +(X(6)+X(7)*3.63672^2)*3.63672*EXP(-37.8/( X(8)+X(9)*3.63672^2) )
514 X(46)=-6.8553 +X(1)/(X(2)+37.8) +X(3)*1.94896 +X(4)*1.94896^2 +X(5)*1.94896^3 +(X(6)+X(7)*1.94896^2)*1.94896*EXP(-37.8/( X(8)+X(9)*1.94896^2) )
515 X(47)=-6.11898 +X(1)/(X(2)+37.8) +X(3)*1.29847 +X(4)*1.29847^2 +X(5)*1.29847^3 +(X(6)+X(7)*1.29847^2)*1.29847*EXP(-37.8/( X(8)+X(9)*1.29847^2) )
601 X(48)=-3.38099 +X(1)/(X(2)+98.9) +X(3)*.001 +X(4)*.001^2 +X(5)*.001^3 +(X(6)+X(7)*.001^2)*.001*EXP(-98.9/( X(8)+X(9)*.001^2) )
602 X(49)=-4.45783 +X(1)/(X(2)+98.9) +X(3)*.68595 +X(4)*.68595^2 +X(5)*.68595^3 +(X(6)+X(7)*.68595^2)*.68595*EXP(-98.9/( X(8)+X(9)*.68595^2) )
603 X(50)=-5.20675 +X(1)/(X(2)+98.9) +X(3)*1.42364 +X(4)*1.42364^2 +X(5)*1.42364^3 +(X(6)+X(7)*1.42364^2)*1.42364*EXP(-98.9/( X(8)+X(9)*1.42364^2) )
604 X(51)=-6.29101 +X(1)/(X(2)+98.9) +X(3)*2.79143 +X(4)*2.79143^2 +X(5)*2.79143^3 +(X(6)+X(7)*2.79143^2)*2.79143*EXP(-98.9/( X(8)+X(9)*2.79143^2) )
605 X(52)=-7.32719 +X(1)/(X(2)+98.9) +X(3)*4.21337 +X(4)*4.21337^2 +X(5)*4.21337^3 +(X(6)+X(7)*4.21337^2)*4.21337*EXP(-98.9/( X(8)+X(9)*4.21337^2) )
606 X(53)=-5.76988 +X(1)/(X(2)+98.9) +X(3)*2.10367 +X(4)*2.10367^2 +X(5)*2.10367^3 +(X(6)+X(7)*2.10367^2)*2.10367*EXP(-98.9/( X(8)+X(9)*2.10367^2) )
607 X(54)=-4.08766 +X(1)/(X(2)+98.9) +X(3)*.402195 +X(4)*.402195^2 +X(5)*.402195^3 +(X(6)+X(7)*.402195^2)*.402195*EXP(-98.9/( X(8)+X(9)*.402195^2) )
608 X(55)=-3.37417 +X(1)/(X(2)+98.9) +X(3)*.001 +X(4)*.001^2 +X(5)*.001^3 +(X(6)+X(7)*.001^2)*.001*EXP(-98.9/( X(8)+X(9)*.001^2) )
609 X(56)=-5.83919 +X(1)/(X(2)+98.9) +X(3)*2.2197 +X(4)*2.2197^2 +X(5)*2.2197^3 +(X(6)+X(7)*2.2197^2)*2.2197*EXP(-98.9/( X(8)+X(9)*2.2197^2) )
610 X(57)=-6.72635 +X(1)/(X(2)+98.9) +X(3)*3.53475 +X(4)*3.53475^2 +X(5)*3.53475^3 +(X(6)+X(7)*3.53475^2)*3.53475*EXP(-98.9/( X(8)+X(9)*3.53475^2) )
611 X(58)=-7.76883 +X(1)/(X(2)+98.9) +X(3)*4.93771 +X(4)*4.93771^2 +X(5)*4.93771^3 +(X(6)+X(7)*4.93771^2)*4.93771*EXP(-98.9/( X(8)+X(9)*4.93771^2) )
612 X(59)=-8.91362 +X(1)/(X(2)+98.9) +X(3)*6.34417 +X(4)*6.34417^2 +X(5)*6.34417^3 +(X(6)+X(7)*6.34417^2)*6.34417*EXP(-98.9/( X(8)+X(9)*6.34417^2) )
613 X(60)=-9.98334 +X(1)/(X(2)+98.9) +X(3)*7.46935 +X(4)*7.46935^2 +X(5)*7.46935^3 +(X(6)+X(7)*7.46935^2)*7.46935*EXP(-98.9/( X(8)+X(9)*7.46935^2) )
614 X(61)=-8.32329 +X(1)/(X(2)+98.9) +X(3)*5.64094 +X(4)*5.64094^2 +X(5)*5.64094^3 +(X(6)+X(7)*5.64094^2)*5.64094*EXP(-98.9/( X(8)+X(9)*5.64094^2) )
615 X(62)=-7.1321 +X(1)/(X(2)+98.9) +X(3)*4.10789 +X(4)*4.10789^2 +X(5)*4.10789^3 +(X(6)+X(7)*4.10789^2)*4.10789*EXP(-98.9/( X(8)+X(9)*4.10789^2) )
701 FOR IREM=10 TO 62
702 IF ABS(X(IREM))>1000 THEN 1670
703 NEXT IREM
1333 P1NEWMA1= -X(10)^2-X(11)^2 -X(12)^2 -X(13)^2-X(14)^2-X(15)^2 -X(16)^2 -X(17)^2 -X(18)^2-X(19)^2-X(20)^2-X(21)^2-X(22)^2-X(23)^2 -X(24)^2
1334 P1NEWMA2= -X(25)^2-X(26)^2 -X(27)^2 -X(28)^2-X(29)^2-X(30)^2 -X(31)^2 -X(32)^2 -X(33)^2-X(34)^2-X(35)^2-X(36)^2-X(37)^2-X(38)^2 -X(39)^2
1335 P1NEWMA3= -X(40)^2-X(41)^2 -X(42)^2 -X(43)^2-X(44)^2-X(45)^2 -X(46)^2 -X(47)^2 -X(48)^2-X(49)^2-X(50)^2-X(51)^2-X(52)^2-X(53)^2 -X(54)^2
1336 P1NEWMA4= -X(55)^2-X(56)^2 -X(57)^2 -X(58)^2-X(59)^2-X(60)^2 -X(61)^2 -X(62)^2
1337 P1NEWMAY= P1NEWMA1+P1NEWMA2+P1NEWMA3+P1NEWMA4
1448 P=P1NEWMAY
1451 IF P<=M THEN 1670
1657 FOR KEW=1 TO 62
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1666 GOTO 128
1670 NEXT I
1890 IF M>-9.000001E-02 THEN 1912 ELSE 1999
1912 LPRINT A(1),A(2),A(3),A(4)
1913 LPRINT A(5),A(6),A(7),A(8)
1914 LPRINT A(9),M,JJJJ
1919 GOTO 1999
1921 LPRINT A(10),A(11),A(12)
1922 LPRINT A(13),A(14),A(15)
1923 LPRINT A(16),A(17),A(18)
1924 LPRINT A(19),A(20),A(21)
1925 LPRINT A(22),A(23),A(24)
1926 LPRINT A(25),A(26),A(27)
1927 LPRINT A(28),A(29),A(30)
1928 LPRINT A(31),A(32),A(33)
1929 LPRINT A(34),A(35),A(36)
1930 LPRINT A(37),A(38),A(39)
1931 LPRINT A(40),A(41),A(42)
1932 LPRINT A(43),A(44),A(45)
1933 LPRINT A(46),A(47),A(48)
1934 LPRINT A(49),A(50),A(51)
1935 LPRINT A(52),A(53),A(54)
1936 LPRINT A(55),A(56),A(57)
1937 LPRINT A(58),A(59),A(60)
1938 LPRINT A(61),A(62)
1999 NEXT JJJJ
This BASIC computer program was run with Microsoft's GW BASIC 3.11 interpreter. Its output from the first eight hours of running is presented below.
The computer monitor screen repeatedly displayed "Overflow", "Division by zero", and "Overflow".
The complete printer output of the first eight hours of running is presented below. What follows is a hand copy of the output from the printer.
1047.345 205.1391 1.47747 -.266484
2.330988E-02 .3923642 3.572936E-02
57.71413
-.4933636 -8.795849E-02 -32000
1046.104 204.896 1.480521 -.2676831
2.343948E-02 .3907403 3.580715E-02
57.76291
-.4963205 -8.815683E-02 -31996
1062.663 208.1619 1.443093 -.2530176
2.183867E-02 .4115687 .0348097 57.2017
-.4593964 -8.790793E-02 -31993
Interpreted in accordance with line 1912 through line 1914, the output above was produced in eight hours of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
References
[1] Bates, D. M., and D. G. Watts: "Nonlinear Regression Analysis and Its Applications," Wiley, New York, 1988.
[2] Microsoft Corp. BASIC, 2nd Ed. (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.