Post Reply 
HP42s first major program (Double Integral) Best way to approach?
06-02-2020, 04:02 PM
Post: #42
RE: HP42s first major program (Double Integral) Best way to approach?
(06-02-2020 08:23 AM)Werner Wrote:  Continuous improvement.. when I rewrite agm as ...

My version tried to avoid last sqrt(), but your version had last sqrt() evaluated.
You might as well return that instead of arithmetic mean.

function agm2(a, b)
local t = -1
local s1 = a*a
repeat
local s = s1
local k = (b-a)/2
t = t + t
b = sqrt(a*b)
a = a + k
s1 = s + t*k*k
until s == s1
return b, s1
end

(06-02-2020 08:31 AM)Werner Wrote:  Question: wouldn't the formula need to be

bore hole volume = hv(b,c) - hv(max(a,c),min(a,c))

so that it would work for a<c as well?

Same reasoning goes for b<c

A simple fix is to sort the hv arguments, such that hv(a,c) = hv(c,a)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP42s first major program (Double Integral) Best way to approach? - Albert Chan - 06-02-2020 04:02 PM



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