Post Reply 
(11C) TVM for HP-11C
12-05-2020, 01:05 AM
Post: #11
RE: (11C) TVM for HP-11C
From thread: Fun math algorithms:
(10-19-2020 11:05 PM)Albert Chan Wrote:  We can use \(C_±\) to solve Time value of money problem, if I is small, and N not too big.

XCas> C(d) := 1 + N*I*(N*I+d*6)/12 + I/2;       // compounding factor, d is direction
XCas> eqn := C(1)*PV + C(-1)*FV + N*PMT;       // variables follow cash flow sign convention

XCas> factor(symb2poly(eqn,I)); // quadratic coefficients, for I

[N^2*(FV+PV)/12 , (-FV*N+N*PV+FV+PV)/2 , N*PMT+FV+PV]

Divide coefficiens by (FV+PV):

[N^2/12 , (1 - N*(FV-PV)/(FV+PV))/2, PMT*N/(FV+PV) + 1]

Solving the quadratic, for the "small" root of I, we have:
Code:
function guess_i(n, pv, pmt, fv)    -- cash-flow sign convention
    local c = n/(fv+pv)
    local b = 4/((fv-pv)*c-1)
    c = (pmt*c+1)*b                 -- I coef = [b*n*n/12, -2, c]
    return c / (1+sqrt(1-c*b*n*n/12))   
end

(12-03-2020 08:53 PM)Albert Chan Wrote:  lua> g = pv_i(12, 5000/500) -- guess_i = 0.030555555555555558
lua> g(), g(), g()
0.02922075497755343        0.02922854050171087       0.029228540769134212

lua> g = fv_i(12, 5000/400) -- guess_i = 0.00749063670411985
lua> g(), g(), g()
0.007390656157378769      0.007390622804155507      0.007390622804147247

For above examples, guess_i() gives about 3 good digits.

lua> guess_i(12, 5000, -500, 0)
0.02919560045657818
lua> guess_i(12, 0, -400, 5000)
0.007391943630478942
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) TVM for HP-11C - Gamo - 05-09-2019, 01:15 AM
RE: (11C) TVM for HP-11C - Gamo - 12-03-2019, 10:12 AM
RE: (11C) TVM for HP-11C - Gamo - 02-13-2020, 06:14 AM
RE: (11C) TVM for HP-11C - bshoring - 12-02-2020, 09:02 PM
RE: (11C) TVM for HP-11C - Gamo - 12-03-2020, 08:23 AM
RE: (11C) TVM for HP-11C - Dave Britten - 12-03-2020, 01:48 PM
RE: (11C) TVM for HP-11C - bshoring - 12-03-2020, 05:53 PM
RE: (11C) TVM for HP-11C - Dave Britten - 12-03-2020, 06:08 PM
RE: (11C) TVM for HP-11C - Albert Chan - 12-03-2020, 08:53 PM
RE: (11C) TVM for HP-11C - Albert Chan - 12-04-2020, 08:01 PM
RE: (11C) TVM for HP-11C - Albert Chan - 12-05-2020 01:05 AM
RE: (11C) TVM for HP-11C - Albert Chan - 12-05-2020, 03:46 AM
RE: (11C) TVM for HP-11C - Albert Chan - 05-10-2022, 09:35 PM
RE: (11C) TVM for HP-11C - Albert Chan - 05-11-2022, 01:07 PM
RE: (11C) TVM for HP-11C - Albert Chan - 12-06-2020, 02:32 PM
RE: (11C) TVM for HP-11C - Albert Chan - 12-06-2020, 04:41 PM
RE: (11C) TVM for HP-11C - Albert Chan - 12-07-2020, 06:55 PM
RE: (11C) TVM for HP-11C - Albert Chan - 12-08-2020, 03:05 PM
RE: (11C) TVM for HP-11C - Albert Chan - 05-14-2022, 12:26 PM



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