Saturday, December 21, 2024

TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts  


Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your own.



Introduction


The program CONSOL consolidates a number of debts into a single loan, typically of a lower interest rate than the rate paid of the original debts. The loan can include additional cash and fees charged.



TI-84 Plus CE Program: CONSOL


Notes:


The percent sign is comprised of three symbols: a degree sign ( [ 2nd ], [ apps ] (angle), 1, °), the division slash, and a decimal point. The percent symbol will look something like this: ° / .


All fees are assumed to be financed. At the fees question, if you enter an amount less than 100, it will be treated as a percent of the desired cash out. If you enter an amount 100 or above, it will be treated as an amount. For no fees, enter 0.


Monthly payments at the end of the month are assumed.


The cash sign convention is used. If the interest difference is positive, you are saving interest costs. If the interest difference is negative, you have an additional interest cost.


The list of original debts are stored to list L₄.

The list of associated rates are stored to list L₅.

The list of associated number of payments renaming to list L₆.


The payment function, tvm_Pmt is from the Finance app ( [ apps ], 1. Finance…, 2: tvm_Pmt). Syntax: tvm_Pmt( number of payments, annual interest rate, present value, future value, payments per year, compound periods per year).


Code (520 bytes):


ClrHome

Disp “CONSOLIDATED ANALYSIS”

Input “LIST OF DEBTS? “, L₄

Input “LIST OF RATES (°/.)? “, L₅

Input “LIST OF PMTS REMAINING? “, L₆

If dim(L₄)≠dim(L₅) or dim(L₅)≠dim(L₆) or dim(L₄)≠dim(L₆)

Then

Disp “LISTS NOT EQUAL SIZE”

Stop

End

0 → J

For(I, 1, dim(L₄))

L₆(I) * tvm_Pmt(L₆(I), L₅(I), L₄(I), 0, 12, 12) + L₄(I) + J → J

End

sum(L₄) → D

Disp “CONSOLIDATED DEBT:”, D

Input “DESIRED AMOUNT? “, C

Disp “FEES AND COSTS”, “<100 (°/.), ≥100 (AMT)”

Prompt F

If F<100

Then

C*(1+F/100) → F

Else

C+F → F

End

Input “NEW RATE (°/.)? “, R

Input “NO. OF PMTS? “, N

tvm_Pmt(N,R,F,0,12,12) → p

N*P+F → K

Disp “CASH OUT: “, C-D

Disp “NEW PMT: “, P

Disp “INTEREST DIFF: “,”(>0 SAVINGS)”, K-J



Examples


Example 1: A Simple Consolidation


Consolidate two debts, take no cash out, no fees.


Original Debt

Interest Rate

Number of Payments Left

48000

8%

240

17500

19.99%

24





Desired Amount: 65500. No fees. New rate: 6%. Term: 240 months


Result:

Cash Out: 0

New Pmt: -469.2623433 (469.26)

Interest Diff: 5109.118945 (save 5109.12)


Example 2: Consolidate Three Debts: 3% fees or a flat 600 fee.


Original Debt

Interest Rate

Number of Payments Left

36500

12.99%

180

6800

8%

80

1800

20.99%

12


Desired Amount: 52000. New Rate: 7.25%. Term: 240 months


Result with 3% fees:

Cash Out: 6900

New Pmt: -423.3253775 (-423.33)

Interest Diff: 752.12157 (752.12)


Result with 600 flat fee:

Cash Out: 6900

New Pmt: -415.7377681 (415.74)

Interest Diff: 1613.147839 (1613.15)


Example 3: Not every scenario will have interest savings.


Original Debt

Interest Rate

Number of Payments Left

40000

13%

90

4000

20.99%

12

1800

9.95%

12


Desired Amount: 50000. New Rate: 7%. Term: 180 months. Fees: 3%


Result with 3% fees:

Cash Out: 4200

New Pmt: -462.8965595 (462.90)

Interest Diff: -8434.001105 (-8434.00)


Download the file here: https://drive.google.com/file/d/171aj-kTKH0-YZCyeMDHZMxqpGERaaAhd/view?usp=sharing



Happy Holidays! Take care and be well,


Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Saturday, December 14, 2024

RPN with HP 15C & DM32: Swapping Items in the Stack

RPN with HP 15C & DM32: Swapping Items in the Stack



A New Series


Welcome to a new series: RPN with the HP 15C & DM32. The DM32 is the Swiss Micros updated calculator of the popular model HP 32SII. The intended schedule for this series is the second Saturday starting now until at least December 13, 2025.



Product Information:


Hewlett Packard HP 15C Collector’s Edition: https://www.thecalculatorstore.com/p/hp15c-collector-s-edition-2


Swiss Micros DM15L: https://www.swissmicros.com/product/dm15l


Hewlett Packard HP 32SII (original, late 1980s-1990s, video by Logan West): https://www.youtube.com/watch?v=g4eP5ckeo9g


Swiss Micros DM32: https://www.swissmicros.com/product/model-dm32


There here plenty of emulators for the HP 15C for the smartphone, both Android and Apple iPhone iOS.



Swapping the Stack’s Elements


Our first installment of the series deals with swapping elements of the stack. Like most RPN calculators, the HP 15C and DM32 have four stack levels.


T

Z

Y

X


The stack contains four values. On the HP 15C, the stack can also contain complex numbers and matrices.


On most RPN calculators, the stack is a Rolodex of four values. The can be scrolled up (R↑) and down (R↓). The contents of the x and y stack values can be swapped by the swap key (x<>y). On RPN calculators that show one line, like the HP 15C, the value that is shown is the X stack. Some RPN calculators, such as the DM32, show all four stack levels (X, Y, Z, and T).


The following keystrokes the values on two stack levels using the stack operations R↑, R↓, and x<>y. They are multiple algorithms to accomplish each task, I will present one for each.


For illustration purposes, an example stack always starts out as:

T: 40

Z: 30

Y: 20

X: 10


You don’t need to key in these numbers, this is for illustration purposes.

Swap X and Y: x<>y

Result:

T: 40

Z: 30

Y: 10

X: 20


Swap X and Z: x<>y, R↓, R↓, x<>y, R↓

Result:

T: 40

Z: 10

Y: 20

X: 30


Swap X and T: R↑, x<>y, R↓

Result:

T: 10

Z: 30

Y: 20

X: 40


Swap Y and Z: R↓, x<>y, R↑

Result:

T: 40

Z: 20

Y: 30

X: 10


Swap Y and T: R↓, x<>y, R↓, R↓, x<>y

Result:

T: 20

Z: 30

Y: 40

X: 10


Swap Z and T: R↓, R↓, x<>y, R↓, R↓

Result:

T: 30

Z: 40

Y: 20

X: 10


An excellent resource to use is Better Program on the HP-67/97, a PPC Publication, edited by William Kolb, John Kennedy, and Richard Nelson (1978). https://www.cuveesoft.ch/rpn67/img/HP67%20Better%20Programming%20PPC.pdf



Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Saturday, December 7, 2024

Casio fx-CG50 and TI-84 Plus CE: Multiple Linear Regression

Casio fx-CG50 and TI-84 Plus CE: Multiple Linear Regression


We have arrived at the last month of 2024. What a crazy year. I hope for smoother and peaceful times ahead.



Introduction


The program MLREG fits bi-variate data to the linear regression equation:


y = b0 + b1 * t + b2 * x


where t and x are the independent variables, and y is the dependent variable. The program uses a numerical method known as normal equations, to solve the system:


n * b0 + Σ(t) * b1 + Σ(x) * b2 = Σ(y)

Σ(t) * b0 + Σ(t^2) * b1 + Σ(t*x) * b2 = Σ(t*y)

Σ(x) * b0 + Σ(t*x) * b1 + Σ(x^2) * b2 = Σ(x*y)


or in matrix form:


[ [ n ,Σ(t), Σ(x) ] [ Σ(t), Σ(t^2), Σ(t*x) ] [ Σ(x), Σ(t*x), Σ(x^2) ] ] * [ [ b0 ] [ b1 ] [ b2 ] ]

= [ [ Σ(y) ] [ Σ(t*y) ] [ Σ(x*y) ] ]


where:

n is the number of data points,

Σ(t) is the sum of all t data,

Σ(x) is the sum of all x data,

Σ(y) is the sum of all y data,

x * t, t * y, x * y, t^2, x^2 are all represent of the variable element-by-element multiplication of each set


The calculator programs assign the following variables:

n * b0 + Σ(t) * b1 + Σ(x) * b2 = Σ(y)

Σ(t) * b0 + Σ(t^2) * b1 + Σ(t*x) * b2 = Σ(t*y)

Σ(x) * b0 + Σ(t*x) * b1 + Σ(x^2) * b2 = Σ(x*y)


A = n

B = Σ(t)

C = Σ(x)

D = Σ(t^2)

E = Σ(t*x)

F = Σ(x^2)

X = Σ(y)

Y = Σ(t*y)

Z = Σ(x*y)




Casio fx-CG 50 Program: MLREG


This is programmed in Casio Basic.


“Y=B0+B1×T+B2×X”

“T LIST”? → List 4

“X LIST”? → List 5

“Z LIST”? → List 6

If Dim List 4 ≠ Dim List 5 Or Dim List 5 ≠ Dim List 6 Or Dim List 4 ≠ Dim List 6

Then

“LISTS NOT SAME LENGTH” ◢

Stop

IfEnd

Dim List 4 → A

Sum List 4 → B

Sum List 5 → C

Sum (List 4²) → D

Sum (List 4 × List 5) → E

Sum (List 5²) → F

Sum List 6 → X

Sum (List 6 × List 4) → Y

Sum (List 6 × List 5) → Z

“B0,B1,B2=” ◢

[ [A, B, C ][B, D, E][C, E, F] ] ⁻¹ × [ [ X ][ Y ][ Z ] ] → Mat Z



TI-84 Plus CE Program: MLREG


ClrHome

Disp “Y=B0+B1*T+B2*X”

Input “T LIST: “, L₄

Input “X LIST: “, L₅

Input “Y LIST: “, L₆

If dim(L₄) ≠ dim(L₅) or dim(L₅) ≠ dim(L₆) or dim(L₄) ≠ dim(L₆)

Then

Disp “LISTS NOT EQUAL SIZE”

Stop

End

dim(L₄) → A

sum(L₄) → B

sum(L₅) → C

sum(L₄ ²) → D

sum(L₄ * L₅) → E

sum(L₅ ²) → F

sum(L₆) → X

sum(L₆ * L₄) → Y

sum(L₆ * L₅) → Z

[ [ A, B, C ] [ B, D, E ] [ C, E, F ] ] ⁻¹ * [ [ X ] [ Y ] [ Z ] ] → [ J ]

Disp “B0,B1,B2= “, [ J ]


Note: [ J ] is matrix J is called form the Matrix menu.



An Online Multiple Linear Regression Calculator


A multiple linear regression calculator which determine coefficients, quadrants, and other statistics can be found on the stats.blue web page: https://stats.blue/Stats_Suite/multiple_linear_regression_calculator.html


Examples


Example 1


t

x

y

1.12

22.3

100

1.16

22.1

104

1.19

21.8

107

1.23

21.4

110

1.28

21.1

114


Result:

B0 = -48.8333333

B1 = 99.99999999 (TI-84 Plus CE rounds this to 100)

B2 = 1.666666666


Equation:

y = -48.8333333 + 99.99999999 * t + 1.666666666 * x



Example 2


t

x

y

10.2

1.95

1000

10.5

3.00

1002

10.8

4.00

1005

11.1

4.95

1007

11.6

5.80

1009

11.8

6.75

1012

12.1

7.80

1015


Result:

B0 = 1008.157502

B1 = -1.429759754

B2 = 3.052897088


y = 1008.157502 – 1.429759754 * t + 3.052897088 * x


Until next time, when a new series will be introduced. Stay tuned,



Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...