Post Reply 
Prime and Saturn calculators
07-06-2024, 04:57 PM (This post was last modified: 07-07-2024 07:03 PM by Albert Chan.)
Post: #10
RE: Prime and Saturn calculators
(07-06-2024 08:27 AM)dm319 Wrote:  The Saturns all get the same result, which to me suggests the same algorithm, same starting values and stopping criteria, and same rounding behaviour in each iteration. The HP-12c is very similar which suggests to me it uses the same algorithm with less internal precision.

No, results are close because they are essentially correct.
You can only get algorithm "signature" if results are not correct.

Problem 4, starting with 0% rate, get payment M

>N=480 @ P=1E5 @ M=P/-N
>M
-208.333333333

M has error of -1/3 ULP, where ULP = 1E-9, back solve for rate will not get back 0%

error = exact - approx
approx = exact - error

C = n*pmt/-pv = n*(pv/-n - (ulp error)) / -pv = 1 - n*(ulp error) / -pv
C-1 = n*(ulp error) / pv

>C1 = N * 1E-9/-3 / P
>C1 ! tiny compounding effect
-1.6E-12

With tiny compounding effect, we can approximate C as linear.

C = i*n/(1-(1+i)^-n) = 1 + (n+1)/2*i + (n^2-1)/12*i^2 - (n^2-1)/24*i^3 + ...
C-1 ≈ (n+1)/2 * i

>I = C1 / ((n+1)/2)
>I * 1200 ! APR %
-7.98336798337E-12

Or, add quadratic effect, but without solving quadratics

C-1 ≈ (n+1)/2*i / (1 - (n-1)/6*i

>I = C1 / ((n+1)/2 + C1*(n-1)/6)
>I * 1200
-7.98336798337E-12

HP12C, 10 digits instead of 12, ULP size is 100 times bigger --> rate also 100 times bigger.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Prime and Saturn calculators - dm319 - 07-05-2024, 06:37 PM
RE: Prime and Saturn calculators - dm319 - 07-05-2024, 07:57 PM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 12:03 AM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 08:27 AM
RE: Prime and Saturn calculators - Albert Chan - 07-06-2024 04:57 PM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 02:29 PM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 05:31 PM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 06:22 PM
RE: Prime and Saturn calculators - dm319 - 07-07-2024, 10:11 AM
RE: Prime and Saturn calculators - dm319 - 07-07-2024, 08:24 PM



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