HP42s first major program (Double Integral) Best way to approach?
|
06-08-2020, 12:11 AM
(This post was last modified: 06-23-2020 12:20 PM by Albert Chan.)
Post: #55
|
|||
|
|||
RE: HP42s first major program (Double Integral) Best way to approach?
This version uses my implementation of EKmc(m) = E(m) - c, K(m) - c, where c = Pi/2
I added HV(d,D) on top of EKmc(m) to test its accuracy. HV(d, D) = D/3 (d^2 (E+K) + D^2 (E-K)) = D/3 (d^2 ((E-c)+(K-c) + Pi) + D^2 ((E-c)-(K-c))) Note: this is a recursive algorithm, requiring Free42 LSTO command. Code: 00 { 167-Byte Prgm } Let's try HV(1,1000): HV(1,1000) = 785.3980652226656130844841050849260, error = -2 ULP BORE = 785.3980652226656130844841051786603, error = -937345 ULP Mathemtaica: 785.3980652226656130844841050849257781988463583655713086050... * Mathematica: HV = Pi/4 d^2 D Hypergeometric2F1[-1/2,1/2,2,(d/D)^2] /. {d->1, D->1000} Update: HV now has same functionality of BORE, and better accuracy. Formula changed to avoid subtraction cancellation, when m = (d/D)² ≈ 1 HV(d, D) = D/3*((dd+DD)*(e-c) + (dd-DD)*(k-c) + dd*(2c)) → HV1(m) = 1/3*((m+1)*(e-c) + (m-1)*(k-c) + m*pi) First 2 terms both negative, with -sum less than 1/2 of the third. We know this because 2/3 ≤ HV1/m ≤ pi/4, and (third term)/m = pi/3 → (third term)/HV1 = [4/3, pi/2] ≈ [1.3333, 1.5708] → -(sum of first 2 terms)/(third term) ≈ [0.25000, 0.36338] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 10 Guest(s)