On Convergence Rates of Root-Seeking Methods
|
03-11-2018, 12:53 PM
(This post was last modified: 03-11-2018 01:21 PM by Gerson W. Barbosa.)
Post: #30
|
|||
|
|||
RE: On Convergence Rates of Root-Seeking Methods
(03-09-2018 02:00 PM)emece67 Wrote: I've tested this 4th order Taylor with only 1 division. The results are a little disappointing. Decimal Basic is not the right tool for this test, but I did it anyway. It's limited to 1 thousand digits and the precision cannot be changed. Starting with a 16-digit approximation, the number of correct digits is quadrupled at each iteration. Thus, for 268.435.456 digits only 12 iterations would suffice ( log(268435456)/log(4) - 2 ). Ideally the precision should be set to 64 digits in the first iteration, then to 256 in the second iteration, then to 1024 in the third iteration and so on, but I cannot do it in Decimal Basic. OPTION ARITHMETIC DECIMAL_HIGH ! 1000 digits precision INPUT x LET r = EXP(LOG(x)/2) LET t = TIME PRINT r DO LET a = r LET b = r*r LET r = (b*(b*(b*(20*x - 5*b + 40) + (120 - 30*x)*x) + x*x*(20*x - 40)) + (8 - 5*x)*x*x*x)/(128*b*b*r) PRINT r LOOP UNTIL ABS(r - a) < 1E-256 PRINT SQR(x) - r PRINT TIME - t;" seconds" END ? 2 1.414213562373095 1.41421356237309504880168872420969807856967187537694807317667973798947912251558502278724354819580798680609385345527072973954631352847657992759491719132295975097 7851190546051993044944382000040210704403426034038634388091113054796694581356388229288359585276126491113757787998102600361450207381045186090436903909837008746643 1034702613985408231146309649208594275287150061823255779551086195957913504068468569392040023760526772118640227753720558095337126185503740848528003003220083571259 7876007466289414661614275577047779186467002751305547109932260519132008182471417158427394358697639180854278403008712404509644239238267271289740289167825812746163 0661480718134771108588125271691324904112941287270529120464653563566882946440308972859172411054988437943106627597053434432708976403774980364280296083588274483068 9032078903887093311671540119615505667625243776521965538988128178033349768645181823188802504726858350883437664116300306244902929112295963603771463834304635321134 83159222912044330867518715241960119192026 1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141 3222665927505592755799950501152782060571470109559971605970274534596862014728517418640889198609552329230483763417799908824040833757274424682543742882438438438070 4531006364272615236046110643974165998978164328319810701871101571764672134555595634138328395716863930924425632516611811108073845894133895402501220018056132779461 7819928435599821143715124157447066040849521403643466252060585684645815031693402475444690707768303296469996147472177954132880251268214102352564481045043373214707 3703801547018934883767816255384956590224751982474241571339154728018897573565000339167513251254677743584922032240364649937930685912128733124895129684082793457798 6071930775497360468100472461422145794096125895529313874025635406089188218667788735355852898088999919542662057387970464289475610337999433702645392165833753575717 67992903973693340385046714018520340468998 1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141 3222665927505592755799950501152782060571470109559971605970274534596862014728517418640889198609552329230484308714321450839762603627995251407989687253396546331808 8296406206152583523950547457502877599617298355752203375318570113543746034084988471603868999706990048150305440277903164542478230684929369186215805784631115966687 1301301561856898723723528850926486124949771542183342042856860601468247207714358548741556570696776537202264854470158588016207584749226572260020855844665214583988 9394437092659180031138824646815708263010059485870400318648034219489727829064104507263688131373985525611732204024509122770022694112757362728049573810896750401836 9868368450725799364729060762996941380475654823728997180326802474420629269124859052181004459842150591120249441341728531478105803603371077309182869314710171111683 91658172688941975871658215212822951848847 2.08969463386289156288276595230574797E-1000 0 seconds |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)