/************************************************************** This program computes z such that f(z) = 0 , where f(z) is an N-th order polynominal equation with coefficients C[i] = A[i] + j*B[i] for (i = 0 to N); Guess z[k] = x[k] + j*y[k] for k = 0 and then the program computes recursively z[k+1] = z[k] - h*f(z[k]) until you stop the program by typing-in "s" or you type "g" for the next guess for z[0] ; ************************************************************** Type "s" to stop program. Type "g" to start the next guess. **************************************************************/ N=2 A[0]=-2.000000 B[0]=0.000000 A[1]=0.000000 B[1]=0.000000 A[2]=1.000000 B[2]=0.000000 h=0.200000 x[0]=1.500000 y[0]=0.000000 k x[k] y[k] fx[k] fy[k] gx[k] gy[k] 0 1.500000 0.000000 0.250000 0.000000 1.450000 0.000000 1 1.450000 0.000000 0.102500 0.000000 1.429500 0.000000 2 1.429500 0.000000 0.043470 0.000000 1.420806 0.000000 3 1.420806 0.000000 0.018690 0.000000 1.417068 0.000000 4 1.417068 0.000000 0.008082 0.000000 1.415452 0.000000 5 1.415452 0.000000 0.003503 0.000000 1.414751 0.000000 6 1.414751 0.000000 0.001520 0.000000 1.414447 0.000000 7 1.414447 0.000000 0.000660 0.000000 1.414315 0.000000 8 1.414315 0.000000 0.000287 0.000000 1.414258 0.000000 9 1.414258 0.000000 0.000124 0.000000 1.414233 0.000000 10 1.414233 0.000000 0.000054 0.000000 1.414222 0.000000 11 1.414222 0.000000 0.000023 0.000000 1.414217 0.000000 12 1.414217 0.000000 0.000010 0.000000 1.414215 0.000000 13 1.414215 0.000000 0.000004 0.000000 1.414214 0.000000 14 1.414214 0.000000 0.000002 0.000000 1.414214 0.000000 ******************** Next Guess ****************** h = 0.200000 x[0] = 5.000000 y[0] = 0.000000 k x[k] y[k] fx[k] fy[k] gx[k] gy[k] 0 5.000000 0.000000 23.000000 0.000000 0.400000 0.000000 1 0.400000 0.000000 -1.840000 0.000000 0.768000 0.000000 2 0.768000 0.000000 -1.410176 0.000000 1.050035 0.000000 3 1.050035 0.000000 -0.897426 0.000000 1.229520 0.000000 4 1.229520 0.000000 -0.488280 0.000000 1.327176 0.000000 5 1.327176 0.000000 -0.238603 0.000000 1.374897 0.000000 6 1.374897 0.000000 -0.109658 0.000000 1.396829 0.000000 7 1.396829 0.000000 -0.048870 0.000000 1.406603 0.000000 8 1.406603 0.000000 -0.021469 0.000000 1.410896 0.000000 9 1.410896 0.000000 -0.009371 0.000000 1.412771 0.000000 10 1.412771 0.000000 -0.004079 0.000000 1.413586 0.000000 11 1.413586 0.000000 -0.001773 0.000000 1.413941 0.000000 12 1.413941 0.000000 -0.000770 0.000000 1.414095 0.000000 13 1.414095 0.000000 -0.000335 0.000000 1.414162 0.000000 14 1.414162 0.000000 -0.000145 0.000000 1.414191 0.000000 15 1.414191 0.000000 -0.000063 0.000000 1.414204 0.000000 16 1.414204 0.000000 -0.000027 0.000000 1.414209 0.000000 17 1.414209 0.000000 -0.000012 0.000000 1.414212 0.000000 18 1.414212 0.000000 -0.000005 0.000000 1.414213 0.000000 19 1.414213 0.000000 -0.000002 0.000000 1.414213 0.000000 20 1.414213 0.000000 -0.000001 0.000000 1.414213 0.000000 21 1.414213 0.000000 -0.000000 0.000000 1.414213 0.000000 22 1.414213 0.000000 -0.000000 0.000000 1.414214 0.000000 23 1.414214 0.000000 -0.000000 0.000000 1.414214 0.000000 ******************** Next Guess ****************** h = -0.200000 x[0] = -4.000000 y[0] = 0.000000 k x[k] y[k] fx[k] fy[k] gx[k] gy[k] 0 -4.000000 0.000000 14.000000 0.000000 -1.200000 0.000000 1 -1.200000 0.000000 -0.560000 0.000000 -1.312000 0.000000 2 -1.312000 0.000000 -0.278656 0.000000 -1.367731 0.000000 3 -1.367731 0.000000 -0.129311 0.000000 -1.393593 0.000000 4 -1.393593 0.000000 -0.057897 0.000000 -1.405173 0.000000 5 -1.405173 0.000000 -0.025489 0.000000 -1.410271 0.000000 6 -1.410271 0.000000 -0.011136 0.000000 -1.412498 0.000000 7 -1.412498 0.000000 -0.004849 0.000000 -1.413468 0.000000 8 -1.413468 0.000000 -0.002109 0.000000 -1.413890 0.000000 9 -1.413890 0.000000 -0.000916 0.000000 -1.414073 0.000000 10 -1.414073 0.000000 -0.000398 0.000000 -1.414152 0.000000 11 -1.414152 0.000000 -0.000173 0.000000 -1.414187 0.000000 12 -1.414187 0.000000 -0.000075 0.000000 -1.414202 0.000000 13 -1.414202 0.000000 -0.000033 0.000000 -1.414209 0.000000 14 -1.414209 0.000000 -0.000014 0.000000 -1.414211 0.000000 15 -1.414211 0.000000 -0.000006 0.000000 -1.414213 0.000000 16 -1.414213 0.000000 -0.000003 0.000000 -1.414213 0.000000 17 -1.414213 0.000000 -0.000001 0.000000 -1.414213 0.000000 18 -1.414213 0.000000 -0.000001 0.000000 -1.414213 0.000000 19 -1.414213 0.000000 -0.000000 0.000000 -1.414214 0.000000 20 -1.414214 0.000000 -0.000000 0.000000 -1.414214 0.000000 21 -1.414214 0.000000 -0.000000 0.000000 -1.414214 0.000000