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 Same reasoning goes for b<c A simple fix is to sort the hv arguments, such that hv(a,c) = hv(c,a) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 11 Guest(s)