Post Reply 
On Convergence Rates of Root-Seeking Methods
03-08-2018, 10:43 PM (This post was last modified: 03-10-2018 03:59 AM by Gerson W. Barbosa.)
Post: #28
RE: On Convergence Rates of Root-Seeking Methods
(03-08-2018 08:00 PM)Dieter Wrote:  
(03-06-2018 02:53 AM)Gerson W. Barbosa Wrote:  Decimal Basic program and output:

OPTION ARITHMETIC DECIMAL_HIGH ! 1000 digits precision
LET t = TIME
INPUT x
...
PRINT TIME - t;" seconds"
END

I suggest you place the INPUT line first, i.e. before TIME is saved in t. ;-)

Previously I had x = 2 there. Then I simply replaced it with INPUT x to test the program with various arguments without having to edit it every time. That's what happens when you're in a hurry. 2.02 seconds seemed a bit excessive time to me just for computing the square root of 17 to 930+ places. The 0.02 seconds I get now is more like it :-)

(03-08-2018 08:00 PM)Dieter Wrote:  But tell me more about this Decimal Basic. Sounds very interesting.

It was used by Tom L. in another thread. Rexx has also been suggested, but that was easier to find and install. The latter appears to be much better, but I haven't tried it yet.

Decimal BASIC

Gerson.

------------------------------

PS:

0 seconds! (Ok, 0 seconds + something)

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 = (3*b*(b + 2*x) - x*x)/(8*b*r)
PRINT r
LOOP UNTIL ABS(r - a) < 1E-300
PRINT SQR(x) - r
PRINT TIME - t;" seconds"
END




? 17
4.1231056256176604
4.12310562561766054982140985597407702514719922537352...

...

4.123105625617660549821409855974077025147199225373620434398633573094954346337621​59358786365081068429668454404093921414161530142084041586836307954814574690697767​70232664362408630877905675723857082255213807325630838603091427498046719135293221​47978718167815796475906080565496973900766721383689212106708921029005520264976997​22778846139925992459137314565781925474362237723251578307340066247689146089499331​41024362794433862805526374750609050808692574826754037575769274646316663510330968​17122919874195864431971054705958485725931943603620656058152613585046428067872150​06410491422236752224348673725804703777127499856657121857043210030360260650648715​46906982815468464595645034418499305976395090786199590433342077830367324661050023​83305603648597891517738125149725101393295630516977396156134483704021469549517283​77477512833208677543247930196450385894596773652195702235648129282323237309165004​47557094601657217491431755474511227183616353174924756240651955600227559343988224​60451518623945769412122844523427764255913


...

0 seconds
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread



User(s) browsing this thread: 1 Guest(s)