Summation on HP 42S
|
09-26-2018, 03:13 PM
(This post was last modified: 09-27-2018 11:40 AM by Albert Chan.)
Post: #31
|
|||
|
|||
RE: Summation on HP 42S
(09-26-2018 10:10 AM)Frido Bohn Wrote: The result is (real HP42S) 4.02387322958 10^2567 for both codes. That is precise to the 5th decimal place. To increase precision (speed too!), do 1000! in "shells", 4 numbers at a time So, only 250 log10() calls instead of full 1000 I use my own fsum.lua code, to collect errors. Lua> p = require "fsum" () -- goal is log10(1000!) Lua> shell = function(x) return x * (x+1) * (1000-x) * (1001-x) end Lua> log10 = math.log10 Lua> for x = 1,500,2 do p:add(log10(shell(x))) end Lua> = p:total() 2567.6046442221327 Lua> p:add(-2567) Lua> = 10 ^ p:total() 4.023872600770903 BTW, straight sum of log10 of shells produce mantissa of 4.023872600761316 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)