HP42s first major program (Double Integral) Best way to approach?
|
06-03-2020, 06:45 PM
(This post was last modified: 06-06-2020 11:30 AM by Albert Chan.)
Post: #50
|
|||
|
|||
RE: HP42s first major program (Double Integral) Best way to approach?
Hi, Werner
I made some improvements to BORE program ... Code: 00 { 176-Byte Prgm } First, I followed Mathematica EllipticE, EllipticK, using parameter m instead of modulus k, m = k^2 With this change, for ellipse_perimeter(10,50), a = 50, e^2 = 1-0.2^2 = 0.96 0.96 XEQ "EK" 200 × → 210.100445397 We can do the same calculation with a = 10, e^2 = 1-5^2 = -24 (previous version can do this too, but with imaginary e) -24 XEQ "EK" 40 × → 210.100445397 I noticed K(m) is relatively slow growing, when m approach 1. Example: K(m = 1 - 1e-85) ≈ 99 Instead of adding the rule HV(c,c) = 2/3*c^3, I do E(1)=1, K(1)=99 (see LBL 00) This kill 2 birds with 1 stone I also removed the menu, with "BORE" getting a,b,c, directly from the stack. To avoid catastrophic cancellation problems without knowing it, I leave HV values on the stack. 48 Enter 58 Enter 48 XEQ "BORE" → Y=94954.7588409, X=73728 − → I=21226.7588409 This allowed removal of HV label: Example, for HV(29,12) 29 Enter 12 Enter XEQ "BORE" → 3208.03490414 I also removed the assumption SIGN giving 1, and add 1 explicitly. This allowed the code to run correctly with complex numbers. 3 XEQ "EK" → E ≈ 0.47522 + 1.0130j, K ≈ 1.0011 - 1.1714j -1 SQRT XEQ "EK" → E ≈ 1.6324 - 0.36922j, K ≈ 1.4213 + 0.29538j There is still an issue of AGM convergence. For complex numbers, AGM might not converge *exactly*. For example, on Free42, 2 XEQ "EK" crash with "Out-of-Range" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)