Showing posts with label tax. Show all posts
Showing posts with label tax. Show all posts

Sunday, October 8, 2023

TI-84 Plus CE: Using Matrices for "Tax Table" Calculations

TI-84 Plus CE:   Using Matrices for "Tax Table" Calculations


How The Matrix is Set Up


Each row represents a tier or a bracket.  


First column:  Lower Limit.  This is the test variable.  The first tier often will have the lower tier of 0.


Second and subsequent columns:    Variables that are associated with that tier.


Let's demonstrate this with an example.




Example Tax Bracket






This matrix has four brackets (four rows).  The algorithm starts with the last (bottom) row and tests whether the input is greater or equal to the test variable.  


According to the table, the tax rate changes at income level at $30,000, $90,000, and $270,000, with the top tax rate of 9% effective for all income excess of $270,000.


If the income is $29,999.99, the first tier of 3% is used.  If the income goes to $30,000.00, the next tier is activated.


The program ITAX, which uses this type of setup, goes "backwards".  It tests from the highest tier down.  


For example:  Income = $50,000


Start at tier 4 (bottom row). 

Is 50,000 > 270,000?  No, go to tier 3. (move one row up)

Is 50,000 > 90,000?  No, go to tier 2.  (move one row up) 

Is 50,000 > 30,000?  Yes, use the variables from tier 2.


Tax:  (50,000 - 30,000) × 5% + 900 = 20,000 × 5% + 900 = 1,900


Matrix wise:   (income - M[2,1]) * M[2,2] ÷ 100 + M[2,3]



Programs



There are two programs that illustrate this method:  


ITAX:  Income Tax Bracket.  Bracket is stored in Matrix [ A ] and has three columns:


Column 1:  lower limit of each bracket

Column 2:  tax rate for that bracket

Column 3:  additional "minimum" tax.   



BAROMET:  Calculates the air pressure and density based on height.  Scientific information is stored in Matrix [ J ].  


Column 1:  height in meters

Column 2:  mass density in kg/m^3

Column 3:  standard temperature in K

Column 4:  static pressure in Pa


If you are working in US Units, the height is converted to meters first.  After the calculation, the results are converted back into US units. 



You can download both programs here (zip file):  

https://drive.google.com/file/d/1ZCtMcJgZDLUGnrAHE6cPAkWBQQj1aHKc/view?usp=sharing



Source


"Barometric formula."  Wikipedia.  Last edited July 13, 2023.  Retrieved July 16, 2023.   https://en.wikipedia.org/wiki/Barometric_formula



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. 


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, April 4, 2020

Retro Review: Canon Palm Printer P1-DH V

Retro Review:  Canon Palm Printer P1-DH V



Quick Facts:

Model:  Palm Printer P1-DH DV
Company:  Canon
Type:  Printing
Years:   I think this model is around 2016, not sure, I got this from a search on Amazon.  The current version is P1-DH V3
Display:  12 digits
Batteries:  4 AAA Battery and/or AC Adapter AD-380
Original Retail Price:  about $30.00 to $35.00
Logic:  Chain

This review is on an older model P1-DH DV.  I think the current version at the time of this post is the P1-DH DV3. 

I will focus my review on the keyboard and features only, not on the printing features. 

The calculator will operate on AC power alone, without batteries, which I like. 

Unlike most printing calculators, the P1-DH V operates as a four-function Chain calculator instead of an adding machine.  For example:  to add 2, 7, and 11, type:

2 [ + ] 7 [ + ] 11 [ = ]

Result: 20

Features

This is a standard printing calculator that has the following features:

*  Decimal Point Selectors:  F (float, no indicator), 0, 2, 3, 4, A (add mode).  The mode is changed by the key [DEC].   Float is the default mode. 

*  Rounding/Truncate Toggle:  toggle between rounding and truncate with the [5/4] key.  When the 5/4 is on, the calculator is on rounding mode.  Note that this setting has no affect on results on when the decimal point selector is set to Float.

Example:

Float Mode:
1 [ ÷ ] 6 [ = ] returns 0.16 666 666 666

2 Decimal Place Mode:  (2 indicator)
5/4 on (Rounding mode):  1 [ ÷ ] 6 [ = ] returns 0.17
5/4 off (Truncate mode):  1 [ ÷ ] 6 [ = ] returns 0.16

*  One memory register is available, with sum and difference.   When [ M+ = ] is pressed, the calculation is completed and is added to the memory register.   When [ M- = ] is pressed, the calculation is completed and is subtracted from the memory register.

Example:

1000 * 298 + 928 * 172 - 442 * 180

[ RM/CM ] until memory is cleared
1000 [ × ] 298 [ M+ = ]
928 [ × ] 172 [ M+ = ]
442 [ × ] 180 [ M- = ]
[ RM/CM ]
Result:  378,056

*  Time Calculations:  You can enter hours-minutes for calculations in either AM/PM or 2400 hour format by using the [TIME CAL] key.  You know the calculator is ready to accept hours-minutes when the screen shows 00:00.  In AM/PM mode, switch between AM/PM by use the [TIME CAL AM/PM] button.  To calculate the difference between times, the required key is the key with the tilde mark on it.  ( [ ~ ] )

Example:  What time has passed between 23:17 and 11:16?  (2400 hours)

[TIME CAL] [TIME CAL] (00:00 without an AM/PM indicator means 2400 hours):
2 3 1 7 [ ~ ]
1 1 1 6 [ = ]

11:59 (11 hours, 59 minutes)

* Cost/Sell/Margin and Sales Tax Calculation.  See the next section.

The [ B ← → T ] Key

The [ B ←→ T ] rules what functions the blue keys execute on the P1-DH V. 

Indicator T:  Tax Mode (Default mode)

[ TAX+ ]:  Add tax using the rate stored
[ TAX- ]:  Subtract tax using the rate stored
[ RATE ]:  Press this key to enter the tax rate (RATE will be blinking), press [ RATE ] again to finish

Indicator B:  Business Mode

[ COST ]:  Cost
[ SELL ]:  Sell
[ MARGIN ]:  Margin

Enter any of the two values, the third is automatically calculated.

Example: 
Sell = $29.95,  Margin = 8%

[ B ←→ T ] until B appears
29.95 [ SELL ] (SELL flashes)
8 [ MARGIN ]

Result:  27.55 (COST indicator)

Keyboard

The keyboard is nice and light.  The keys are rubber and very responsive.  The key response and register is great.  My hands are a little too big but it is possible to speed calculate on the Palm Printer. 

I like the screen but I wish the indicators were bigger, as they are too tiny for my preference.  Just make sure you triple check which mode you are in.  This model I purchased in December 2019 at a Revivals Store in Palm Springs. 

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.

Monday, April 29, 2019

Four Function and Desktop Calculators: The [ TAX+ ] and [ TAX- ] Keys

Four Function and Desktop Calculators: The [ TAX+ ] and [ TAX- ] Keys

A good subject for a Monday (start off the work week for most of us, me included)

The TAX+ and TAX- keys up close and personal  (Casio SL-300VC)


What is needed:  a calculator with [ TAX+ ] and [ TAX- ]

Introduction

On a four function or desktop calculator with the [ TAX+ ] and [ TAX- ] keys, you can perform tax calculations and financial calculations.  The primary key purpose of these keys is for sales tax.  The procedure for these calculations are (almost) universal.  However, the procedure to set such tax varies by manufacturer.

Casio:  Hold [AC] until the display blanks and refreshes.  Enter the tax rate and press [ % ] (RATE SET). 

Texas Instruments (TI-1795SV):   Enter the tax rate, press [ rate ], [ tax+ ] (store)

Canon:  Press [AC], [ TAX+ ] (SET), enter the rate, and press [ TAX+ ]

Sharp: Press [ CE/C ], [ CE/C ] (twice), [ TAX+ ], enter the rate, press [ TAX+ ]

Printing Calculators (various):  Set tax setting switch to SET, enter the rate, set the tax setting switch back to calculator mode.  Check your manual because printing calculators may vary.

My focus will be on four function and desktop calculators.  Procedures for printing calculators will probably vary.

Note:  I did the procedures listed in today's blog entry on both the Casio SL-300VC and Casio LS-123K.  For using independent memory, check to see if you have either a combined memory recall/clear key [MRC] (or [RM/CM on the LS-123K) or two separate keys ([MR] for recall and [MC] for clear).  For illustration purposes I will use [MRC]  (once for recall, twice for clear).   Remember that you can press [AC] to clear memory. 

Left:  Canon LS-123K (Green), Right:  Casio SL-300VC (Blue)


Note:  Pressing [AC] or [MRC] [MRC] will only clear the memory register, not the tax rate.

Contents

1.  Testing What Tax Rate is Stored in Memory
2. Price After Sales Tax and the Amount of Tax
3. Adding Taxable and Non-taxable Amounts
4. Calculating Use Tax
5.  Find the Taxable Amount Given the Grand Total (Total Plus Tax)
6.  Finance: Using [ TAX+ ] to calculate Future Value
7.  Finance: Using [ TAX- ] to calculate Present Value

For all the examples today, I have the tax rate set to 9.5%.  Please see the Introduction section above on how to set the tax rate.

1.  Testing What Tax Rate is Stored in Memory

This procedure is for any calculator that does not have a recall tax feature, although it works for these calculators too.

Procedure:

100 [ TAX+ ] [ - ] 100 [ = ]

Example:  (remember I'm using the tax rate set at 9.5% for all examples on this blog entry)

100 [ TAX+ ] [ - ] 100 [ = ]
Result:  9.5

2. Price After Sales Tax and the Amount of Tax

The [ TAX+ ] key performs two operations:

*  Press [ TAX+ ] once to calculate the total plus tax
*  Press [ TAX+ ] again to calculate the tax amount

Example:

An invoice shows of a purchase of equipment totaling $250.00.  Find the total after tax and the sales tax.

250 [ TAX+ ]
Display:  273.75   (total invoice:  $273.75)

[ TAX+ ]
Display:  23.75   (sales tax:  $23.75)


3. Adding Taxable and Non-taxable Amounts

Sometimes an invoice has both taxable amount and non-taxable amounts (such as most services, installation fee, sometimes freight, some food).  We can calculate the total invoice accurately with both the TAX and memory keys.  Start by clearing out the memory. 

Procedure:

[MRC] [MRC] taxable amount [ TAX+ ] [ M+ ] n
non-taxable amount [ M+ ] 
[MRC]  (recall memory)

Example:

Suppose has the invoice has:

A scanner that subject to sales tax:  $69.99
Computer services not subject to sales tax: $34.95
Sales Tax Rate:  9.5%

[ MRC ] [ MRC ] 69.99 [ TAX+ ] [ M+ ] 34.95 [ M+ ] [MRC]

The total invoice is $111.59   (8-Digit display shows 111.58905)


4. Calculating Use Tax

In certain states, such as California, use tax on a purchase can occur.  Where you take delivery determines what sales tax rate you would pay.  If a vendor does not charge the required tax, the use tax kicks in, which constitutes the remaining amount required from the buyer.  How to pay the use tax is beyond the scope of this blog entry. 

Procedure:

taxable amount [ TAX+ ] [ TAX+ ] [ - ] sales tax charged [ = ]

Example:

A purchase of a printer from an online store has a retail price of $164.79.  Sales tax of 8% was charged on the printer in the amount of $13.18.  The purchaser lives in a tax district that has a sales tax rate of 9.5%.  What is the use tax?

164.79 [ TAX+ ] [ TAX+ ] [ - ] 13.18 [ = ]  

The use tax is $2.48  (8-Digit display shows 2.47505)


5.  Find the Taxable Amount Given the Grand Total (Total Plus Tax) 

Sometime you know only the grand total of the invoice, but you need to find what was the taxable amount and the tax applied to that amount.  That is what the key [ TAX- ] is for.

*  Press [ TAX- ] once to calculate the taxable amount
*  Press [ TAX- ] again to calculate the tax amount

This is the inverse of the [ TAX+ ] key.

Example:

During an audit, we find an invoice from an electronics retail store for a purchase of a video projector.  However, only the total invoice is readable, in the amount of $187.44.  What is the retail price and what was the sales tax charged?

187.44 [ TAX- ]
Display:  171.17809   (taxable amount:  $171.18)

[ TAX- ]
Display:  16.261917 (sales tax:  $16.26)


6.  Finance: Using [ TAX+ ] to calculate Future Value

Time for a little unorthodox use of the TAX keys to calculate simple compound interest problems.  If you have an investment and you want to know how much your account will be in n periods (usually year), you can use the [ TAX+ ] [ = ] combination.

FV = PV * (1 + r%)^n

FV = future value
PV = present value
r% = interest rate, stored as the TAX rate
n = number of periods

Procedure:

[ MRC ] [ MRC ] 
present value [ M- ]
Loop:  [ TAX+ ] [ = ]   (do this n times for n periods)
(display future value)
[ M+ ] [ MRC ] 
(display interest earned)

Example:

You deposit $1,000.00 in a moderate to aggressive investment account that pays an average of 9.5% per year.  What is the balance after 5 years?  How much interest is earned in those five years?

[ MRC] [ MRC ] 
1000 [ M- ]
[ TAX+ ] [ = ]
[ TAX+ ] [ = ]
[ TAX+ ] [ = ]
[ TAX+ ] [ = ]
[ TAX+ ] [ = ]    (loop the last two keys 5 times)
Future value:  $1,574.24  (8-Digit display: 1574.2385)

[ M+ ] [ MRC ]
Interest earned:  $574.24  (8-Digit display:  574.2385)


7.  Finance: Using [ TAX- ] to calculate Present Value

Similarly, we can use the [ TAX- ] [ = ] combination to calculate the present value of a discounted note. 

PV = FV / (1 + r%)^n

FV = future value
PV = present value
r% = interest rate, stored as the TAX rate
n = number of periods

Procedure:

[ MRC ] [ MRC ] 
future value [ M+ ]
Loop:  [ TAX- ] [ = ]   (do this n times for n periods)
(display future value)
[ M- ] [ MRC ] 
(display interest earned)

Example:

You want to save $10,000.00 in five years.  You find an account that pays 9.5% annual interest.  How much will you need to deposit today to get that $10,000.00 goal in five years?

[ MRC] [ MRC ] 
10000 [ M+ ]
[ TAX- ] [ = ]
[ TAX- ] [ = ]
[ TAX- ] [ = ]
[ TAX- ] [ = ]
[ TAX- ] [ = ]    (loop the last two keys 5 times)
Present value:  $6,352.28  (8-Digit display: 6352.2775)

[ M- ] [ MRC ]
Interest earned:  $3,647.72  (8-Digit display:  3647.723)

What the [ TAX+ ] and [ TAX- ] Keys Calculate

With the tax rate r set:

[ TAX+ ] calculates:   number in the display * ( 1 + r/100)

[ TAX- ] calculates:  number in the display / (1 + r/100 )

Happy calculating and may all your calculations, and work weeks, be successful,

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.

Thursday, October 25, 2018

HP 12C Substantial Presence Test: When the Payee Becomes a Resident Alien

HP 12C Substantial Presence Test: When the Payee Becomes a Resident Alien


Introduction

When a U.S. company or entity pays a foreign entity or a person who is not a U.S. Citizen and it is U.S. source income, IRS law dictates that the payer must determine whether the payee is a resident alien or a non-resident alien. 

One test that is applied to foreign nationals is the substantial presence test.  The substantial presence test is in two parts:

1.  If the payee is physically present in the United States for less than 31 days in a calendar year, that person is a nonresident alien.

2.  If the payee is physically present 31 days or more, a mathematical formula is used:


* Count all the days the foreign national is in the U.S. this current year.


* Count 1/3 of the days present in the U.S. last year.


* Count 1/6 of the days present in the U.S. two years ago


If the sum is 183 or greater, then the payee is a resident alien.  Otherwise the payee is a nonresident alien.

Tax laws for payments to U.S. resident aliens versus nonresident aliens differ; the specifics are beyond the scope of the blog.

The following program determines the residency date of an international payee depending on when the payee first came to the United States with several assumptions:

1.  We are assuming that none of the exemption rules apply (such as an F-1 student does not count any days towards the substantial presence test for up to five calendar years). 

2.  The program also assumes the payee does not leave the United States when the payee enters the country.  If the payee leaves the U.S. for a time period, this program will not give accurate results.

Please Note:  This program is NOT tax advice.  Should you have any tax questions, please consult a professional tax prepare.  Also, this date is for federal tax purposes only, and has no effect on the payee's immigration status.

The program is assumed to be in U.S. date M.DY format (MM.DDYYYY). 

HP 12C Program:  Tax Residency Date for Foreign Payees

01 36 ENTER
02 36 ENTER
03 44, 0 STO 0
04 1 1
05 26 EEX
06 2 2
07 20 *
08 43, 24 FRAC
09 44, 1 STO 1
10 1 1
11 2 2
12 3 3
13 1 1
14 40 +
15 1 1
16 26 EEX
17 2 2
18 10 ÷
19 43, 26 ΔDYS
20 1 1
21 8 8
22 3 3
23 43, 34 x ≤ y
24 43, 33, 45 GTO 45
25 34 x < > y
26 3 3
27 10 ÷
28 43, 25 INTG
29 30 -
30 45, 1 RCL 1
31 1 1
32 26 EEX
33 4 4
34 16 CHS
35 40 +
36 1 1
37 0 0
38 1 1
39 40 +
40 1 1
41 26 EEX
42 2 2
43 10 ÷
44 43, 33, 46 GTO 46
45 45, 0 RCL 0
46 34 x < > y
47 43, 16 DATE
48 43, 33, 00 GTO 00

Example 1: 
Substantial Presence Test starts at January 1, 2018 (1.012018)
Result:  7.032018 (July 3, 2018)

Example 2:
Substantial Presence Test starts at August 17, 2017 (8.172017)
Result:  5.192018 (May 19, 2018)


Source:

"Substantial Presence Test"  Internal Revenue Service  https://www.irs.gov/individuals/international-taxpayers/substantial-presence-test


Eddie


All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Python in Numworks: Duplicating and Grayscale

Python in Numworks: Duplicating and Grayscale All three scripts presented today use the math, random, and the Numworks specific ...