Newton's Method

458 days ago by tazzalenghe

# A version of Newton's method that lets you play with the precision of the real numbers used, # shows a few other new SAGE tricks, and has a a bit (not not really enough) logic to catch # problems before they cause errors. def newton(f, z, z_0, errorbits): """ INPUT: -"f"-function -"z"-variable defining g (usually 'x' in the examples) - this is now key because this version of Newton computes the derivative of f for you and we need to tell SAGE what to differentiate with respect to -"z_0"-initial value of z -"errorbits" - number of bits of accuracy you want in the approximate root - for example, if you sat this to 20 then you want the root to 2^(-20) which is a bit less than .000001 by the rule of thumb "10 bits roughly equals 3 decimals" - calculation inside the function uses twice as many bits of precision to make sure round-off does not hurt - usually answers are correct to this higher accuracy since we stop when the change to the root is 0 to errorbits and incorporating this root gives an answer with about 2 * errorbits of accuracy (quadratic convergence!) OUTPUT: - series of approximations and a measure of the RATIO of the change (dt) incorporated in the current and previous approximations RETURN: - "t" - an approximate root accurate to within errorbits (if nothing went wrong) """ # Create real numbers with 2 * errorbits bits of precision and set up initial guess and desired accuracy # as numbers of this type R = RealField(2*errorbits) epsilon = R(2^(-errorbits)) t = R(z_0) # Set up a counter for iterations which serves 2 purposes: # tells us when we hve setup dt and lastdt # lets us stop if the answers do not appear to be converging n = 0; while (n < 100): # save dt if it exists if (n > 0): lastdt = dt # find next dt: all the action is here # note that diff(f,z) is the (symbolic) derivative function df/dz # [that is, if we set up f= x^2-x and z=x then diff(f,z) is 2*z-1 (or 2*x-1)] # and that diff(f,z)(t) is the _value_ of this function at t [if t=2, this would be 3 in our example]. dt = -f(t)/diff(f,z)(t) # update approximate root t t = t+dt # print if we have both dt and lastdt set up if (n > 0): print '%5s%40.36s%10.6s'%(n,t,log(dt,2)/log(lastdt,2)) n = n+1 # stop if our current dt is small enough if (abs(dt) < epsilon): break # return the last approximation return t 
       
s=newton((x^2-2),x,1.,500); s; s^2 
       
    1    1.4166666666666666666666666666666666    3.5849
    2    1.4142156862745098039215686274509803    1.5461
    3    1.4142135623746899106262955788901349    1.9213
    4    1.4142135623730950488016896235025302    2.0205
    5    1.4142135623730950488016887242096980    2.0245
    6    1.4142135623730950488016887242096980    2.0155
    7    1.4142135623730950488016887242096980    2.0085
    8    1.4142135623730950488016887242096980    2.0044
1.4142135623730950488016887242096980785696718753769480731766797379907324\
784621070388503875343276415727350138462309122970249248360558507372126441\
214970999358314132226659275055927557999505011527820605714701095599716059\
702745345968620147285174186408891986095523292304843087143214508397626036\
2799525140799
2.0000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000
    1    1.4166666666666666666666666666666666    3.5849
    2    1.4142156862745098039215686274509803    1.5461
    3    1.4142135623746899106262955788901349    1.9213
    4    1.4142135623730950488016896235025302    2.0205
    5    1.4142135623730950488016887242096980    2.0245
    6    1.4142135623730950488016887242096980    2.0155
    7    1.4142135623730950488016887242096980    2.0085
    8    1.4142135623730950488016887242096980    2.0044
1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799
2.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
s=newton(x^2-2*x+1,x,1.5,500); 
       
    1    1.1250000000000000000000000000000000    1.0814
    2    1.0625000000000000000000000000000000    1.1015
    3    1.0312500000000000000000000000000000    1.1094
    4    1.0156250000000000000000000000000000    1.1097
    5    1.0078125000000000000000000000000000    1.1061
    6    1.0039062500000000000000000000000000    1.1006
    7    1.0019531250000000000000000000000000    1.0946
    8    1.0009765625000000000000000000000000    1.0886
    9    1.0004882812500000000000000000000000    1.0829
   10    1.0002441406250000000000000000000000    1.0777
   11    1.0001220703125000000000000000000000    1.0729
   12    1.0000610351562500000000000000000000    1.0685
   13    1.0000305175781250000000000000000000    1.0646
   14    1.0000152587890625000000000000000000    1.0610
   15    1.0000076293945312500000000000000000    1.0578
   16    1.0000038146972656250000000000000000    1.0549
   17    1.0000019073486328125000000000000000    1.0522
   18    1.0000009536743164062500000000000000    1.0497
   19    1.0000004768371582031250000000000000    1.0475
   20    1.0000002384185791015625000000000000    1.0454
   21    1.0000001192092895507812500000000000    1.0436
   22    1.0000000596046447753906250000000000    1.0418
   23    1.0000000298023223876953125000000000    1.0402
   24    1.0000000149011611938476562500000000    1.0387
   25    1.0000000074505805969238281250000000    1.0373
   26    1.0000000037252902984619140625000000    1.0360
   27    1.0000000018626451492309570312500000    1.0348
   28    1.0000000009313225746154785156250000    1.0336
   29    1.0000000004656612873077392578125000    1.0325
   30    1.0000000002328306436538696289062500    1.0315
   31    1.0000000001164153218269348144531250    1.0306
   32    1.0000000000582076609134674072265625    1.0297
   33    1.0000000000291038304567337036132812    1.0288
   34    1.0000000000145519152283668518066406    1.0281
   35    1.0000000000072759576141834259033203    1.0273
   36    1.0000000000036379788070917129516601    1.0266
   37    1.0000000000018189894035458564758300    1.0259
   38    1.0000000000009094947017729282379150    1.0252
   39    1.0000000000004547473508864641189575    1.0246
   40    1.0000000000002273736754432320594787    1.0240
   41    1.0000000000001136868377216160297393    1.0235
   42    1.0000000000000568434188608080148696    1.0230
   43    1.0000000000000284217094304040074348    1.0224
   44    1.0000000000000142108547152020037174    1.0219
   45    1.0000000000000071054273576010018587    1.0215
   46    1.0000000000000035527136788005009293    1.0210
   47    1.0000000000000017763568394002504646    1.0206
   48    1.0000000000000008881784197001252323    1.0202
   49    1.0000000000000004440892098500626161    1.0198
   50    1.0000000000000002220446049250313080    1.0194
   51    1.0000000000000001110223024625156540    1.0190
   52    1.0000000000000000555111512312578270    1.0187
   53    1.0000000000000000277555756156289135    1.0183
   54    1.0000000000000000138777878078144567    1.0180
   55    1.0000000000000000069388939039072283    1.0177
   56    1.0000000000000000034694469519536141    1.0174
   57    1.0000000000000000017347234759768070    1.0171
   58    1.0000000000000000008673617379884035    1.0168
   59    1.0000000000000000004336808689942017    1.0165
   60    1.0000000000000000002168404344971008    1.0163
   61    1.0000000000000000001084202172485504    1.0160
   62    1.0000000000000000000542101086242752    1.0157
   63    1.0000000000000000000271050543121376    1.0155
   64    1.0000000000000000000135525271560688    1.0153
   65    1.0000000000000000000067762635780344    1.0150
   66    1.0000000000000000000033881317890172    1.0148
   67    1.0000000000000000000016940658945086    1.0146
   68    1.0000000000000000000008470329472543    1.0144
   69    1.0000000000000000000004235164736271    1.0142
   70    1.0000000000000000000002117582368135    1.0140
   71    1.0000000000000000000001058791184067    1.0138
   72    1.0000000000000000000000529395592033    1.0136
   73    1.0000000000000000000000264697796016    1.0134
   74    1.0000000000000000000000132348898008    1.0132
   75    1.0000000000000000000000066174449004    1.0131
   76    1.0000000000000000000000033087224502    1.0129
   77    1.0000000000000000000000016543612251    1.0127
   78    1.0000000000000000000000008271806125    1.0126
   79    1.0000000000000000000000004135903062    1.0124
   80    1.0000000000000000000000002067951531    1.0123
   81    1.0000000000000000000000001033975765    1.0121
   82    1.0000000000000000000000000516987882    1.0120
   83    1.0000000000000000000000000258493941    1.0118
   84    1.0000000000000000000000000129246970    1.0117
   85    1.0000000000000000000000000064623485    1.0115
   86    1.0000000000000000000000000032311742    1.0114
   87    1.0000000000000000000000000016155871    1.0113
   88    1.0000000000000000000000000008077935    1.0112
   89    1.0000000000000000000000000004038967    1.0110
   90    1.0000000000000000000000000002019483    1.0109
   91    1.0000000000000000000000000001009741    1.0108
   92    1.0000000000000000000000000000504870    1.0107
   93    1.0000000000000000000000000000252435    1.0106
   94    1.0000000000000000000000000000126217    1.0105
   95    1.0000000000000000000000000000063108    1.0103
   96    1.0000000000000000000000000000031554    1.0102
   97    1.0000000000000000000000000000015777    1.0101
   98    1.0000000000000000000000000000007888    1.0100
   99    1.0000000000000000000000000000003944    1.0099
    1    1.1250000000000000000000000000000000    1.0814
    2    1.0625000000000000000000000000000000    1.1015
    3    1.0312500000000000000000000000000000    1.1094
    4    1.0156250000000000000000000000000000    1.1097
    5    1.0078125000000000000000000000000000    1.1061
    6    1.0039062500000000000000000000000000    1.1006
    7    1.0019531250000000000000000000000000    1.0946
    8    1.0009765625000000000000000000000000    1.0886
    9    1.0004882812500000000000000000000000    1.0829
   10    1.0002441406250000000000000000000000    1.0777
   11    1.0001220703125000000000000000000000    1.0729
   12    1.0000610351562500000000000000000000    1.0685
   13    1.0000305175781250000000000000000000    1.0646
   14    1.0000152587890625000000000000000000    1.0610
   15    1.0000076293945312500000000000000000    1.0578
   16    1.0000038146972656250000000000000000    1.0549
   17    1.0000019073486328125000000000000000    1.0522
   18    1.0000009536743164062500000000000000    1.0497
   19    1.0000004768371582031250000000000000    1.0475
   20    1.0000002384185791015625000000000000    1.0454
   21    1.0000001192092895507812500000000000    1.0436
   22    1.0000000596046447753906250000000000    1.0418
   23    1.0000000298023223876953125000000000    1.0402
   24    1.0000000149011611938476562500000000    1.0387
   25    1.0000000074505805969238281250000000    1.0373
   26    1.0000000037252902984619140625000000    1.0360
   27    1.0000000018626451492309570312500000    1.0348
   28    1.0000000009313225746154785156250000    1.0336
   29    1.0000000004656612873077392578125000    1.0325
   30    1.0000000002328306436538696289062500    1.0315
   31    1.0000000001164153218269348144531250    1.0306
   32    1.0000000000582076609134674072265625    1.0297
   33    1.0000000000291038304567337036132812    1.0288
   34    1.0000000000145519152283668518066406    1.0281
   35    1.0000000000072759576141834259033203    1.0273
   36    1.0000000000036379788070917129516601    1.0266
   37    1.0000000000018189894035458564758300    1.0259
   38    1.0000000000009094947017729282379150    1.0252
   39    1.0000000000004547473508864641189575    1.0246
   40    1.0000000000002273736754432320594787    1.0240
   41    1.0000000000001136868377216160297393    1.0235
   42    1.0000000000000568434188608080148696    1.0230
   43    1.0000000000000284217094304040074348    1.0224
   44    1.0000000000000142108547152020037174    1.0219
   45    1.0000000000000071054273576010018587    1.0215
   46    1.0000000000000035527136788005009293    1.0210
   47    1.0000000000000017763568394002504646    1.0206
   48    1.0000000000000008881784197001252323    1.0202
   49    1.0000000000000004440892098500626161    1.0198
   50    1.0000000000000002220446049250313080    1.0194
   51    1.0000000000000001110223024625156540    1.0190
   52    1.0000000000000000555111512312578270    1.0187
   53    1.0000000000000000277555756156289135    1.0183
   54    1.0000000000000000138777878078144567    1.0180
   55    1.0000000000000000069388939039072283    1.0177
   56    1.0000000000000000034694469519536141    1.0174
   57    1.0000000000000000017347234759768070    1.0171
   58    1.0000000000000000008673617379884035    1.0168
   59    1.0000000000000000004336808689942017    1.0165
   60    1.0000000000000000002168404344971008    1.0163
   61    1.0000000000000000001084202172485504    1.0160
   62    1.0000000000000000000542101086242752    1.0157
   63    1.0000000000000000000271050543121376    1.0155
   64    1.0000000000000000000135525271560688    1.0153
   65    1.0000000000000000000067762635780344    1.0150
   66    1.0000000000000000000033881317890172    1.0148
   67    1.0000000000000000000016940658945086    1.0146
   68    1.0000000000000000000008470329472543    1.0144
   69    1.0000000000000000000004235164736271    1.0142
   70    1.0000000000000000000002117582368135    1.0140
   71    1.0000000000000000000001058791184067    1.0138
   72    1.0000000000000000000000529395592033    1.0136
   73    1.0000000000000000000000264697796016    1.0134
   74    1.0000000000000000000000132348898008    1.0132
   75    1.0000000000000000000000066174449004    1.0131
   76    1.0000000000000000000000033087224502    1.0129
   77    1.0000000000000000000000016543612251    1.0127
   78    1.0000000000000000000000008271806125    1.0126
   79    1.0000000000000000000000004135903062    1.0124
   80    1.0000000000000000000000002067951531    1.0123
   81    1.0000000000000000000000001033975765    1.0121
   82    1.0000000000000000000000000516987882    1.0120
   83    1.0000000000000000000000000258493941    1.0118
   84    1.0000000000000000000000000129246970    1.0117
   85    1.0000000000000000000000000064623485    1.0115
   86    1.0000000000000000000000000032311742    1.0114
   87    1.0000000000000000000000000016155871    1.0113
   88    1.0000000000000000000000000008077935    1.0112
   89    1.0000000000000000000000000004038967    1.0110
   90    1.0000000000000000000000000002019483    1.0109
   91    1.0000000000000000000000000001009741    1.0108
   92    1.0000000000000000000000000000504870    1.0107
   93    1.0000000000000000000000000000252435    1.0106
   94    1.0000000000000000000000000000126217    1.0105
   95    1.0000000000000000000000000000063108    1.0103
   96    1.0000000000000000000000000000031554    1.0102
   97    1.0000000000000000000000000000015777    1.0101
   98    1.0000000000000000000000000000007888    1.0100
   99    1.0000000000000000000000000000003944    1.0099
 
       
s=newton(x^3-3*x^2+2,x,1.5,2000);s 
       
    1    1.0009259259259259259259259259259259    0.1066
    2    0.9999999994707780522640331905143231    3.1909
    3    1.0000000000000000000000000000988148    2.5434
    4    0.9999999999999999999999999999999999    3.0189
    5    1.0000000000000000000000000000000000    2.9991
    6    0.9999999999999999999999999999999999    3.0020
    7    1.0000000000000000000000000000000000    3.0006
1.0000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000
    1    1.0009259259259259259259259259259259    0.1066
    2    0.9999999994707780522640331905143231    3.1909
    3    1.0000000000000000000000000000988148    2.5434
    4    0.9999999999999999999999999999999999    3.0189
    5    1.0000000000000000000000000000000000    2.9991
    6    0.9999999999999999999999999999999999    3.0020
    7    1.0000000000000000000000000000000000    3.0006
1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
s=newton(x^3-3*x^2+1,x,1.5,500);s 
       
    1    0.6832010582010582010582010582010582    -0.007
    2    0.6530416775474439771780386022371050    2.4444
    3    0.6527036897520830222451479697657456    1.7106
    4    0.6527036446661401050891084500013948    1.9669
    5    0.6527036446661393022965667464616249    2.0197
    6    0.6527036446661393022965667464613704    2.0184
    7    0.6527036446661393022965667464613704    2.0111
    8    0.6527036446661393022965667464613704    2.0060
    9    0.6527036446661393022965667464613704    2.0031
0.6527036446661393022965667464613704079992486456318612255275172437358683\
557219705291569667736852008519760817072065628379144494539317440940004518\
107305767548802167178997677669199777759226963959513134806235351217841243\
470235887840000249812483339995833863314705381582768341422693418022055845\
41794527047220
    1    0.6832010582010582010582010582010582    -0.007
    2    0.6530416775474439771780386022371050    2.4444
    3    0.6527036897520830222451479697657456    1.7106
    4    0.6527036446661401050891084500013948    1.9669
    5    0.6527036446661393022965667464616249    2.0197
    6    0.6527036446661393022965667464613704    2.0184
    7    0.6527036446661393022965667464613704    2.0111
    8    0.6527036446661393022965667464613704    2.0060
    9    0.6527036446661393022965667464613704    2.0031
0.652703644666139302296566746461370407999248645631861225527517243735868355721970529156966773685200851976081707206562837914449453931744094000451810730576754880216717899767766919977775922696395951313480623535121784124347023588784000024981248333999583386331470538158276834142269341802205584541794527047220
s=newton(x^3-x+3,x,0,500);s 
       
    1    1.9615384615384615384615384615384615    0.0343
    2    1.1471759614035466427777358042546761    0.9990
    3    0.0065793714807121424999277231760187    0.9930
    4    3.0003890740712328670778155239682523    0.0145
    5    1.9618181756663249771591436107897414    0.0345
    6    1.1474302284816025368731131437695362    0.9990
    7    0.0072562475524235053694875287986746    0.9930
    8    3.0004731887732161500167228191072235    0.0145
    9    1.9618786463602413693050453011920946    0.0345
   10    1.1474851932167663701529432128718997    0.9990
   11    0.0074025013328710377517798813320584    0.9930
   12    3.0004924429169546087804116106770460    0.0145
   13    1.9618924882463068769957326427035872    0.0345
   14    1.1474977745445404541770954505549226    0.9990
   15    0.0074359752567044129342324266454451    0.9930
   16    3.0004969036535445031907398100787237    0.0145
   17    1.9618956950855134017898078911472663    0.0345
   18    1.1475006893297726875521111277902901    0.9990
   19    0.0074437301689117085983641893433428    0.9930
   20    3.0004979399396290495574707985546962    0.0145
   21    1.9618964400750396833657316361128249    0.0345
   22    1.1475013664707852653864982680179939    0.9990
   23    0.0074455317224258062178987603798943    0.9930
   24    3.0004981808349005658921464355454416    0.0145
   25    1.9618966132554449518396353380502641    0.0345
   26    1.1475015238790765520160387332372312    0.9990
   27    0.0074459505112890865080919943723713    0.9930
   28    3.0004982368417152181856937045514081    0.0145
   29    1.9618966535189282122188306924266329    0.0345
   30    1.1475015604756288983595535251983683    0.9990
   31    0.0074460478773432668469995217789270    0.9930
   32    3.0004982498634349823397135693644753    0.0145
   33    1.9618966628802853506901250539631282    0.0345
   34    1.1475015689844156352530389255191145    0.9990
   35    0.0074460705151843415600968427003829    0.9930
   36    3.0004982528910404054218181379582148    0.0145
   37    1.9618966650568408389898977720819101    0.0345
   38    1.1475015709627448608321684659737651    0.9990
   39    0.0074460757785789125528694556113894    0.9930
   40    3.0004982535949728915628122733407825    0.0145
   41    1.9618966655629002165327821319523413    0.0345
   42    1.1475015714227157006242830619722862    0.9990
   43    0.0074460770023428751224352385166088    0.9930
   44    3.0004982537586405724810414002611576    0.0145
   45    1.9618966656805614501835414474726711    0.0345
   46    1.1475015715296611280714463477228001    0.9990
   47    0.0074460772868738684834642749675783    0.9930
   48    3.0004982537966940974785412608833527    0.0145
   49    1.9618966657079182543540787865861311    0.0345
   50    1.1475015715545264556285713135683697    0.9990
   51    0.0074460773530286963952101129541236    0.9930
   52    3.0004982538055417257354175087201116    0.0145
   53    1.9618966657142788433826241724601748    0.0345
   54    1.1475015715603077643174001950205264    0.9990
   55    0.0074460773684100132316118392284546    0.9930
   56    3.0004982538075988420262346035772163    0.0145
   57    1.9618966657157577110440946728685787    0.0345
   58    1.1475015715616519465028079741396142    0.9990
   59    0.0074460773719862436652746250113924    0.9930
   60    3.0004982538080771314973116830678951    0.0145
   61    1.9618966657161015549165850758737890    0.0345
   62    1.1475015715619644753517405700062831    0.9990
   63    0.0074460773728177345101027624283377    0.9930
   64    3.0004982538081883361089475329277469    0.0145
   65    1.9618966657161815002773256195501073    0.0345
   66    1.1475015715620371398182869034656905    0.9990
   67    0.0074460773730110601467085329227059    0.9930
   68    3.0004982538082141917181502037215392    0.0145
   69    1.9618966657162000879597469451343415    0.0345
   70    1.1475015715620540346576492740156545    0.9990
   71    0.0074460773730560092907719444389120    0.9930
   72    3.0004982538082202032721443933859610    0.0145
   73    1.9618966657162044096856682630599241    0.0345
   74    1.1475015715620579627893847876965647    0.9990
   75    0.0074460773730664601838223346745655    0.9930
   76    3.0004982538082216009874773377568452    0.0145
   77    1.9618966657162054145078142252444528    0.0345
   78    1.1475015715620588760989819167384337    0.9990
   79    0.0074460773730688900669230454906163    0.9930
   80    3.0004982538082219259630416989320571    0.0145
   81    1.9618966657162056481338153643937752    0.0345
   82    1.1475015715620590884478735456611430    0.9990
   83    0.0074460773730694550264776650480397    0.9930
   84    3.0004982538082220015214296930119392    0.0145
   85    1.9618966657162057024529887898715558    0.0345
   86    1.1475015715620591378200162646102148    0.9990
   87    0.0074460773730695863823022570305838    0.9930
   88    3.0004982538082220190891197668390423    0.0145
   89    1.9618966657162057150824589140889613    0.0345
   90    1.1475015715620591492992778607577564    0.9990
   91    0.0074460773730696169231657810744144    0.9930
   92    3.0004982538082220231736925419256124    0.0145
   93    1.9618966657162057180188717046357415    0.0345
   94    1.1475015715620591519682616142664826    0.9990
   95    0.0074460773730696240240640297175292    0.9930
   96    3.0004982538082220241233754361972046    0.0145
   97    1.9618966657162057187016018581322685    0.0345
   98    1.1475015715620591525888132252589698    0.9990
   99    0.0074460773730696256750571621771528    0.9930
0.0074460773730696256750571621771528815909797572020112433893156233907832\
447699449440146082744115910782439916429824224892115716859917318137830767\
303271418348236745274909424615874260741742954824051597350159152258959050\
165493344592830727808490136714446776455556417094500637912739203688076824\
9630396214156113
    1    1.9615384615384615384615384615384615    0.0343
    2    1.1471759614035466427777358042546761    0.9990
    3    0.0065793714807121424999277231760187    0.9930
    4    3.0003890740712328670778155239682523    0.0145
    5    1.9618181756663249771591436107897414    0.0345
    6    1.1474302284816025368731131437695362    0.9990
    7    0.0072562475524235053694875287986746    0.9930
    8    3.0004731887732161500167228191072235    0.0145
    9    1.9618786463602413693050453011920946    0.0345
   10    1.1474851932167663701529432128718997    0.9990
   11    0.0074025013328710377517798813320584    0.9930
   12    3.0004924429169546087804116106770460    0.0145
   13    1.9618924882463068769957326427035872    0.0345
   14    1.1474977745445404541770954505549226    0.9990
   15    0.0074359752567044129342324266454451    0.9930
   16    3.0004969036535445031907398100787237    0.0145
   17    1.9618956950855134017898078911472663    0.0345
   18    1.1475006893297726875521111277902901    0.9990
   19    0.0074437301689117085983641893433428    0.9930
   20    3.0004979399396290495574707985546962    0.0145
   21    1.9618964400750396833657316361128249    0.0345
   22    1.1475013664707852653864982680179939    0.9990
   23    0.0074455317224258062178987603798943    0.9930
   24    3.0004981808349005658921464355454416    0.0145
   25    1.9618966132554449518396353380502641    0.0345
   26    1.1475015238790765520160387332372312    0.9990
   27    0.0074459505112890865080919943723713    0.9930
   28    3.0004982368417152181856937045514081    0.0145
   29    1.9618966535189282122188306924266329    0.0345
   30    1.1475015604756288983595535251983683    0.9990
   31    0.0074460478773432668469995217789270    0.9930
   32    3.0004982498634349823397135693644753    0.0145
   33    1.9618966628802853506901250539631282    0.0345
   34    1.1475015689844156352530389255191145    0.9990
   35    0.0074460705151843415600968427003829    0.9930
   36    3.0004982528910404054218181379582148    0.0145
   37    1.9618966650568408389898977720819101    0.0345
   38    1.1475015709627448608321684659737651    0.9990
   39    0.0074460757785789125528694556113894    0.9930
   40    3.0004982535949728915628122733407825    0.0145
   41    1.9618966655629002165327821319523413    0.0345
   42    1.1475015714227157006242830619722862    0.9990
   43    0.0074460770023428751224352385166088    0.9930
   44    3.0004982537586405724810414002611576    0.0145
   45    1.9618966656805614501835414474726711    0.0345
   46    1.1475015715296611280714463477228001    0.9990
   47    0.0074460772868738684834642749675783    0.9930
   48    3.0004982537966940974785412608833527    0.0145
   49    1.9618966657079182543540787865861311    0.0345
   50    1.1475015715545264556285713135683697    0.9990
   51    0.0074460773530286963952101129541236    0.9930
   52    3.0004982538055417257354175087201116    0.0145
   53    1.9618966657142788433826241724601748    0.0345
   54    1.1475015715603077643174001950205264    0.9990
   55    0.0074460773684100132316118392284546    0.9930
   56    3.0004982538075988420262346035772163    0.0145
   57    1.9618966657157577110440946728685787    0.0345
   58    1.1475015715616519465028079741396142    0.9990
   59    0.0074460773719862436652746250113924    0.9930
   60    3.0004982538080771314973116830678951    0.0145
   61    1.9618966657161015549165850758737890    0.0345
   62    1.1475015715619644753517405700062831    0.9990
   63    0.0074460773728177345101027624283377    0.9930
   64    3.0004982538081883361089475329277469    0.0145
   65    1.9618966657161815002773256195501073    0.0345
   66    1.1475015715620371398182869034656905    0.9990
   67    0.0074460773730110601467085329227059    0.9930
   68    3.0004982538082141917181502037215392    0.0145
   69    1.9618966657162000879597469451343415    0.0345
   70    1.1475015715620540346576492740156545    0.9990
   71    0.0074460773730560092907719444389120    0.9930
   72    3.0004982538082202032721443933859610    0.0145
   73    1.9618966657162044096856682630599241    0.0345
   74    1.1475015715620579627893847876965647    0.9990
   75    0.0074460773730664601838223346745655    0.9930
   76    3.0004982538082216009874773377568452    0.0145
   77    1.9618966657162054145078142252444528    0.0345
   78    1.1475015715620588760989819167384337    0.9990
   79    0.0074460773730688900669230454906163    0.9930
   80    3.0004982538082219259630416989320571    0.0145
   81    1.9618966657162056481338153643937752    0.0345
   82    1.1475015715620590884478735456611430    0.9990
   83    0.0074460773730694550264776650480397    0.9930
   84    3.0004982538082220015214296930119392    0.0145
   85    1.9618966657162057024529887898715558    0.0345
   86    1.1475015715620591378200162646102148    0.9990
   87    0.0074460773730695863823022570305838    0.9930
   88    3.0004982538082220190891197668390423    0.0145
   89    1.9618966657162057150824589140889613    0.0345
   90    1.1475015715620591492992778607577564    0.9990
   91    0.0074460773730696169231657810744144    0.9930
   92    3.0004982538082220231736925419256124    0.0145
   93    1.9618966657162057180188717046357415    0.0345
   94    1.1475015715620591519682616142664826    0.9990
   95    0.0074460773730696240240640297175292    0.9930
   96    3.0004982538082220241233754361972046    0.0145
   97    1.9618966657162057187016018581322685    0.0345
   98    1.1475015715620591525888132252589698    0.9990
   99    0.0074460773730696256750571621771528    0.9930
0.00744607737306962567505716217715288159097975720201124338931562339078324476994494401460827441159107824399164298242248921157168599173181378307673032714183482367452749094246158742607417429548240515973501591522589590501654933445928307278084901367144467764555564170945006379127392036880768249630396214156113
s=newton(x^3-x+3,x,0.001,500);s 
       
    1    1.9615449305316294507396457065073598    0.0343
    2    1.1471818422762655619809529740372220    0.9990
    3    0.0065950324385670507318772033316270    0.9930
    4    3.0003909273906555706224450060579746    0.0145
    5    1.9618195080364787104698047813667259    0.0345
    6    1.1474314395549161305178303287134540    0.9990
    7    0.0072594703087416080535673455616170    0.9930
    8    3.0004736089130599090180132104642369    0.0145
    9    1.9618789484008182643086990334733692    0.0345
   10    1.1474854677519130878281448652578329    0.9990
   11    0.0074032317751432876549727894885272    0.9930
   12    3.0004925400413209761088825909757320    0.0145
   13    1.9618925580693685337734981062665465    0.0345
   14    1.1474978380087099204095249373236730    0.9990
   15    0.0074361441065754228347190956942783    0.9930
   16    3.0004969262054086300624521008687524    0.0145
   17    1.9618957112981245472716518415023242    0.0345
   18    1.1475007040658535566202305540057194    0.9990
   19    0.0074437693747247436380571232911439    0.9930
   20    3.0004979451814267835092470273789653    0.0145
   21    1.9618964438433854031759769272035797    0.0345
   22    1.1475013698959353836171509125085707    0.9990
   23    0.0074455408351290519891466995433267    0.9930
   24    3.0004981820535563402785718618427901    0.0145
   25    1.9618966141315405983324237539648511    0.0345
   26    1.1475015246753832275263338139988505    0.9990
   27    0.0074459526298832707072746873284613    0.9930
   28    3.0004982371250538403212646313348502    0.0145
   29    1.9618966537226212790690343896498993    0.0345
   30    1.1475015606607709502971003306512012    0.9990
   31    0.0074460483699183575761779659291768    0.9930
   32    3.0004982499293123245041122889111999    0.0145
   33    1.9618966629276447884715838014323994    0.0345
   34    1.1475015690274618890347755273667324    0.9990
   35    0.0074460706297099807544253784661975    0.9930
   36    3.0004982529063571917685514389305636    0.0145
   37    1.9618966650678521270287740123274542    0.0345
   38    1.1475015709727533136576979220568359    0.9990
   39    0.0074460758052066524820763293674765    0.9930
   40    3.0004982535985341176046870569245853    0.0145
   41    1.9618966655654603936370725389745044    0.0345
   42    1.1475015714250427137472225894589379    0.9990
   43    0.0074460770085339519299251076540569    0.9930
   44    3.0004982537594685746922488135291173    0.0145
   45    1.9618966656811567036941241997502280    0.0345
   46    1.1475015715302021698330497429383525    0.9990
   47    0.0074460772883133236666297559859944    0.9930
   48    3.0004982537968866119888174933193142    0.0145
   49    1.9618966657080566536681489264198661    0.0345
   50    1.1475015715546522504493610275433184    0.9990
   51    0.0074460773533633766724801518591944    0.9930
   52    3.0004982538055864862885753285680369    0.0145
   53    1.9618966657143110218913794281220342    0.0345
   54    1.1475015715603370122206093363502196    0.9990
   55    0.0074460773684878280120136670947027    0.9930
   56    3.0004982538076092490709824229652840    0.0145
   57    1.9618966657157651927027630371558886    0.0345
   58    1.1475015715616587467815356281431656    0.9990
   59    0.0074460773720043359774680054639690    0.9930
   60    3.0004982538080795511854699640976087    0.0145
   61    1.9618966657161032944383535331630452    0.0345
   62    1.1475015715619660564493825071255484    0.9990
   63    0.0074460773728219410600533975692679    0.9930
   64    3.0004982538081888986981287885254636    0.0145
   65    1.9618966657161819047245367791480458    0.0345
   66    1.1475015715620375074311236313323675    0.9990
   67    0.0074460773730120381898851045733855    0.9930
   68    3.0004982538082143225228515412464733    0.0145
   69    1.9618966657162001819956765811338672    0.0345
   70    1.1475015715620541201294089845565221    0.9990
   71    0.0074460773730562366905333851559164    0.9930
   72    3.0004982538082202336848690993857368    0.0145
   73    1.9618966657162044315494759951141223    0.0345
   74    1.1475015715620579826619816564171978    0.9990
   75    0.0074460773730665130553649641782890    0.9930
   76    3.0004982538082216080585826924300447    0.0145
   77    1.9618966657162054195912551014634197    0.0345
   78    1.1475015715620588807194566518400350    0.9990
   79    0.0074460773730689023598120191497347    0.9930
   80    3.0004982538082219276071078396760975    0.0145
   81    1.9618966657162056493157399156299480    0.0345
   82    1.1475015715620590895221562334623499    0.9990
   83    0.0074460773730694578846337127672221    0.9930
   84    3.0004982538082220019036830097942805    0.0145
   85    1.9618966657162057027277919554498230    0.0345
   86    1.1475015715620591380697921771462010    0.9990
   87    0.0074460773730695870468373399243437    0.9930
   88    3.0004982538082220191779955088605745    0.0145
   89    1.9618966657162057151463519770876569    0.0345
   90    1.1475015715620591493573519665695876    0.9990
   91    0.0074460773730696170776733968321431    0.9930
   92    3.0004982538082220231943565811192230    0.0145
   93    1.9618966657162057180337271503172528    0.0345
   94    1.1475015715620591519817641243027852    0.9990
   95    0.0074460773730696240599877964856934    0.9930
   96    3.0004982538082220241281799250946546    0.0145
   97    1.9618966657162057187050558209889379    0.0345
   98    1.1475015715620591525919526240449139    0.9990
   99    0.0074460773730696256834096114236483    0.9930
0.0074460773730696256834096114236483593978874364191387906541329988608858\
474440033267960566423132571438819239803252688229901315901530314029989536\
024153865248236323758043950761297724723820894866567624033536109935191554\
935623511088996587624949385177332891788112842908871405235614412036516383\
2365866280170618
    1    1.9615449305316294507396457065073598    0.0343
    2    1.1471818422762655619809529740372220    0.9990
    3    0.0065950324385670507318772033316270    0.9930
    4    3.0003909273906555706224450060579746    0.0145
    5    1.9618195080364787104698047813667259    0.0345
    6    1.1474314395549161305178303287134540    0.9990
    7    0.0072594703087416080535673455616170    0.9930
    8    3.0004736089130599090180132104642369    0.0145
    9    1.9618789484008182643086990334733692    0.0345
   10    1.1474854677519130878281448652578329    0.9990
   11    0.0074032317751432876549727894885272    0.9930
   12    3.0004925400413209761088825909757320    0.0145
   13    1.9618925580693685337734981062665465    0.0345
   14    1.1474978380087099204095249373236730    0.9990
   15    0.0074361441065754228347190956942783    0.9930
   16    3.0004969262054086300624521008687524    0.0145
   17    1.9618957112981245472716518415023242    0.0345
   18    1.1475007040658535566202305540057194    0.9990
   19    0.0074437693747247436380571232911439    0.9930
   20    3.0004979451814267835092470273789653    0.0145
   21    1.9618964438433854031759769272035797    0.0345
   22    1.1475013698959353836171509125085707    0.9990
   23    0.0074455408351290519891466995433267    0.9930
   24    3.0004981820535563402785718618427901    0.0145
   25    1.9618966141315405983324237539648511    0.0345
   26    1.1475015246753832275263338139988505    0.9990
   27    0.0074459526298832707072746873284613    0.9930
   28    3.0004982371250538403212646313348502    0.0145
   29    1.9618966537226212790690343896498993    0.0345
   30    1.1475015606607709502971003306512012    0.9990
   31    0.0074460483699183575761779659291768    0.9930
   32    3.0004982499293123245041122889111999    0.0145
   33    1.9618966629276447884715838014323994    0.0345
   34    1.1475015690274618890347755273667324    0.9990
   35    0.0074460706297099807544253784661975    0.9930
   36    3.0004982529063571917685514389305636    0.0145
   37    1.9618966650678521270287740123274542    0.0345
   38    1.1475015709727533136576979220568359    0.9990
   39    0.0074460758052066524820763293674765    0.9930
   40    3.0004982535985341176046870569245853    0.0145
   41    1.9618966655654603936370725389745044    0.0345
   42    1.1475015714250427137472225894589379    0.9990
   43    0.0074460770085339519299251076540569    0.9930
   44    3.0004982537594685746922488135291173    0.0145
   45    1.9618966656811567036941241997502280    0.0345
   46    1.1475015715302021698330497429383525    0.9990
   47    0.0074460772883133236666297559859944    0.9930
   48    3.0004982537968866119888174933193142    0.0145
   49    1.9618966657080566536681489264198661    0.0345
   50    1.1475015715546522504493610275433184    0.9990
   51    0.0074460773533633766724801518591944    0.9930
   52    3.0004982538055864862885753285680369    0.0145
   53    1.9618966657143110218913794281220342    0.0345
   54    1.1475015715603370122206093363502196    0.9990
   55    0.0074460773684878280120136670947027    0.9930
   56    3.0004982538076092490709824229652840    0.0145
   57    1.9618966657157651927027630371558886    0.0345
   58    1.1475015715616587467815356281431656    0.9990
   59    0.0074460773720043359774680054639690    0.9930
   60    3.0004982538080795511854699640976087    0.0145
   61    1.9618966657161032944383535331630452    0.0345
   62    1.1475015715619660564493825071255484    0.9990
   63    0.0074460773728219410600533975692679    0.9930
   64    3.0004982538081888986981287885254636    0.0145
   65    1.9618966657161819047245367791480458    0.0345
   66    1.1475015715620375074311236313323675    0.9990
   67    0.0074460773730120381898851045733855    0.9930
   68    3.0004982538082143225228515412464733    0.0145
   69    1.9618966657162001819956765811338672    0.0345
   70    1.1475015715620541201294089845565221    0.9990
   71    0.0074460773730562366905333851559164    0.9930
   72    3.0004982538082202336848690993857368    0.0145
   73    1.9618966657162044315494759951141223    0.0345
   74    1.1475015715620579826619816564171978    0.9990
   75    0.0074460773730665130553649641782890    0.9930
   76    3.0004982538082216080585826924300447    0.0145
   77    1.9618966657162054195912551014634197    0.0345
   78    1.1475015715620588807194566518400350    0.9990
   79    0.0074460773730689023598120191497347    0.9930
   80    3.0004982538082219276071078396760975    0.0145
   81    1.9618966657162056493157399156299480    0.0345
   82    1.1475015715620590895221562334623499    0.9990
   83    0.0074460773730694578846337127672221    0.9930
   84    3.0004982538082220019036830097942805    0.0145
   85    1.9618966657162057027277919554498230    0.0345
   86    1.1475015715620591380697921771462010    0.9990
   87    0.0074460773730695870468373399243437    0.9930
   88    3.0004982538082220191779955088605745    0.0145
   89    1.9618966657162057151463519770876569    0.0345
   90    1.1475015715620591493573519665695876    0.9990
   91    0.0074460773730696170776733968321431    0.9930
   92    3.0004982538082220231943565811192230    0.0145
   93    1.9618966657162057180337271503172528    0.0345
   94    1.1475015715620591519817641243027852    0.9990
   95    0.0074460773730696240599877964856934    0.9930
   96    3.0004982538082220241281799250946546    0.0145
   97    1.9618966657162057187050558209889379    0.0345
   98    1.1475015715620591525919526240449139    0.9990
   99    0.0074460773730696256834096114236483    0.9930
0.00744607737306962568340961142364835939788743641913879065413299886088584744400332679605664231325714388192398032526882299013159015303140299895360241538652482363237580439507612977247238208948665676240335361099351915549356235110889965876249493851773328917881128429088714052356144120365163832365866280170618
s=newton(x^3-x+3,x,0.0675,500);s 
       
    1    1.9909273304842838027383726042609595    0.0447
    2    1.1737032568026393815445511822764861    0.9987
    3    0.0746116348305583805131788410320322    0.9939
    4    3.0501081953832093256121477416910610    0.0104
    5    1.9974852400828406764201312305545027    0.0470
    6    1.1795723030225120785837633087756539    0.9986
    7    0.0889971000001216474122094702931165    0.9941
    8    3.0715752867972731622872747316136991    0.0095
    9    2.0128394494130077868491988846022500    0.0522
   10    1.1932447136892669697955315533388392    0.9985
   11    0.1216452437245527953909895411558040    0.9946
   12    3.1355975205084846637063429971347065    0.0077
   13    2.0584779247553342509228627494284328    0.0673
   14    1.2333430185325453931577307478252327    0.9979
   15    0.2110797025569479616802299659013644    0.9958
   16    3.4411482064971231237410855892570618    0.0026
   17    2.2736524217447667473630473143615137    0.1320
   18    1.4134673437425389979824923364913129    0.9952
   19    0.5302521909747908209647180768493199    0.9995
   20    17.264268454184644894337283641997014    -0.035
   21    11.519039672643916730063442707089887    0.6205
   22    7.6911446579033563500395006620459358    0.9450
   23    5.1394858542650158739787865728552515    0.9533
   24    3.4317726229210140950979527684256321    0.9649
   25    2.2671048411549660063586395516198749    0.9798
   26    1.4081667675033934376858577086623073    0.9953
   27    0.5222684355625410715859560985685174    0.9995
   28    14.942115382184940875773600777444567    -0.032
   29    9.9718190551990533149059334392315830    0.6008
   30    6.6601489226171138024228576886483414    0.9476
   31    4.4510031152053529547099241056166995    0.9571
   32    2.9667764131508814768144976717934567    0.9699
   33    1.9376172276120463026960131176557469    0.9855
   34    1.1252982037888091580767045025974949    0.9993
   35    -0.053620815497296534662333201763454    0.9921
   36    3.0264128933628244418337745530408539    0.0187
   37    1.9805057544183889109109202239619355    0.0398
   38    1.1643391937086683883700082149628858    0.9988
   39    0.0511748268048389354905455779263896    0.9936
   40    3.0234862481678900271000472071895749    0.0118
   41    1.9784062374411521049305891275211108    0.0404
   42    1.1624471105379737424385913424680098    0.9988
   43    0.0463646566185470910737867920335243    0.9935
   44    3.0192720804696573659138857485888337    0.0121
   45    1.9753821545852961577899722727292987    0.0394
   46    1.1597184606448544237304887603691999    0.9989
   47    0.0393824672765983294281184260763498    0.9934
   48    3.0139013278122807658698784664927787    0.0125
   49    1.9715265188131476934219239698121508    0.0380
   50    1.1562337208517248979059498379613450    0.9989
   51    0.0303867333994880624629596750973396    0.9933
   52    3.0082769944800188595449497115396150    0.0130
   53    1.9674869158381074880929958324399295    0.0366
   54    1.1525757067765163764951382602355724    0.9990
   55    0.0208468846769157304287551283562715    0.9932
   56    3.0038982961148767576396198395833947    0.0136
   57    1.9643406011901368323733275978280999    0.0354
   58    1.1497215898425453516393095480782651    0.9990
   59    0.0133334325244310170203492318276853    0.9931
   60    3.0015961342436690838060118492642054    0.0141
   61    1.9626858973518636515132899497649753    0.0348
   62    1.1482187853020283319664197892506776    0.9990
   63    0.0093522478699475557734504926465606    0.9930
   64    3.0007857510579335237314330601745213    0.0144
   65    1.9621033458120247316999685443910348    0.0346
   66    1.1476894190041471779374930497314433    0.9990
   67    0.0079457132452366722404642607757216    0.9930
   68    3.0005673133866560969310924469605874    0.0145
   69    1.9619463127227887096182604240265296    0.0345
   70    1.1475466964940176905618701258285181    0.9990
   71    0.0075661254813075223956882555299348    0.9930
   72    3.0005144383775070435514458051478081    0.0145
   73    1.9619083008479399851095182415702859    0.0345
   74    1.1475121470125977978570596915799094    0.9990
   75    0.0074742131903618261188801215072240    0.9930
   76    3.0005020238234641873733859516926322    0.0145
   77    1.9618993759921012692930952400391558    0.0345
   78    1.1475040350023180621518774299055469    0.9990
   79    0.0074526313941309683869849259173053    0.9930
   80    3.0004991307361486429350279508176108    0.0145
   81    1.9618972961425494897480343765750961    0.0345
   82    1.1475021445732558193414947727248203    0.9990
   83    0.0074476018824619931825058936464277    0.9930
   84    3.0004984577188235500939290248142840    0.0145
   85    1.9618968123082059183852304614140815    0.0345
   86    1.1475017048034256270103838598638941    0.9990
   87    0.0074464318649996070179267082315753    0.9930
   88    3.0004983012195366750949558957538333    0.0145
   89    1.9618966998003555508779337260043802    0.0345
   90    1.1475016025420500041506805441525420    0.9990
   91    0.0074461597961089363340220074358441    0.9930
   92    3.0004982648316419110420302629737830    0.0145
   93    1.9618966736409784962128888361269255    0.0345
   94    1.1475015787650960757596027061413894    0.9990
   95    0.0074460965369299031119020530635609    0.9930
   96    3.0004982563712236381893536867521275    0.0145
   97    1.9618966675587560012644262699705358    0.0345
   98    1.1475015732368021528830048785840103    0.9990
   99    0.0074460818287653911577395739291471    0.9930
0.0074460818287653911577395739291471361634994620491861102972637157685212\
023002308814819733346520618527946773216767283184400809190885862732814646\
023466564132494146762754154535023209959970966910849448042687566182736714\
282544853186394949456292259541640907589359699588479645126256810233436617\
3072552757422509
    1    1.9909273304842838027383726042609595    0.0447
    2    1.1737032568026393815445511822764861    0.9987
    3    0.0746116348305583805131788410320322    0.9939
    4    3.0501081953832093256121477416910610    0.0104
    5    1.9974852400828406764201312305545027    0.0470
    6    1.1795723030225120785837633087756539    0.9986
    7    0.0889971000001216474122094702931165    0.9941
    8    3.0715752867972731622872747316136991    0.0095
    9    2.0128394494130077868491988846022500    0.0522
   10    1.1932447136892669697955315533388392    0.9985
   11    0.1216452437245527953909895411558040    0.9946
   12    3.1355975205084846637063429971347065    0.0077
   13    2.0584779247553342509228627494284328    0.0673
   14    1.2333430185325453931577307478252327    0.9979
   15    0.2110797025569479616802299659013644    0.9958
   16    3.4411482064971231237410855892570618    0.0026
   17    2.2736524217447667473630473143615137    0.1320
   18    1.4134673437425389979824923364913129    0.9952
   19    0.5302521909747908209647180768493199    0.9995
   20    17.264268454184644894337283641997014    -0.035
   21    11.519039672643916730063442707089887    0.6205
   22    7.6911446579033563500395006620459358    0.9450
   23    5.1394858542650158739787865728552515    0.9533
   24    3.4317726229210140950979527684256321    0.9649
   25    2.2671048411549660063586395516198749    0.9798
   26    1.4081667675033934376858577086623073    0.9953
   27    0.5222684355625410715859560985685174    0.9995
   28    14.942115382184940875773600777444567    -0.032
   29    9.9718190551990533149059334392315830    0.6008
   30    6.6601489226171138024228576886483414    0.9476
   31    4.4510031152053529547099241056166995    0.9571
   32    2.9667764131508814768144976717934567    0.9699
   33    1.9376172276120463026960131176557469    0.9855
   34    1.1252982037888091580767045025974949    0.9993
   35    -0.053620815497296534662333201763454    0.9921
   36    3.0264128933628244418337745530408539    0.0187
   37    1.9805057544183889109109202239619355    0.0398
   38    1.1643391937086683883700082149628858    0.9988
   39    0.0511748268048389354905455779263896    0.9936
   40    3.0234862481678900271000472071895749    0.0118
   41    1.9784062374411521049305891275211108    0.0404
   42    1.1624471105379737424385913424680098    0.9988
   43    0.0463646566185470910737867920335243    0.9935
   44    3.0192720804696573659138857485888337    0.0121
   45    1.9753821545852961577899722727292987    0.0394
   46    1.1597184606448544237304887603691999    0.9989
   47    0.0393824672765983294281184260763498    0.9934
   48    3.0139013278122807658698784664927787    0.0125
   49    1.9715265188131476934219239698121508    0.0380
   50    1.1562337208517248979059498379613450    0.9989
   51    0.0303867333994880624629596750973396    0.9933
   52    3.0082769944800188595449497115396150    0.0130
   53    1.9674869158381074880929958324399295    0.0366
   54    1.1525757067765163764951382602355724    0.9990
   55    0.0208468846769157304287551283562715    0.9932
   56    3.0038982961148767576396198395833947    0.0136
   57    1.9643406011901368323733275978280999    0.0354
   58    1.1497215898425453516393095480782651    0.9990
   59    0.0133334325244310170203492318276853    0.9931
   60    3.0015961342436690838060118492642054    0.0141
   61    1.9626858973518636515132899497649753    0.0348
   62    1.1482187853020283319664197892506776    0.9990
   63    0.0093522478699475557734504926465606    0.9930
   64    3.0007857510579335237314330601745213    0.0144
   65    1.9621033458120247316999685443910348    0.0346
   66    1.1476894190041471779374930497314433    0.9990
   67    0.0079457132452366722404642607757216    0.9930
   68    3.0005673133866560969310924469605874    0.0145
   69    1.9619463127227887096182604240265296    0.0345
   70    1.1475466964940176905618701258285181    0.9990
   71    0.0075661254813075223956882555299348    0.9930
   72    3.0005144383775070435514458051478081    0.0145
   73    1.9619083008479399851095182415702859    0.0345
   74    1.1475121470125977978570596915799094    0.9990
   75    0.0074742131903618261188801215072240    0.9930
   76    3.0005020238234641873733859516926322    0.0145
   77    1.9618993759921012692930952400391558    0.0345
   78    1.1475040350023180621518774299055469    0.9990
   79    0.0074526313941309683869849259173053    0.9930
   80    3.0004991307361486429350279508176108    0.0145
   81    1.9618972961425494897480343765750961    0.0345
   82    1.1475021445732558193414947727248203    0.9990
   83    0.0074476018824619931825058936464277    0.9930
   84    3.0004984577188235500939290248142840    0.0145
   85    1.9618968123082059183852304614140815    0.0345
   86    1.1475017048034256270103838598638941    0.9990
   87    0.0074464318649996070179267082315753    0.9930
   88    3.0004983012195366750949558957538333    0.0145
   89    1.9618966998003555508779337260043802    0.0345
   90    1.1475016025420500041506805441525420    0.9990
   91    0.0074461597961089363340220074358441    0.9930
   92    3.0004982648316419110420302629737830    0.0145
   93    1.9618966736409784962128888361269255    0.0345
   94    1.1475015787650960757596027061413894    0.9990
   95    0.0074460965369299031119020530635609    0.9930
   96    3.0004982563712236381893536867521275    0.0145
   97    1.9618966675587560012644262699705358    0.0345
   98    1.1475015732368021528830048785840103    0.9990
   99    0.0074460818287653911577395739291471    0.9930
0.00744608182876539115773957392914713616349946204918611029726371576852120230023088148197333465206185279467732167672831844008091908858627328146460234665641324941467627541545350232099599709669108494480426875661827367142825448531863949494562922595416409075893596995884796451262568102334366173072552757422509
s=newton(x^3-x+3,x,0.068,500);s 
       
    1    1.9913663398837100256770969603097961    0.0449
    2    1.1740967111550665288194895002208964    0.9987
    3    0.0755832185805581455144365351205042    0.9939
    4    3.0514333074245730849089482227736456    0.0103
    5    1.9984337960511037711459862359373908    0.0473
    6    1.1804197439601868963445897838457927    0.9986
    7    0.0910554296195169287350826249837883    0.9941
    8    3.0749747921471774837935001423474213    0.0094
    9    2.0152684912974401319448427973926595    0.0530
   10    1.1953990109602853916729375586637193    0.9984
   11    0.1266832175903060861780868196795665    0.9946
   12    3.1474717126966349746054298407203788    0.0074
   13    2.0669184493982109243716388326968495    0.0700
   14    1.2406748287297595432912938744332672    0.9978
   15    0.2265111627522057456976908511076087    0.9960
   16    3.5183001626566312122421625575752350    0.0016
   17    2.3274218884849865913901253062459088    0.1466
   18    1.4566427220051460952918763863726521    0.9944
   19    0.5929507870367900606361484369461087    1.0001
   20    -47.16009040779999538187824520474715    0.9405
   21    -31.44522275308835741855650612667235    0.4291
   22    -20.97156284723727360833315134018001    0.8527
   23    -13.99392174702080728187088004202595    0.8270
   24    -9.350303331956435944813150120254699    0.7903
   25    -6.268874562297280630698131012422107    0.7329
   26    -4.240665216870562903099463670531159    0.6283
   27    -2.937160011802311396315531195915010    0.3748
   28    -2.157381668124692381476203095634777    -0.938
   29    -1.780636080792161221573934169082239    3.9244
   30    -1.678995490045810246653057973671530    2.3420
   31    -1.671735781757340400061388054093989    2.1543
   32    -1.671699882532506348031309687534227    2.0779
   33    -1.671699881657160970268579356918825    2.0377
   34    -1.671699881657160969748149781219557    2.0185
   35    -1.671699881657160969748149781219557    2.0091
   36    -1.671699881657160969748149781219557    2.0045
   37    -1.671699881657160969748149781219557    2.0022
   38    -1.671699881657160969748149781219557    2.0011
-1.671699881657160969748149781219557228728264827204581692136902438647525\
130021793252873637860885144817462201294842238001408043637121196105520257\
661790076179709180798729155990778055228707800919290139391318735814828863\
468260518409718961643395815955426434605623954874683209103779627959172263\
92073304887245
    1    1.9913663398837100256770969603097961    0.0449
    2    1.1740967111550665288194895002208964    0.9987
    3    0.0755832185805581455144365351205042    0.9939
    4    3.0514333074245730849089482227736456    0.0103
    5    1.9984337960511037711459862359373908    0.0473
    6    1.1804197439601868963445897838457927    0.9986
    7    0.0910554296195169287350826249837883    0.9941
    8    3.0749747921471774837935001423474213    0.0094
    9    2.0152684912974401319448427973926595    0.0530
   10    1.1953990109602853916729375586637193    0.9984
   11    0.1266832175903060861780868196795665    0.9946
   12    3.1474717126966349746054298407203788    0.0074
   13    2.0669184493982109243716388326968495    0.0700
   14    1.2406748287297595432912938744332672    0.9978
   15    0.2265111627522057456976908511076087    0.9960
   16    3.5183001626566312122421625575752350    0.0016
   17    2.3274218884849865913901253062459088    0.1466
   18    1.4566427220051460952918763863726521    0.9944
   19    0.5929507870367900606361484369461087    1.0001
   20    -47.16009040779999538187824520474715    0.9405
   21    -31.44522275308835741855650612667235    0.4291
   22    -20.97156284723727360833315134018001    0.8527
   23    -13.99392174702080728187088004202595    0.8270
   24    -9.350303331956435944813150120254699    0.7903
   25    -6.268874562297280630698131012422107    0.7329
   26    -4.240665216870562903099463670531159    0.6283
   27    -2.937160011802311396315531195915010    0.3748
   28    -2.157381668124692381476203095634777    -0.938
   29    -1.780636080792161221573934169082239    3.9244
   30    -1.678995490045810246653057973671530    2.3420
   31    -1.671735781757340400061388054093989    2.1543
   32    -1.671699882532506348031309687534227    2.0779
   33    -1.671699881657160970268579356918825    2.0377
   34    -1.671699881657160969748149781219557    2.0185
   35    -1.671699881657160969748149781219557    2.0091
   36    -1.671699881657160969748149781219557    2.0045
   37    -1.671699881657160969748149781219557    2.0022
   38    -1.671699881657160969748149781219557    2.0011
-1.67169988165716096974814978121955722872826482720458169213690243864752513002179325287363786088514481746220129484223800140804363712119610552025766179007617970918079872915599077805522870780091929013939131873581482886346826051840971896164339581595542643460562395487468320910377962795917226392073304887245
s=newton(x*e^(-x),x,2.,500);s 
       
    1    5.3333333333333333333333333333333333    0.4150
    2    6.5641025641025641025641025641025641    0.7217
    3    7.7438260664067115680018905825357438    0.7959
    4    8.8921098433239929444846407446088782    0.8365
    5    10.018818672756455676777604636235424    0.8628
    6    11.129697939352727782130152801281618    0.8814
    7    12.228417566135981940227514635172795    0.8953
    8    13.317477310673442035888302369919962    0.9062
    9    14.398662765680001841103471399879502    0.9149
   10    15.473297079378936745916357048178793    0.9221
   11    16.542389836510604147065135525733483    0.9281
   12    17.606730006234754388905458273489616    0.9333
   13    18.666946556971989509606901310267654    0.9377
   14    19.723549433806151060658780967034915    0.9416
   15    20.776958110592319510355444221022823    0.9450
   16    21.827522003907359252808029652546939    0.9480
   17    22.875535396946262028877632872589205    0.9507
   18    23.921248563817578743414146246833842    0.9531
   19    24.964876204659908496750018413448289    0.9553
   20    26.006603939510696191360294871296368    0.9573
   21    27.046593375997911055594216505678790    0.9591
   22    28.084986112643521912320958327094864    0.9608
   23    29.121906936447569969602869841445319    0.9623
   24    30.157466402676509937629681715033978    0.9637
   25    31.191762935378960552110905967308429    0.9650
   26    32.224884552097412975725286385933042    0.9662
   27    33.256910291002277198823390607920745    0.9674
   28    34.287911400252314062631789014467382    0.9684
   29    35.317952335773201691812196687127479    0.9694
   30    36.347091603472387668577054878272564    0.9704
   31    37.375382474224021535089249598307015    0.9712
   32    38.402873594096331070633100733524269    0.9721
   33    39.429609507781792927310420211710038    0.9728
   34    40.455631109687414822384153505414371    0.9736
   35    41.480976034400948886236902262084438    0.9743
   36    42.505678996087203552569366298208820    0.9749
   37    43.529772084652126712875802026350777    0.9756
   38    44.553285025140252997267987951101325    0.9761
   39    45.576245405727452567245872335383161    0.9767
   40    46.598678878777910813044763953768839    0.9773
   41    47.620609338707648167267538030469265    0.9778
   42    48.642059079802510498215689943637651    0.9783
   43    49.663048936649901513129214861765395    0.9787
   44    50.683598409439857833480144871542909    0.9792
   45    51.703725776056081036036675451755713    0.9796
   46    52.723448192598342944992120475497079    0.9800
   47    53.742781783744014099439669368274337    0.9804
   48    54.761741724160130196753289774357736    0.9808
   49    55.780342312011818182073286777052948    0.9812
   50    56.798597035472732510475054895867914    0.9815
   51    57.816518633024088003587191422566882    0.9819
   52    58.834119148227403523820724949045077    0.9822
   53    59.851409979569314774607136935902814    0.9825
   54    60.868401925902412946883694069621557    0.9828
   55    61.885105227942071102064753776292433    0.9831
   56    62.901529606224020245420074264310586    0.9834
   57    63.917684295879693194809108639876833    0.9837
   58    64.933578078544950747221537234552131    0.9839
   59    65.949219311681808191890748811957706    0.9842
   60    66.964615955561408132815668672388673    0.9844
   61    67.979775598129079157671132501653049    0.9847
   62    68.994705477948323171730314998687480    0.9849
   63    70.009412505399516627027480877048984    0.9851
   64    71.023903282290592997359398824491413    0.9854
   65    72.038184120020655742486323893889640    0.9856
   66    73.052261056423062606689635338629153    0.9858
   67    74.066139871401775276838174232275474    0.9860
   68    75.079826101463470405239466035306955    0.9862
   69    76.093325053237875889212064113493780    0.9864
   70    77.106641816069872525838609693859358    0.9865
   71    78.119781273758949677970657651384109    0.9867
   72    79.132748115514506673397787608996342    0.9869
   73    80.145546846189147234357875841815520    0.9871
   74    81.158181795846433605522107917323132    0.9872
   75    82.170657128714472999142193919882822    0.9874
   76    83.182976851572134153281683741500706    0.9876
   77    84.195144821610577343584864578618888    0.9877
   78    85.207164753809075570437637698710501    0.9879
   79    86.219040227860762667786469320607250    0.9880
   80    87.230774694680926042554100337029863    0.9881
   81    88.242371482527732713678973977690621    0.9883
   82    89.253833802762806478528071584745483    0.9884
   83    90.265164755276834200811410512838069    0.9886
   84    91.276367333603346345086026799372748    0.9887
   85    92.287444429741969686678506061593122    0.9888
   86    93.298398838710769719167031617042279    0.9889
   87    94.309233262845769893214148703141221    0.9891
   88    95.319950315864339534102180309532663    0.9892
   89    96.330552526707868815810952706870485    0.9893
   90    97.341042343177985669039241570204171    0.9894
   91    98.351422135379505389166612210504739    0.9895
   92    99.361694198982329527781902363323346    0.9896
   93    100.37186075831361792894524370778489    0.9897
   94    101.38192396929073891748221088302235    0.9898
   95    102.39188592220475084868337157488279    0.9899
   96    103.40174864436347736578996076275293    0.9900
   97    104.41151410260260327769301170851642    0.9901
   98    105.42118420567263300621097285664955    0.9902
   99    106.43076080650901459034175533648867    0.9903
106.43076080650901459034175533648867562271664927893334751714503600909880\
699669170348739101537199081005545263121273874682489352182504965495961087\
345690541310998799388488520097469523632262709293016822789946763687117197\
765435395005374180031774688393049085473010843037093363437564120845595025\
9946834110768
    1    5.3333333333333333333333333333333333    0.4150
    2    6.5641025641025641025641025641025641    0.7217
    3    7.7438260664067115680018905825357438    0.7959
    4    8.8921098433239929444846407446088782    0.8365
    5    10.018818672756455676777604636235424    0.8628
    6    11.129697939352727782130152801281618    0.8814
    7    12.228417566135981940227514635172795    0.8953
    8    13.317477310673442035888302369919962    0.9062
    9    14.398662765680001841103471399879502    0.9149
   10    15.473297079378936745916357048178793    0.9221
   11    16.542389836510604147065135525733483    0.9281
   12    17.606730006234754388905458273489616    0.9333
   13    18.666946556971989509606901310267654    0.9377
   14    19.723549433806151060658780967034915    0.9416
   15    20.776958110592319510355444221022823    0.9450
   16    21.827522003907359252808029652546939    0.9480
   17    22.875535396946262028877632872589205    0.9507
   18    23.921248563817578743414146246833842    0.9531
   19    24.964876204659908496750018413448289    0.9553
   20    26.006603939510696191360294871296368    0.9573
   21    27.046593375997911055594216505678790    0.9591
   22    28.084986112643521912320958327094864    0.9608
   23    29.121906936447569969602869841445319    0.9623
   24    30.157466402676509937629681715033978    0.9637
   25    31.191762935378960552110905967308429    0.9650
   26    32.224884552097412975725286385933042    0.9662
   27    33.256910291002277198823390607920745    0.9674
   28    34.287911400252314062631789014467382    0.9684
   29    35.317952335773201691812196687127479    0.9694
   30    36.347091603472387668577054878272564    0.9704
   31    37.375382474224021535089249598307015    0.9712
   32    38.402873594096331070633100733524269    0.9721
   33    39.429609507781792927310420211710038    0.9728
   34    40.455631109687414822384153505414371    0.9736
   35    41.480976034400948886236902262084438    0.9743
   36    42.505678996087203552569366298208820    0.9749
   37    43.529772084652126712875802026350777    0.9756
   38    44.553285025140252997267987951101325    0.9761
   39    45.576245405727452567245872335383161    0.9767
   40    46.598678878777910813044763953768839    0.9773
   41    47.620609338707648167267538030469265    0.9778
   42    48.642059079802510498215689943637651    0.9783
   43    49.663048936649901513129214861765395    0.9787
   44    50.683598409439857833480144871542909    0.9792
   45    51.703725776056081036036675451755713    0.9796
   46    52.723448192598342944992120475497079    0.9800
   47    53.742781783744014099439669368274337    0.9804
   48    54.761741724160130196753289774357736    0.9808
   49    55.780342312011818182073286777052948    0.9812
   50    56.798597035472732510475054895867914    0.9815
   51    57.816518633024088003587191422566882    0.9819
   52    58.834119148227403523820724949045077    0.9822
   53    59.851409979569314774607136935902814    0.9825
   54    60.868401925902412946883694069621557    0.9828
   55    61.885105227942071102064753776292433    0.9831
   56    62.901529606224020245420074264310586    0.9834
   57    63.917684295879693194809108639876833    0.9837
   58    64.933578078544950747221537234552131    0.9839
   59    65.949219311681808191890748811957706    0.9842
   60    66.964615955561408132815668672388673    0.9844
   61    67.979775598129079157671132501653049    0.9847
   62    68.994705477948323171730314998687480    0.9849
   63    70.009412505399516627027480877048984    0.9851
   64    71.023903282290592997359398824491413    0.9854
   65    72.038184120020655742486323893889640    0.9856
   66    73.052261056423062606689635338629153    0.9858
   67    74.066139871401775276838174232275474    0.9860
   68    75.079826101463470405239466035306955    0.9862
   69    76.093325053237875889212064113493780    0.9864
   70    77.106641816069872525838609693859358    0.9865
   71    78.119781273758949677970657651384109    0.9867
   72    79.132748115514506673397787608996342    0.9869
   73    80.145546846189147234357875841815520    0.9871
   74    81.158181795846433605522107917323132    0.9872
   75    82.170657128714472999142193919882822    0.9874
   76    83.182976851572134153281683741500706    0.9876
   77    84.195144821610577343584864578618888    0.9877
   78    85.207164753809075570437637698710501    0.9879
   79    86.219040227860762667786469320607250    0.9880
   80    87.230774694680926042554100337029863    0.9881
   81    88.242371482527732713678973977690621    0.9883
   82    89.253833802762806478528071584745483    0.9884
   83    90.265164755276834200811410512838069    0.9886
   84    91.276367333603346345086026799372748    0.9887
   85    92.287444429741969686678506061593122    0.9888
   86    93.298398838710769719167031617042279    0.9889
   87    94.309233262845769893214148703141221    0.9891
   88    95.319950315864339534102180309532663    0.9892
   89    96.330552526707868815810952706870485    0.9893
   90    97.341042343177985669039241570204171    0.9894
   91    98.351422135379505389166612210504739    0.9895
   92    99.361694198982329527781902363323346    0.9896
   93    100.37186075831361792894524370778489    0.9897
   94    101.38192396929073891748221088302235    0.9898
   95    102.39188592220475084868337157488279    0.9899
   96    103.40174864436347736578996076275293    0.9900
   97    104.41151410260260327769301170851642    0.9901
   98    105.42118420567263300621097285664955    0.9902
   99    106.43076080650901459034175533648867    0.9903
106.430760806509014590341755336488675622716649278933347517145036009098806996691703487391015371990810055452631212738746824893521825049654959610873456905413109987993884885200974695236322627092930168227899467636871171977654353950053741800317746883930490854730108430370933634375641208455950259946834110768
s=newton(arctan(x),x,1.35,500);s 
       
    1    1.1241231064736945017905996472942595    0.0787
    2    -0.785871881002653256273881483721271    0.7362
    3    0.2915539773939711866160659251443061    0.0046
    4    -0.016251001443270132112595524951224    -15.80
    5    2.8610548941901073520949669432597914    0.4311
    6    -1.561303425768452569288048388968775    3.0985
    7    2.5372933360029383118435714235141866    2.8586
    8    -1.088982190945941026540080773091302    3.0104
    9    0.0000000000000000000000000000000000    3.0012
0.0000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000
    1    1.1241231064736945017905996472942595    0.0787
    2    -0.785871881002653256273881483721271    0.7362
    3    0.2915539773939711866160659251443061    0.0046
    4    -0.016251001443270132112595524951224    -15.80
    5    2.8610548941901073520949669432597914    0.4311
    6    -1.561303425768452569288048388968775    3.0985
    7    2.5372933360029383118435714235141866    2.8586
    8    -1.088982190945941026540080773091302    3.0104
    9    0.0000000000000000000000000000000000    3.0012
0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
# What should I do to my code to fix this? s=newton(arctan(x),x,1.40,500);s 
       
1    1.4501293146283379758030671844126173    0.0994
    2    -1.550625975637755731005426446800477    1.0444
    3    1.8470540841501973350419671380336195    0.1213
    4    -2.893562393142439293658438480060261    1.2723
    5    8.7103258469833909771989769414146406    0.3103
    6    -103.2497737719154099242321211936869    1.9247
    7    16540.563827240296996044934989720310    1.4272
    8    -4.297214828964970702041144933028812    2.0451
    9    2.9006411728130222443501444285705941    1.9734
   10    -1.321623923512080641237663791587803    2.0112
   11    2.7436939143494514134682527357324886    2.0025
   12    -1.182472901782834519784221531640330    2.0027
   13    2.1963536543181357344240492253808211    2.0012
   14    -7.577473374564450444841306244507709    2.0006
   15    9.0192144879031829002439074447521516    2.0003
   16    -1.277783592493161410285964962427317    2.0001
   17    2.5646877148861129402339988585811304    2.0000
   18    -1.033210616507503363859865430906860    2.0000
   19    1.6768630576673820425387013964294204    2.0000
   20    -4.416874618443426430491738484917638    2.0000
   21    3.0644322155588787965235435376203171    2.0000
   22    -1.475094744360677118436888861575485    2.0000
   23    3.4179028036599122096286088617313198    2.0000
   24    -1.835013627022743593903534214577080    2.0000
   25    5.2893032191512197601852673912274560    2.0000
   26    -4.394574243284706096711381927396492    2.0000
   27    3.0335662852442043715788969295033606    2.0000
   28    -1.445529153570936537666612317935400    2.0000
   29    3.2822645863675892927806300299439486    2.0000
   30    -1.692259851568413200522648474375352    2.0000
   31    4.4983576218189395806365222784885349    2.0000
   32    -3.178541128014607388049517611756574    2.0000
   33    1.5869949601010625479749898298366866    2.0000
Traceback (click to the left of this block for traceback)
...
ZeroDivisionError: Symbolic division by zero
1    1.4501293146283379758030671844126173    0.0994
    2    -1.550625975637755731005426446800477    1.0444
    3    1.8470540841501973350419671380336195    0.1213
    4    -2.893562393142439293658438480060261    1.2723
    5    8.7103258469833909771989769414146406    0.3103
    6    -103.2497737719154099242321211936869    1.9247
    7    16540.563827240296996044934989720310    1.4272
    8    -4.297214828964970702041144933028812    2.0451
    9    2.9006411728130222443501444285705941    1.9734
   10    -1.321623923512080641237663791587803    2.0112
   11    2.7436939143494514134682527357324886    2.0025
   12    -1.182472901782834519784221531640330    2.0027
   13    2.1963536543181357344240492253808211    2.0012
   14    -7.577473374564450444841306244507709    2.0006
   15    9.0192144879031829002439074447521516    2.0003
   16    -1.277783592493161410285964962427317    2.0001
   17    2.5646877148861129402339988585811304    2.0000
   18    -1.033210616507503363859865430906860    2.0000
   19    1.6768630576673820425387013964294204    2.0000
   20    -4.416874618443426430491738484917638    2.0000
   21    3.0644322155588787965235435376203171    2.0000
   22    -1.475094744360677118436888861575485    2.0000
   23    3.4179028036599122096286088617313198    2.0000
   24    -1.835013627022743593903534214577080    2.0000
   25    5.2893032191512197601852673912274560    2.0000
   26    -4.394574243284706096711381927396492    2.0000
   27    3.0335662852442043715788969295033606    2.0000
   28    -1.445529153570936537666612317935400    2.0000
   29    3.2822645863675892927806300299439486    2.0000
   30    -1.692259851568413200522648474375352    2.0000
   31    4.4983576218189395806365222784885349    2.0000
   32    -3.178541128014607388049517611756574    2.0000
   33    1.5869949601010625479749898298366866    2.0000
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_44.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("IyBXaGF0IHNob3VsZCBJIGRvIHRvIG15IGNvZGUgdG8gZml4IHRoaXM/CnM9bmV3dG9uKGFyY3Rhbih4KSx4LDEuNDAsNTAwKTtz"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpXHN28U/___code___.py", line 3, in <module>
    exec compile(u's=newton(arctan(x),x,_sage_const_1p40 ,_sage_const_500 );s
  File "", line 1, in <module>
    
  File "/tmp/tmp9vznvI/___code___.py", line 50, in newton
    dt = -f(t)/diff(f,z)(t)
  File "element.pyx", line 1527, in sage.structure.element.RingElement.__div__ (sage/structure/element.c:11931)
  File "expression.pyx", line 2316, in sage.symbolic.expression.Expression._div_ (sage/symbolic/expression.cpp:11733)
ZeroDivisionError: Symbolic division by zero