The data (npoints=30) were generated with a=1.5, b=0.5 in r=a*exp(b*theta) with seed=1111, using the program spirgen.f, hang=2000 (degrees), cx=12, cy=48. The so-generated x and y were contaminated by adding to them normally distributed errors N(0,1). The data are given as follows(the only element in the first row is npoint=30; the data in the second row onwards are x and y). -------------------------------------------------------------------- Program spirgen.f is run to generate data -------------------------------------------------------------------- INPUT THE SAMPLE SIZE = NPOINTS 30 INPUT HIGHEST ANGLE (UPTO 360 FOR K=0, UPTO 720 FOR K=1, UPTO 1080 FOR K=2, ETC 2000 INPUT RANDOM NUMBER SEED 1111 FEED A AND B IN R=A*EXP(B*THETA) : LOGARITHMIC SPIRAL 1.5 .5 DISPLACEMENT OF X -- CX ? 12 DISPLACEMENT OF Y -- CY ? 48 SPIRAL DATA GENERATED AND SAVED IN FILE NAMED XYDAT program ends -------------------------------------------------------------------- Generated data -------------------------------------------------------------------- 30 13.5391054 50.7284203 46.2624321 85.5339661 11184148.0000000 6693490.5000000 -69297.2109000 -139393.8440000 484149.7810000 208803.3750000 -2457.4621600 1600.6014400 13.8891125 48.6934128 44.6408157 90.1024017 9.1911917 51.7429771 20681.9023000 14483.4834000 482278.2190000 184620.2030000 880.9229740 220.3240360 -69682.4453000 26544.7520000 -1764.4185800 1914.6820100 -42666220.0000000 8342564.0000000 11.4012156 52.0647087 16177.8848000 -3687.7233900 -49198.2852000 40189.8828000 1037816.5600000 -4926414.0000000 -18778.1836000 -185461.0630000 -174.8300630 -52.2412491 -87298.0313000 -109496.7190000 907.6440430 665.5257570 845.0092160 113.1046750 -513992.5000000 1063864.0000000 -120.4303890 1871.0886200 -3166.5966800 1030.4539800 -43010208.0000000 7890922.5000000 5731726.0000000 17777298.0000000 307951.1560000 702972.1880000 --------------------------------------------------------------------- The parameters cx, cy, a and b were estimated by four methods, namely Barter method, Repulsive Particle swarm method, Differential Evolution method and Box's method (with multiple starting points and shrinking limits on parameters). The results are as follows ------------------------------------------------------------------- PROGRAM TO FIT A LOGARITHMIC SPIRAL TO GIVEN DATA PROGRAM BY PROF. SK MISHRA DEPARTMENT OF ECONOMICS, NEHU, SHILLONG (INDIA) [METHOD OF OPTIMIZATION : BARTER ALGORITHM] ------------------------------------------------------ PROVIDE LOWER LIMITS ON CX, CY, A AND B 0 0 0 0 PROVIDE UPPER LIMITS ON CX, CY, A AND B 100 100 2 1 INPUT FILE NAME ? XYDAT POPULATION SIZE [N] AND NO. OF ITERATIONS [ITER] ? RANDOM NUMBER SEED ? 4321 COMPUTING --- PLEASE WAIT 6.915613 68.2785824 1.4926444 0.50017581 FBEST UPTO NOW = -0.99997089 TOTAL NUMBER OF FUNCTION CALLS = 350000 12.3079841 48.5554267 1.4642839 0.50094704 FBEST UPTO NOW = -0.999989749 TOTAL NUMBER OF FUNCTION CALLS = 700000 12.3486699 48.4738193 1.46401547 0.500962044 FBEST UPTO NOW = -0.999994053 TOTAL NUMBER OF FUNCTION CALLS = 1050000 12.3486696 48.4738101 1.46401654 0.500962014 FBEST UPTO NOW = -0.999994053 TOTAL NUMBER OF FUNCTION CALLS = 1400000 LOGARITHMIC SPIRAL NO. OF TIMES AN ATTEPT TO BARTER WAS MADE = 100000 NO. OF TIMES BARTER WAS SUCCESSFUL = 420 PERCENTAGE SUCCESS OF BARTER ATTEMPTS = 0.42 CX= 12.3486696 CY= 48.4738101 A= 1.46401654 B= 0.500962014 RSQUARE= 0.999994053 PROGAM TERMINATED SUCCESSFULLY. THANK YOU. ------------------------------------------------------------------- PROGRAM TO FIT A LOGARITHMIC SPIRAL TO GIVEN DATA PROGRAM BY PROF. SK MISHRA DEPARTMENT OF ECONOMICS, NEHU, SHILLONG (INDIA) [METHOD OF OPTIMIZATION : REPULSIVE PARTICLE SWARM] ------------------------------------------------------ PROVIDE LOWER LIMITS ON CX, CY, A AND B 0 0 0 0 PROVIDE UPPER LIMITS ON CX, CY, A AND B 100 100 2 1 INPUT FILE NAME ? XYDAT 4-DIGITS SEED FOR RANDOM NUMBER GENERATION A FOUR-DIGIT POSITIVE ODD INTEGER, SAY, 1171 4321 OPTIMAL SOLUTION UPTO THIS (FUNCTION CALLS= 33330) X = 7.10215941 68.1995709 1.48898484 0.500272723 MIN F = -0.999970947 OPTIMAL SOLUTION UPTO THIS (FUNCTION CALLS= 66330) X = 7.10218371 68.1995553 1.48898411 0.500272742 MIN F = -0.999970947 COMPUTATION OVER: LOGARITHMIC SPIRAL CX= 7.10218371; CY= 68.1995553; A= 1.48898411; B= 0.500272742; RSQUARE= 0.999970947 PROGAM TERMINATED SUCCESSFULLY. THANK YOU. -------------------------------------------------------------------- PROGRAM TO FIT A LOGARITHMIC SPIRAL TO GIVEN DATA PROGRAM BY PROF. SK MISHRA DEPARTMENT OF ECONOMICS, NEHU, SHILLONG (INDIA) [METHOD OF OPTIMIZATION : DIFFERENTIAL EVOLUTION] ------------------------------------------------------ PROVIDE LOWER LIMITS ON CX, CY, A AND B 0 0 0 0 PROVIDE UPPER LIMITS ON CX, CY, A AND B 100 100 2 1 INPUT FILE NAME ? XYDAT POPULATION SIZE [N] AND NO. OF ITERATIONS [ITER] ? SUGGESTED : N => 40 ; ITER 10000 OR SO 50 10000 CROSSOVER PROBABILITY [PCROS] AND SCALE [FACT] ? SUGGESTED : PCROS ABOUT 0.9; FACT=.5 OR LARGER BUT <=1 .9 .5 RANDOM NUMBER SEED ? A FOUR-DIGIT POSITIVE ODD INTEGER, SAY, 1171 4321 COMPUTING --- PLEASE WAIT 7.10220325 68.1995492 1.48898383 0.50027275 FBEST UPTO NOW = -0.999970947 TOTAL NUMBER OF FUNCTION CALLS = 50000 7.10220325 68.1995492 1.48898383 0.50027275 FBEST UPTO NOW = -0.999970947 TOTAL NUMBER OF FUNCTION CALLS = 100000 LOGARITHMIC SPIRAL NO. OF VARIABLES = 4 ====================================================== CX= 7.10220325; CY= 68.1995492; A= 1.48898383; B= 0.50027275; RSQUARE= 0.999970947 COMPUTATION OVER. THANK YOU ---------------------------------------------------------------------------- PROGRAM TO FIT A LOGARITHMIC SPIRAL TO EMPIRICAL DATA WHEN ORIGIN HAS BEEN DISPLACED BY Cx AND Cy ALGORITHM AND PROGRAM BY SK MISHRA, DEPT. OF ECONOMICS NORTH-EASTERN HILL UNIVERSITY, SHILLONG (INDIA) ***************************************************** NAME THE INPUT FILE AND OUTPUT FILE xydat xyout FEED RANDOM NUMBER SEED (a 4-digit odd number) 4321 FROM GRAPH OF THE SPIRAL GUESS NARROWEST RANGE Cx AND Cy IN WHICH CENTRE OF THE SPIRAL LIES - JUST GUESS LOWER AND UPPER LIMITS OF CX ? 0 100 LOWER AND UPPER LIMITS OF CY ? 0 100 NO. OF ITERATIONS TO PERFORM (SAY 10 TO 30) 30 -------------- COMPUTING PLEASE WAIT -------- CURRENT BEST VALUE OF FUNCTION = 0.999957979 CURRENT -- CX AND CY VALUES CX= 8.84059334 CY= 66.7679443 IN THE RANGE:CX( 0. 100.); CY( 0. 100.) CURRENT BEST VALUE OF FUNCTION = 0.999969959 CURRENT -- CX AND CY VALUES CX= 6.70859003 CY= 68.0977249 IN THE RANGE:CX( 0.482993811 42.1739807); CY( 43.2434578 94.1195374) CURRENT BEST VALUE OF FUNCTION = 0.999969959 CURRENT -- CX AND CY VALUES CX= 6.70859003 CY= 68.0977249 IN THE RANGE:CX( 2.8950007 41.2298775); CY( 43.3963356 82.0456924) CURRENT BEST VALUE OF FUNCTION = 0.999970853 CURRENT -- CX AND CY VALUES CX= 7.01784897 CY= 68.1442337 IN THE RANGE:CX( 4.8310256 23.6115894); CY( 55.5785065 76.9431839) CURRENT BEST VALUE OF FUNCTION = 0.999970853 CURRENT -- CX AND CY VALUES CX= 7.01784897 CY= 68.1442337 IN THE RANGE:CX( 4.86646843 19.9354954); CY( 62.070919 73.075386) CURRENT BEST VALUE OF FUNCTION = 0.999970913 CURRENT -- CX AND CY VALUES CX= 7.10788536 CY= 68.2444763 IN THE RANGE:CX( 6.25438356 15.3323889); CY( 64.0866852 72.4950562) CURRENT BEST VALUE OF FUNCTION = 0.999970913 CURRENT -- CX AND CY VALUES CX= 7.10788536 CY= 68.2444763 IN THE RANGE:CX( 6.73213911 14.6953888); CY( 64.4756088 70.2386627) CURRENT BEST VALUE OF FUNCTION = 0.999970913 CURRENT -- CX AND CY VALUES CX= 7.10788536 CY= 68.2444763 IN THE RANGE:CX( 6.85517931 11.5067244); CY( 65.3842163 69.5787964) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 6.99492645 9.16460896); CY( 66.0066605 68.89328) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.03085136 8.64610767); CY( 66.4212799 68.7266006) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.04658079 8.13781071); CY( 67.1832809 68.5514297) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.05138016 7.76788759); CY( 67.5575714 68.4035492) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.05616713 7.5502038); CY( 67.9791794 68.314209) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.05961704 7.29829025); CY( 68.0220947 68.263443) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.06081772 7.18334484); CY( 68.0602264 68.2547455) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.06285954 7.15903425); CY( 68.1520462 68.2245407) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.06481361 CY= 68.2054901 IN THE RANGE:CX( 7.06354618 7.12808657); CY( 68.1596451 68.2138062) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09807587 CY= 68.2004547 IN THE RANGE:CX( 7.06433344 7.11951828); CY( 68.1851883 68.2127762) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09299088 CY= 68.2000732 IN THE RANGE:CX( 7.07266474 7.11078835); CY( 68.1885529 68.2087555) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09419155 CY= 68.1999207 IN THE RANGE:CX( 7.07638931 7.11068439); CY( 68.1930008 68.2064743) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09513187 CY= 68.1988983 IN THE RANGE:CX( 7.08315039 7.1087985); CY( 68.1971588 68.2026825) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.0965023 CY= 68.1990204 IN THE RANGE:CX( 7.08815336 7.10685205); CY( 68.1979065 68.2003021) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09627056 CY= 68.1988373 IN THE RANGE:CX( 7.09214067 7.10030127); CY( 68.1980896 68.1994858) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09656334 CY= 68.1989288 IN THE RANGE:CX( 7.09479523 7.09827995); CY( 68.1985092 68.199379) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09651756 CY= 68.1988297 IN THE RANGE:CX( 7.09573841 7.09723377); CY( 68.1985855 68.1992416) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09658337 CY= 68.1989288 IN THE RANGE:CX( 7.09621334 7.09699297); CY( 68.1987152 68.1991806) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09658909 CY= 68.1989899 IN THE RANGE:CX( 7.09638834 7.09679365); CY( 68.1988602 68.1991119) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09657001 CY= 68.1989746 IN THE RANGE:CX( 7.0964222 7.09668541); CY( 68.1989059 68.1990433) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09657288 CY= 68.1989899 IN THE RANGE:CX( 7.0964942 7.09666538); CY( 68.1989517 68.1990204) CURRENT BEST VALUE OF FUNCTION = 0.999970973 CURRENT -- CX AND CY VALUES CX= 7.09655952 CY= 68.1989746 IN THE RANGE:CX( 7.09651518 7.09661007); CY( 68.198967 68.1990128) ----------------------------------------------------- TERMINAL VALUE OF FUNCTION = 0.999970973 TERMINAL CX AND CY VALUES CX= 7.09655952 CY= 68.1989746 RANGE : CX( 7.09651518 7.09661007); CY( 68.198967 68.1990128) RESULTS OF OPTIMALITY SEARCH STORED IN FILE=xyout ****************************************************** RESULTS OF SEARCH IN ORDER OF IMPROVING R-SQUARE ----------------------------------------------------- R-SQUARE Cx Cy a b 0.97585368 50.00000000 50.00000000 1.65547717 0.49293113 0.99817288 13.18724918 80.05879211 2.02515626 0.48783854 0.99833286 24.17401314 60.13181305 1.71651852 0.49422288 0.99889904 73.55525208 0.30583268 30.43401718 0.50662017 0.99923486 99.99999237 0.00001000 32.48981094 0.50325525 0.99965709 17.59809494 63.44483948 1.46784854 0.50071025 0.99985027 8.87992382 70.57856750 1.60568058 0.49722159 0.99995798 8.84059334 66.76794434 1.42491174 0.50202459 0.99996996 6.70859003 68.09772491 1.48392224 0.50041306 0.99997008 7.77461290 67.84367371 1.47304225 0.50069886 0.99997056 7.58142996 67.96582794 1.47847021 0.50055295 0.99997085 7.01784897 68.14423370 1.48625731 0.50034696 0.99997091 7.10788536 68.24447632 1.49114025 0.50021464 0.99997097 7.06481361 68.20549011 1.48924053 0.50026619 R-SQUARE Cx Cy a b ---------------------- END ------------------ PROGRAM TERMINATED SUCCESSFULLY --------------------------------------------------------------------------------- The results indicate that the Barter method has given better estimates of parameters and it has maximized R Square.