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: 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.123105625617660549821409855974077025147199225373620434398633573094954346337621593587863650810684296684544040939214141615301420840415868363079548145746906977677023266436240863087790567572385708225521380732563083860309142749804671913529322147978718167815796475906080565496973900766721383689212106708921029005520264976997227788461399259924591373145657819254743622377232515783073400662476891460894993314102436279443386280552637475060905080869257482675403757576927464631666351033096817122919874195864431971054705958485725931943603620656058152613585046428067872150064104914222367522243486737258047037771274998566571218570432100303602606506487154690698281546846459564503441849930597639509078619959043334207783036732466105002383305603648597891517738125149725101393295630516977396156134483704021469549517283774775128332086775432479301964503858945967736521957022356481292823232373091650044755709460165721749143175547451122718361635317492475624065195560022755934398822460451518623945769412122844523427764255913 ... 0 seconds |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)