Showing posts with label percent change. Show all posts
Showing posts with label percent change. Show all posts

Saturday, August 29, 2026

The MU Key on a Four Function Calculator and Programs for the DM42/HP 42S

 The MU Key on a Four Function Calculator and Programs for the DM42/HP 42S


Not too long ago, I purchased this very colorful, four function calculator from the University I work at, the Dexin BST DX-818.





The DX-818 is powered by a solar panel with an option to be run by an AAA battery when using the calculator in less than bright light conditions. The AAA battery is optional.



A Standard Calculator



This calculator is the standard four function key calculator, complete with the square root function, percent function, the standard three memory keys (M+, M-, and MRC), and a grand total (GT) key. A grand total is started when calculations are completed by pressing the equals key [ = ]. The grand total is both recalled and cleared when the [ GT ] is pressed.



The Markup Equation



Before we head to the calculators, the mark up is a calculation of between selling price (new), cost (old), and mark up. The markup is ratio between the selling price and cost over cost and as expressed as a percentage (%):



MU = (selling price – cost) ÷ cost = (selling price ÷ cost - 1)



Solving for the other variables yield:

selling price = cost * (1 + MU)

cost = selling price ÷ (1 + MU)

In these equations, MU is expressed as a decimal.



If let the selling price be the new value and cost be the old value, then we have the equation for percent change (Δ%):

Δ% = (new – old) ÷ old = (new ÷ old - 1)

Similarly:

new = old * (1 + Δ%)

old = new ÷ (1 + Δ%)

In these equations, Δ% is expressed as a decimal.



The Markup Key (MU)



On this particular calculator, there is an [ MU ] key. This is the markup key. Apparently, there are two types of [ MU ] key, one set of syntax for Casio calculators with the [ MU ] key. An example of a Casio calculator with an [ MU ] key is the MJ-120D plus. They way Casio calculators use the [ MU ] key is a calculation:



cost [ MU ] markup percentage [ % ] returns selling price.

Immediately pressing [ = ] returns selling price – cost.



However, some calculators, like the colorful calculator featured (I really wish I knew the model number) with the [ MU ] have another syntax, and that is what I will address from here on out.





On this particular calculator, the syntax, using one of the four arithmetic functions is:


y < +, -, ×, or ÷ > x [ MU ]


No use of the equals key is needed, unless you want to add the result to the grand total.



The four calculations with the [ MU ] key, on this particular calculator (and possibly the NewYes calculators from China) are:



Key Sequence

Formula Used

Notes

Y [ + ] X [ MU ]

100 * (Y ÷ X + 1)


Y [ - ] X [ MU ]

100 * (Y ÷ X - 1)

Calculates markup or percent change (Δ%).

Y = selling price, new value

X = cost, old value

Y [ × ] X [ MU ]

Y * (1 + X ÷ 100)

Adds X% to Y. Calculates the new value (selling price) given old value (cost) (Y) and markup (X).

Y [ ÷ ] X [ MU ]

Y ÷ (1 – X ÷ 100)

Finds the original retail price given selling price (Y) and discount rate (X). This can also be used for gross-up calculations.



Sample Calculations



Problem

Keystrokes

Result

Determine 100 * (Y ÷ X + 1) with Y = 420, X = 25

420 [ + ] 25 [ MU ]

1780

An item that cost the company $14.75 sells for $19.99. Find the markup.

19.99 [ - ] 14.75 [ MU ]

35.5254237288

(≈35.53%)

A company manufactures a product with a unit cost of $32.84 and wants a 20% markup. What is the selling price?

32.84 [ × ] 20 [ MU ]

39.408

(about $39.41)

A product is currently on sale for $39.99. If the discount is 35%, what is the original retail price.

39.99 [ ÷ ] 35 [ MU ]

61.523076923

(about $61.52)




RPN Programming with the Swiss Micros DM42



Here are four RPN programs, which are were programmed using a Swiss Micros DM42, which can be used on the HP 42S (and probably the HP 41C).



Program MU+: Y [ + ] X [ MU ]

00 {17-Byte Prgm}

01 LBL “MU+”
02 ÷

03 1

04 +

05 100

06 ×

07 RTN

08 END



Program MU-: Y [ - ] X [ MU ]

00 {17-Byte Prgm}

01 LBL “MU-”
02 ÷

03 1

04 -

05 100

06 ×

07 RTN

08 END



Program MUMLT: Y [ × ] X [ MU ]

00 {12-Byte Prgm}

01 LBL “MUMLT”
02 %

03 +

04 RTN

05 END



Program MUDIV: Y [ ÷ ] X [ MU ]

00 {21-Byte Prgm}

01 LBL “MUDIV”
02 ENTER

03 100

04 ÷

05 1

06 X<>Y

07 -

08 ÷

09 RTN

10 END



Sources


 Casio. “MJ-120D Plus” https://www.casio.com/intl/basic-calculators/product.MJ-120DPLUS/ Accessed May 23, 2026.


Eaton, Glenn. “The Calculator MU Key” Eaton Family Website. Posted on June 30, 2017. https://eatonfamily.au/calculator-mu-key/ Accessed May 23, 2026.


“How to use the MU button on a calculator? #1” YouTube Short: @newyes1162. Posted December 5, 2022. https://www.youtube.com/shorts/OiS8yFKKJSU Accessed May 23, 2026


Eddie


All original content copyright, © 2011-2026. 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.


Sunday, December 24, 2023

TI-73 (Explorer): Percents and Random Fractions

TI-73 (Explorer):  Percents and Random Fractions



TI-73 Program:  PERCENT





TAX+:  Appropriately add a percent to a number.   Application:  Sales Tax


TAX-:   Appropriately subtract a percent from a number.  Application:  Discount


% CHANGE:  Percent change from the old number to new number.  Additional application:  Percent Markup (OLD = cost, NEW = selling price)


%TOT:  Finds the percentage portion of a total number


% MARGIN:  Given an item's cost and selling price, calculate the item's percent margin.  



Code:

(spaces added for clarity)


"EWS 2023-12-02"     // (comment)


Lbl 0

Menu("PERCENT","TAX+",1,"TAX-",2,

"% CHANGE",3,"%TOT",4,"% MARGIN",5,

"EXIT",E)


Lbl 1

Prompt N

Input "X% ",X

N*(1+X%)→Y

Disp "ANSWER="

Pause Y

Goto 0


Lbl 2

Prompt N

Input "X% ",X

N*(1-X%)→Y

Disp "ANSWER="

Pause Y

Goto 0


Lbl 3

Input "OLD=",O

Input "NEW=",N

(N-O)*100/O→Y

Disp "% CHANGE="

Pause Y

Goto 0


Lbl 4

Input "PART=",P

Input "WHOLE=",W

100*P/W→Y

Disp "%"

Pause Y

Goto 0


Lbl 5

Input "COST=",C

Input "SELL PRICE=",S

(S-C)/S*100→Y

Disp "% MARGIN="

Pause Y

Goto 0


Lbl E

Disp "BYE"

Pause



Note:   Results that are to be displayed need to be followed or accompanied by a Pause command, unless the results will not show.  This wrinkle is unique to the TI-73.  

Link to download PERCENT.73p



TI-73  Program:  RANDFRAC




Generate a number of fractions with randomized numerators and denominators.  


T = number of fractions to be generator

L = upper limit that the numerator and denominator can take.  The numbers range from 1 to L


The result is returned in three parts:


numerator

denominator

fraction


For example:


5

7

5/7


Simplification rules are set through the MODE key.  


Code:

(spaces added for clarity)


"EWS 2023-12-02"     // (comment)


Disp "NO. FRACTIONS"

Prompt T

Disp "UPPER LIMIT"

Prompt L


For(I,1,T)

randInt(1,L)→N

randInt(1,L)→D

N ⁄ D→F     // N [ b/c ] D [ STO> ] F

Disp N,D,F

Pause

End


Note:  The fraction symbol pressed by [ b/c ], symbolized by  ⁄, shows on the screen as a thick division slash.   


Link to download RANDFRAC.73p


For those of you who are celebrating, Merry Christmas!


Eddie


All original content copyright, © 2011-2023.  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. 


Sunday, May 15, 2022

Python: Financial Functions (2nd Edition)

Python:  Financial Functions (2nd Edition)


This is an update to the python file, which I first released on May 17, 2020:


https://edspi31415.blogspot.com/2020/05/numworkscasio-micropythonpython.html


I am able to transfer and test the python file to a Numworks calculator through the online editor, and TI-84 Plus CE Python through the TI Connect CE.  Because only the math module is used, the python file can be run in most, if not all calculators with Python, as well as Python 3.  


What is included?


*  time value of money calculations

*  net present value and internal rate of return

*  net present value (xnpv) and internal rate of return (xirr) when periods between flows are not consistent, a 365 day-year is assumed

*  simple interest:  calculating interest, total, and solving for principal

*  profit calculations: cost-sell-markup

*  adding sales tax

*  percent change

*  present and future value uniform stream factors

*  compound interest calculations of a single stream:  solve for present value, future value, number of periods, and periodic interest

*  days between dates

*  specific applications:  monthly payment, PITI, qualifying loan amount, sinking fund, expressing a list of amounts as a percent of the sum, prorating an amount among a list of flows


Download the Python file and the instructions (pdf file) here:

https://drive.google.com/file/d/1l7Xg9dM-RHfekKkU7A1Wjay76-yVc56S/view?usp=sharing


Size: about 3,800 bytes.  


Eddie


All original content copyright, © 2011-2020.  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. 


Sunday, June 27, 2021

Review: Victor 6500 Loan Calculator, HP 48G Retro Month

Review:  Victor 6500 Loan Calculator, HP 48G Retro Month


Victor 6500 Review






Quick Facts

Company:  Victor
Year Introduced:  about 2010, still in production
Battery:  Solar and 1 AA battery
Digits: 12
Memory Registers:  2: Independent (M) and Grand Total (GM)
Cost: About $20.00 to $25.00 US


It is rare that a desktop calculator features advanced financial or scientific functions, and that is what attracted me to the Victor 6500.  The keys respond quickly which allows for fast typing.   The display has room for 12 large digits which makes reading the display easy.

Features

*  Fix Display Switch: Float, 0, 2, 4, Add Mode
*  Round Setting Switch:  cut (always round results down), 5/4 (regular rounding rules are followed), up (always round up)
*  Time Value of Money - will be discussed next
*  %, Δ%, √
*  Tax Rate:  setting, TAX+, TAX-
*  Double Zero Key

Memory Registers

There are two memory registers:

Independent Memory (M).  This the traditional memory register that comes with most desktop calculators.  Included are M+ and M-.  Recall and clear are combined in one key RCM.

Grand Total (GT).  The grand total memory is activated every time the equals key is pressed.   

Time Value of Money

The Victor 6500 have four finance keys:

Loan = PV
Pmt = Payment
Years = number of years = n * PYR
Int = annual interest rate

The cash flow convention (inflow/outflow) is not followed, all results are positive.  The number of payments per year is set through the P/Y setting.  

What is missing is the FV (future value) key, which leaves out some of the finance problems involving calculating balance or balloon payment.   However, we can still do a lot of calculations on the Victor 6500 fairly easier.  Here are several example calculations.  In these examples, the Victor 6500 is set to 2 Decimal Places with 5/4 rounding mode.

Example 1:  Calculating Payment of a Loan
Loan:  345,000.00
Years: 30
Interest Rate:  3.3%

[ ON/C ] [ ON/C ]
345000 [ Loan ]
30 [ Years ] 
3.3 [ Int ]
[ Pmt ]  returns 1,510.95

Example 2:  Calculating Payment of a Loan with a Down Payment
Loan:  260,000.00 with 15% down
Years: 27
Interest Rate:  3.2%

[ ON/C ] [ ON/C ]
260000 [ - ] 15 [ % ] [ Loan ]
27 [ Years ] 
3.2 [ Int ]
[ Pmt ]  returns 1,019.53

Example 3:  PITI (Payment with Principal Interest Taxes Insurance)
Loan: 300,000.00
Years: 30
Interest Rate: 3.25%
Annual Property Tax: 2,121.00
Annual Property Insurance: 541.00

[ ON/C ] [ ON/C ] [ MRC ] [ MRC ]
300000 [ Loan ]
30 [ Years ]
3.25 [ Int ] 
[ Pmt ] [ M+ ]

2121 [ + ] 541 [ = ] [ ÷ ] 12 [ = ] [ M+ ]
[ MRC ] (once)  
PITI:  1527.45

Verdict

I like the Victor 6500 since it offers a time value of money solver on a desktop calculator form.  I wish Victor would have included the future value variable.   The keys are fast and responsive.  The keyboard is pretty light but also feel stable.  

I am working on posting additional examples for the Victor 6500 in the near future.  

HP 48G Retro Month - July 2021


For the month of July 2021, every Saturday from July 10 to July 31 will have a post on the legendary HP 48G/48GX/48G+ calculator.  


Next post will be on July 10, 2021 (taking the Fourth of July weekend off).   Have a great day and thank you!  

Eddie 

All original content copyright, © 2011-2021.  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, March 6, 2021

Fun with the TI-73 Part I: Logarithmic Regression, Percent, Square Root Simplification

 Fun with the TI-73 Part I: Logarithmic Regression, Percent, Square Root Simplification


TI-73 Program:  LNREG - Logarithmic Regression


Introduction:


The program LNREG fits the data to the equation:


y = a * ln x + b


The lists used are:

L_1:  x list  

L_2:  y list


Access L_1 by pressing [ 2nd ] [ STAT ] (LIST), 1.

Access L_2 by pressing [ 2nd ] [ STAT ] (LIST), 2


You can edit lists by pressing [LIST].  


The lower case a and b are from the VARS, Statistics, EQ menu.


Program:


"EWS 2021"

Disp "FIT Y=A LN X +B","USES X=L1,Y=L2:

ln(L_1) → L_1

LinReg(ax+b) L_1,L_2

a → A

b → B

Output(4,1,"A=")

Output(4,5,A)

Output(5,1,"B=")

Output(5,5,B)

Output(6,5,r²)

e^(L_1) → L_1

Pause

Menu("PLOT?","YES",1,"NO",2)

Lbl 1

PlotsOff

FnOff

"A*ln(X)+B"→Y_1

Plot1(xyLine,L_1,L_2,□)

ZoomStat

Lbl 2


Example:


X:  L_1 = {1, 2, 3, 4, 5, 6}

Y:  L_2 = {-1.26, 2.1018, 4.0683, 5.4635, 6.5458, 7.43}


Results:

y = A ln x + B

A = -1.259978557

B = 4.849985251

r^2 ≈ 1


TI-73 Program: PERCENT - Percent Calculations


Introduction:


The program gives the users four options:


1.  Adding tax (plus percent)

2.  Subtracting tax (minus percent)

3.  Percent Change

4.  Percent Total


The percent key divides the amount by 100.  Example:  5% turns to 0.052.


Program:


"EWS 2021"

Menu("PERCENT","TAX+",1,"TAX-",2,"%CHG",3,"%TOT",4)

Lbl 1

Prompt N

Input "X% ",X

N*(1+X%)→Y

Pause Y

Stop

Lbl 2

Prompt N

Input "X% ",X

N*(1-X%)→Y

Pause Y

Stop

Lbl 3

Input "OLD=",O

Input "NEW=",N

(N-O)*100/O→Y

Pause Y

Stop

Lbl 4

Input "PART=",P

Input "WHOLE=",W

100*P/W→Y

Pause Y

Stop


Example:


TAX+:   Add 15% to 19.95

N: 19.95, X%:  15

Result:  22.9425


TAX-:  Subtract 15% from 19.95

N:  19.95, X%:  15

Result:  16.9575


%CHG:  Old (O):  11700, New (N):  15420

Result:  31.79487179


%TOT:  Part (P):  11700, Whole (W):  15420

Result:  75.7548638


TI-73 Program: SQROOT - Simplification Square Root


This program tries to factor √N to A√B.  N, A, and B are integers.


Program:


"EWS 2021"

Disp "√(N)->A√(B)"

Prompt N

iPart(√(N))→X

While X≠0

If fPart(N/X^2)=0

Then

X→A

N/X^2→B

Goto 1

Else

X-1→X

End

End

Lbl 1

Disp "A=",A,"B=",B

Pause


Examples:


N = 88;   √88 = 2√22


N = 1225;  √1225 = 35√1


Notes:


*  There is no ALPHA key for the TI-73 (family).   Text is entered by use of the [ 2nd ] [ MATH ] (TEXT) key sequence.  Letters are selected by using the arrow keys and selecting them with the ENTER key.


*  The underscore character ( _ ) acts like a space.


*  The TEXT has the letters A-Z, _, <, =, >, ≤, ≠, ≥, and the logic functions and, or.  For the question mark character, ?, press [ 2nd ] [ PRGM ] (CATALOG) [ ↑ ] [ ENTER ]. 


* The programming language of the TI-73 is the robust as the TI-83 family (TI-83, TI-83 Plus, TI-84 Plus family, TI-82).  


* The main difference is that results are shown on a separate screen for output.   When a program terminates, the TI-73 returns to the Home screen.  It is necessary to include a Pause at the end to keep the results on the screen.


Stay tuned tomorrow for more programs for the TI-73.  


Eddie


All original content copyright, © 2011-2021.  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, November 14, 2020

HP Prime: The Percent Function

 HP Prime:  The Percent Function


The Percent Function



The HP Prime has three percent functions.   They are not easily found (through the catalog or in program edit mode, Cmds-More menu).  The functions are:


%

%CHANGE

%TOTAL


% Function


%(x, y)  returns x * y /100.  This returns either x% of y or y% of x.  Due to the communicative multiplication property, you can use the arguments in either order.  


%CHANGE


This the percent change function where the arguments are %CHANGE(old, new).  Formula:  %CHANGE(x, y) = (y - x) / x * 100%


%TOTAL


This calculates the % total given a part and a whole.  Syntax:  %TOTAL(whole, part).  Formula:  %TOTAL(x, y) = y / x * 100%


The program POPTOWN uses the percent functions.  It is a simple game where you invite a certain population to live in a town, and the birth (growth) and death rates are determined by random.


HP Prime Prime Program:  POPTOWN


RESULTS(y,n,g,d,p)

BEGIN

// subroutine

PRINT();

PRINT("Year: "+STRING(y));

PRINT("Population: "+STRING(n));

IF y>0 THEN

PRINT("Growth: "+STRING(g)+"%");

PRINT("Death: "+STRING(d)+"%");

PRINT("Δ%: "+%CHANGE(p,n));

END;

WAIT(0);

END;


// main program

EXPORT POPTOWN()

BEGIN

MSGBOX("You start with 10 

residents, inviting up to 50 

new residents each year.  Can 

growth beat death?");

// 2020-10-24 EWS

// Growth and Death

LOCAL n,y,w,g,d,c,p;

LOCAL v; // number of invites

n:=10;

RESULTS(y,n,g,d,p);

// The game

FOR y FROM 1 TO 5 DO

INPUT({{c,{0,10,20,30,40,50}}},

"Year "+STRING(y),"Invite:");

// all invites move in at the

// beginning of each turn

p:=n;

w:=10*(c-1)+n;

v:=10*(c-1)+v;

g:=RANDINT(5,20);

d:=RANDINT(1,25);

n:=w+IP(%(w,g))-IP(%(w,d));

// empty town scenario

IF n≤0 THEN

MSGBOX("No one survived.");

n:=0; 

END;

RESULTS(y,n,g,d,p);

END;

// End the game results

PRINT("Final Results");

PRINT("Population Change: "+

STRING(n-10));

PRINT("Invited: "+STRING(v));

PRINT("Percent Invite: "+

STRING(ROUND(%TOTAL(n,v),2))

+"%");

END;



Eddie


All original content copyright, © 2011-2020.  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. 


Sunday, May 17, 2020

Numworks/Casio MicroPython/Python: Financial Functions

Numworks/Casio MicroPython/Python:  Financial Functions 

My first python script for the Numworks calculator:  finance.py

Great calculator and glad I finally have one. 

Introduction

The following scripts creates the user functions for the following financial functions:

pchg(old, new):  Returns the percent change between two numbers
Example:  pchg(1400,2600) returns 85.71

taxlplus(amt, tax): Adds the tax rate to an amount. amt + tax%.  Results are rounded up to 2 decimal places.
Example:  taxplus(59,9.5) returns 64.6

uspv(n,i):  Takes n (number of payments) and i (periodic interest rate) and calculates the uniform present value factor.  PV = PMT * USPV.  Future value is assumed to be 0.
Example:  n = 36 payments, i = 0.25%.  uspv(36,0.25) returns 34.39

usfv(n,i):  Takes n (number of payments) and i (periodic interest rate) and calculates the uniform future value factor.  FV = PMT * USFV.  Present value is assumed to be 0.
Example:  n = 36 payments, i = 0.25%.  usfv(36,0.25) returns 37.62

mopmt(yrs,rate,loan):  Calculates the monthly payment of a loan with monthly payments.  Payments are assumed to be due at the end of each month.   Results are rounded to up to 2 decimal places. 
Example:  Loan of $238,000 for 30 years at 4.28% annual rate.  mompt(30,4.28,238000) returns 1175.0

annrate(ppy,cpy,rate):  Calculates the equivalent annual rate given ppy (payments per year), cpy (compounding payments per year), rate (estimated periodic rate).
Example:  ppy = 12, cpy = 2, periodic rate = 0.74%.   annrate(12,2,0.74) returns 9.0459

Source for annrate:
Roger F. Farish and The Staff of the Texas Instruments Learning Center.  Calculator Analysis for Business and Finance.  Texas Instruments, Inc.  1977.  ISBN 0-89512-015-1

sinkfund(yrs,rate,pymt):  Calculates the balance of a sink fund (savings account)  of monthly deposits.   Number of years and the annual interest rate are needed.  Deposits are assumed to be due at the end of each month.   Results are rounded to up to 2 decimal places. 
Example:  Monthly deposits of $400.00 for 5 years, at a rate of 2.9%.  sinkfund(5,2.9,400) returns 25793.77

piti(yrs,rate,loan,tax,insur):   Calculates the monthly payment of a mortgage given:  the term of the loan in years (yrs), the annual interest rate (rate), the mortgage (loan), the annual property tax (tax), and the annual property insurance (insur).  Payments are assumed to be due at the end of each month.  Results are rounded to up to 2 decimal places.
Example:  piti(30,3.3,160000,1349,240) returns 833.15

qualinc(inc,debt,taxins,rate,yrs):  Calculates the qualifying amount given the following parameters:  monthly income (inc), monthly debt payments (debt), monthly proper taxes and insurance (taxins), interest rate (rate), and term of the mortgage in years (yrs).   Mortgage payments are assumed to be due at the end of each month.   The standard debt:income ratio of 28:36 is used.  Results are rounded to up to 2 decimal places.
Example:  qualinc(4485,375,126.83,5.30) returns 207288.6


Python Script: finance.py

# 2020-04-12 EWS

from math import *

# percent change
def pchg(old,new):
  pch=(new-old)/old*100
  return pch

# add sales tax  
def taxplus(amt,tax):
  total=amt*(1+0.01*tax)
  return round(total,2)

# uniform pv factor pv=pmt*uspv
def uspv(n,i):
  factor=(1-(1+0.01*i)**(-n))/(0.01*i)
  return factor

# uniform fv factor fv=pmt*usfv
def usfv(n,i):
  factor=((1+0.01*i)**n-1)/(0.01*i)
  return factor
  
# monthly payment
def mopmt(yrs,rate,loan):
  pymt=loan/uspv(yrs*12,rate/12)
  return round(pymt,2)
  
# equivalent annual rate
def annrate(ppy,cpy,rate):
  irate=cpy*100*((1+0.01*rate)**(ppy/cpy)-1)
  return irate
  
# sinking fund
def sinkfund(yrs,rate,pymt):
  sink=pymt*usfv(yrs*12,rate/12)
  return round(sink,2)

# piti
def piti(yrs,rate,loan,tax,insur):
  pymt=loan/uspv(yrs*12,rate/12)+(tax+insur)/12
  return round(pymt,2)

# qualifying income 28:36 ratio
def qualinc(inc,debt,taxins,rate,yrs):
  a=min(inc*0.36-debt,inc*0.28)-taxins
  qual=a*uspv(yrs*12,rate/12)
  return round(qual,2)

Eddie

All original content copyright, © 2011-2020.  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.

Tuesday, April 2, 2019

HP Prime and TI-84 Plus CE: Percent Change on Paired Data

HP Prime and TI-84 Plus CE:  Percent Change on Paired Data

Introduction

Given a two column matrix, the programs here calculate the percent difference on each row.  The first column is the old value while the second column is the new value.

HP Prime Program %CHGPAIRED

EXPORT %CHGPAIRED(m0)
BEGIN
// Δ% on a 2 column matrix
// 2019-03-31 EWS
LOCAL k,s:=SIZE(m0);
LOCAL n:=s(1);
LOCAL m1:=MAKEMAT(0,n,1);
FOR k FROM 1 TO n DO
m1(k,1):=%CHANGE(m0(k,1),m0(k,2));
END;
RETURN m1;
END;

TI-84 Plus Program CHGPAIR

"2019-03-31 EWS"
Disp "PCHG PAIRED DATA"
Input [J]
dim([J])→L₆
L₆(1)→N
{N,1}→dim([I])
For(K,1,N)
([J](K,2)-[J](K,1))/[J](K,1)*100→[I](K,1)
End
Pause [I]

Example

M =
[[ 1, 6 ], [ 4, 2 ], [ 3, 7 ], [ 6, 5 ], [ 4, 11 ]]

Result:
[[ 500 ], [ -50 ], [ 133.3333333 ], [ -16.6666667 ]]

[picture]

Source:  "Probability and Statistics:  Step by Step Solutions for Your HP-28S or HP-28S Calculator"  Hewlett Packard.  November 1987.

Eddie


All original content copyright, © 2011-2019.  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.

Wednesday, June 6, 2012

Arithmetic, Powers, Percent Change, and Square Roots using the Printing Calculator

Printing Calcualtor Madness

Printing calcualtors, better known as adding machines and 10-key machines are calculators designed for the office. If you are a professional accountant, CEO, auditor, tax preparer, or supervisor, chances are you operate these machines at least once in a while if not every day. The Sharp EL-1750V printing calculator is pictured below.

Introduction

This blog entry will show you how to extend the operation of the printing calculator beyond the mere adding and subtracting. While a printing calculator may not be a weapon of choice for super advanced mathematics, we can use some of the features to do some cool arithmetic and algebraic problems. Amaze your office friends with these techniques!

Note: I will assume the calculator is set to Float (F) mode and not in Add mode (A, or +)

The Printing Calculator

You have a printing office calculator if you have keys such as +=, -=, *T, ♢S, and GT.

The printing calculator operates on a hybrid notation. Addition and subtraction operate by postfix notation. That is, enter the number, then press the + key or - key, and repeat. Addition and subtraction operations are terminated by a totals key, labeled *, *T, or */T. For this blog entry, I will use *T to symbolize the totals key.

Example 1: 45 + 68 + 99 - 100 = 112

Keystrokes will be in blue and Courier font.


45 +
68 +
99 +
100 - *T


Multiplication and division operate by infix notation. This is enter the first number, press either the × or the ÷ key, then enter the second number. Multiplying and dividing operations are terminated by the equals key. The equals key can be by itself (=) or coupled by a plus or minus operation (+= or -=).

Example 2: 24 × 72 ÷ 6 = 288

24 ×
72 ÷
6 =


The memory keys are your good friends on the printing calculator. Here is a basic rundown of the memory keys:

M+: Adds whatever is in the display to the memory register
M-: Subtracts whatever is in the display from the memory register
MS or M♢ : Displays and recalls the contents of the memory register
MT or M* : Recalls the contents of the memory register AND resets the memory register to 0.

For this blog entry, I will use the M ♢ and M* notation. It is often a very good idea to "clear memory" first by pressing M* before doing several of the more complex calculations.

Now that you have it, let's go on to the arithmetic calculations. Paper printing is optional but unless you have ton of tape, it is not really necessary.

Arithmetic

Couple of Golden Rules:

1. Make sure memory is clear before beginning (necessary most of the time).
2. If you remember "My Dear Aunt Sally" (multiplication and division before adding and subtracting), the rules of parenthesis, and the rules involving rational expressions, we're in business. See, algebra class pays off!
3. Do not forget to terminate adding/subtracting calculations with *T before switching to multiplying/dividing.
4. Likewise, do not forget to terminate multiplying/dividing calculations with = before switching to adding/subtracting. Before starting the adding/subtracting, press the + key once to tell the printing calculator to add the number.

Let's begin. I use the capital letters A, B, C, etc. to represent numbers (as variables).

#1. A × B + C
Keystrokes:
A × B =
+ C + *T


Example: 5 × 2 + 10 = 22
5 × 2 =
+ 12 + *T


#2. (A + B) ÷ C
Keystrokes:
A + B + *T
÷ C =


Example: (56 + 27) ÷ 3 = 27.6666666667
56 + 27 + *T
÷ 3 =


Here is where the memory keys get used. If you have to switch signs (i.e. negate a value), remember to use the plus/minus key +/- .

#3. A × B + C × D
Keystrokes:
M*
A × B = M+
C × D = M+
M*


Example 1: 4 × 1.99 + 8 × .99 = 15.88
M*
4 × 1.99 = M+
8 × .99 = M+
M*


Example 2: A bill with sales tax.
(2 × 19.95 + 10.99 + 3 × 4.99) + 8%
= (2 × 19.95 + 10.99 + 3 × 4.99) × (1 + 8 ÷ 100)
= (2 × 19.95 + 10.99 + 3 × 4.99) × 1.08
M*
2 × 19.95 = M+
10.99 M+
3 × 4.99 = M+
M* × 1.08 =


#4. A × B - C × D
Keystrokes:
M*
A × B = M+
C × D = M-
M*


Example: 3 × 4 - 2 × 3.1 = 5.8
M*
3 × 4 = M+
2 × 3.1 = M-
M*


#5. (A + B) ÷ (C + D)
The trick here is to work on the denominator first. Keystrokes:
M*
C + D + *T M+
A + B + *T
÷ M* =


Example 1: (6 + 3.9) ÷ (5 - 4.1)
M*
5 + 4.1 - *T M+
6 + 3.9 + *T
÷ M* =


Example 2: 2 × (3 + 4) ÷ (7 + 8) = .93333333333
M*
7 + 8 + *T M+
3 + 4 + *T
÷ M*
× 2 =


#6: Working With Mixed Fractions
Mixed fractions in the form of A B/C can be entered with the following keystrokes:
B ÷ C = + A + *T

Be sure to work with memory when you adding and subtracting fractions. You will get an answer in decimal format, no matter how nice your fractions are.

Example: 4 2/5 + 3/7 - 2 1/9 = 2 226/355 = 2.71746031746
M*
2 ÷ 5 = + 4 + *T M+
3 ÷ 7 = M+
1 ÷ 9 = + 2 + *T M-
M*

Cost/Sell/Margin and using those keys to find Δ%

#7. Margin
The equation for Cost/Sell/Margin calculations is:

100 × (sell - cost) ÷ sell = margin

Let A be the cost of the item and B be the selling price.
Keystrokes:
A COST
B SELL (Margin is automatically calculated)


Example: If the cost of an item is $3,200 and the selling price is $4,800, what is the margin?
3200 COST
4800 SELL


The margin is 33.3333333333%

#8. Percent Change Δ%
The equation for percent change is:

100 × (new - old) ÷ old = Δ%

Note that

100 × -1 × (old - new) ÷ old = Δ%

It looks like the Cost/Sell/Margin equation above. We can use the Cost/Sell/Margin and the change sign (+/-) to calculate Δ%.

Let A be the old number and B be the new number.
A SELL
B COST +/-


Example: Find the percent change from 17.95 to 24.65. 17.95 is the old number, 24.65 is the new number.
17.95 SELL
24.65 COST +/-


Δ% = 37.3259052924%

Reciprocals and Powers

#9. Reciprocals

The reciprocal of A is 1 ÷ A.

We can use straight division, memory, or a third technique which can be useful in more complex calculations.
A ÷ = =

Example 1. Calculate the reciprocal of 4. (4^-1)
4 ÷ ÷ =

4^-1 = 1 ÷ 4 = 2.5

Example 2. 1 ÷ (60.7 - 38.6) = (60.7 - 38.6)^-1 = .0454886877
60.7 + 38.6 - *T ÷ ÷ =

#10. Powers

To raise a number A to a power N (N is an integer), use the following technique:
1. Enter A
2. Press the × key N-1 times.
3. Press the = key.

To square A, press A × =.
To cube A, press A × × =.

For practical purposes, N should not be too high, unless you want to press × many times while keeping a mental count.

If N is negative, follow the power calculation with a reciprocal calculation. See Example 2.

Example 1: 3.6^3 = 46.656
3.6 × × =

Example 2: 5000 × 1.1^-4 = 3,415.50672768
1.1 × × × =
÷ ÷ =
× 5000 =


Example 3: (3 + 2.4)^2 - (3.1 - 2.8)^3 = 29.133
*M. (clear memory)
3 + 2.4 + *T × = M+
3.1 + 2.8 - *T × × = M-
*M


Square Root Routine

One of the most annoying things about printing calculators is the lack of a square root key (√). There is an iterative method for finding the square root using the Babylonian Method (if you want a challenge or don't feel like getting a calculator with a square root function or running Excel):

To find √S (the square root of S):

1. Start with an initial guess x0. Obviously, the better the initial guess, the faster this method goes.
2. Calculate x1 = (x0 + S ÷ x0) ÷ 2
3. As you repeat Step 2, more and more decimal places should "repeat" themselves. For each loop, set x1 as the new x0.

Keystroke wise:
To start: M* x0
Loop: M+ S ÷ M♢ = M+ M* ÷ 2 =


Example: √125 with an initial guess x0=10
M* 10

Loop #1:
M+ 125 ÷ M♢ = M+ M* ÷ 2 = (11.25)

Loop #2:
M+ 125 ÷ M♢ = M+ M* ÷ 2 = (11.1805555555)

Loop #3:
M+ 125 ÷ M♢ = M+ M* ÷ 2 = (11.1803398895)

Loop #4:
M+ 125 ÷ M♢ = M+ M* ÷ 2 = (11.1803398874)

Loop #5:
M+ 125 ÷ M♢ = M+ M* ÷ 2 = (11.1803398874). STOP


Hence √125 = 11.1803398874


Have fun impressing your co-workers and friends. It's been a blast as always! Until next time, Eddie




This blog is property of Edward Shore. © 2012

Python – Earth’s Radius and Gravity in US Units

Python – Earth’s Radius and Gravity in US Units Introduction The following script, gravus2.py, estimates the Earth’s gravity i...