Showing posts with label discounts. Show all posts
Showing posts with label discounts. Show all posts

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. 


Thursday, August 8, 2019

A Choice of Discounts

A Choice of Discounts



Situation

We are ready to purchase two items.  Let A be the cost of the more expensive item, while B is the cost of the less expensive item (A > B).  We have two coupons:

Coupon 1:  Take 10% off of all purchases  (10% off the cost of both A and B)

Coupon 2:  Take 20% off of the most expensive item  (20% off of A, B remains at full price)

The store allows for only one coupon to be used per transaction.  Which coupon gives us the best benefit?  Let's assume that we are only buying two items.

We will not worry about sales tax in this situation.

Calculating the Costs After Discounts

Using Coupon 1:  Let T1 be the total cost using coupon 1.

T1 = (100% -10%) * (A + B)
T1 = 90% * (A + B)
T1 = 0.9 * (A + B)

Using Coupon 2:  Let T2 be the total cost using coupon 2.

Here, A is more expensive, so:

T2 = (100% -20%) * A + B
T2 = 80% * A + B
T2 = 0.8 * A + B

In summary, the total costs are:

T1 = 0.9 * (A + B)
T2 = 0.8 *A + B

Comparing the Two Coupons

Is there a price point of both A and B where the total costs of the two items is the same?  This occurs when T1 = T2.

T1 = T2

0.9 * (A + B) = 0.8 * A + B
0.9 * A + 0.9 * B = 0.8 * A + B
0.1 * A + 0.9 * B = B
0.1 * A = 0.1 * B
A = B

The costs are the same when the cost of both items are the same.

But we assume that A > B.    So, either T1 will be more or T2 will be more.  To determine this, we will need to perform a subtraction.  Let's pick T1 - T2.

If T1 -T2 > 0, then T1 costs more and using the second coupon, 20% of the more expensive item,  is preferable.

If T1 - T2 < 0, then T2 costs more and using the first coupon, 10% of both items, is preferrable.

T1 - T2
= 0.9 * A + 0.9 * B - (0.8 * A +  B)
= 0.1 * A - 0.1 * B
= 0.1 * (A - B)

Since A represents the cost of the more expensive item, A > B, and A - B > 0.  Therefore 0.1 * (A - B) > 0 and T1 > 0.   The second coupon is preferable.

Case Studies

A = $29.99,  B = $24.99:  T1 = $49.48,  T2 = $48.98  (not much difference)

A = $29.99,  B = $13.99:  T1 = $39.58,  T2 = $37.98

A = $29.99, B = $5.99;  T1 = $32.38,  T2 = $29.98  (difference between T1 and T2 increase as discrepancy of costs increase)

Hopefully this helps on all of our future shopping trips,

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.

Sunday, July 28, 2013

Discounts and Sales Tax: What is the Final Price?

SALE! GET THIS WONDERFUL ITEM FOR A SUBSTANTIAL DISCOUNT! GOOD FOR THIS WEEKEND ONLY!

Chances are that we have all seen this advertisement at least one time in our lives. Chances are that if you are shopping with someone, that person asks what the price is after the discount. And in a lot of instances, depending on where you live, you have to take sales tax into consideration. Today's blog is about how to find the final price after the discount and sales tax.

Note: All the examples presented here are using prices stated in dollars ($). Rest assured the concepts hold for all other units of currency. Also, all dollar amounts are rounded to two decimal places.


The Math Behind it All

Discounts

Let D be the discount. Since the discount is customarily stated as a percentage, such as "take 20% off of everything on this rack", we'll express the discount as its decimal equivalent: 0.01*D. Discounts are subtracted from the price.

For example, a item normally sold for $59.99 which has a 20% discount has a discounted price of $47.99.

$59.99 - 20%
$59.99 - $59.99 * 0.01 * 20
$59.99 * (1 - 0.20)
$59.99 * 0.80
$47.99

A general formula for subtracting D% from X is:

X - D%
X - X * 0.01 * D
X * (1 - 0.01 * D)

Sales Tax

Let S be the sales tax. Sales tax works like discounts, except that sales tax is added to the price. We'll express the sales tax as its decimal equivalent: 0.01*S.

Where I live, which is located in the County of Los Angeles in California, the sales tax is 9%. For example, if I purchase a taxable item for $59.99, taking sales tax into account, the total cost to me is $65.39.

$59.99 + 9%
$59.99 + $59.99 * 0.01 * 9
$59.99 + $5.40
$65.39

Likewise, we can use a general formula for adding S% to X is:

X + S%
X + 0.01 * S * X
X * (1 + 0.01 * S)


The Final Price of a Discounted Item After Sales Tax

Let's come up with a general formula where we determine the final price of an item which normally sells for $P (or whatever currency you work with), sold at a discount D%, which the item subject to sales tax of S%.

Customarily, the discount gets applied before the sales tax. Then the final price works out to be:

$P - D% + S%

To simplify this, start with subtracting the discount:
($P - D%) + S%
($P - $P * 0.01 * D) + S%
($P * (1 - 0.01 * D) + S%

Next, add the sales tax:
($P * (1 - 0.01 * D) + ($P * (1 - 0.01 * D)) * S * 0.01
($P * (1 - 0.01*D))(1 + 0.01*S)

So the final cost is:
$P * (1 - 0.01*D) * (1 + 0.01*S)

Taking from our example before, let's say that the item originally priced at $59.99 is discounted at 20%. What is the final cost after 9% sales tax is applied?

P = $59.99
D = 20
S = 9
And the final cost is:

$59.99 * (1 - 0.01*20) * (1 + 0.01*9) = $52.31

In the next section, we will determine a "combined rate".


Simplified Rate Considering Both Discount and Sales Tax

Here we are going to find a general formula for a "combined rate", or a rate that takes both the discount and sales tax rate into account.

Basically, the "combined rate" is what the final price would be if the original price was $1.00. ($P = $1.00)

The combined rate is (1 - 0.01D)*(1+0.01S)

In our example the combined rate for an item discounted 20%, subject to sales tax of 9% is 0.872. (87.2%)

(1 - 0.01*20)(1 + 0.01*9)
0.872

Under these conditions, you should expect to pay 87.2% of the original price when it is all said and done. For an item with an original price of $59.99, the final cost is:

Price * Combined Rate
$59.99 * 0.872
$52.31

Another example: item has an original price of $18.99. The discount is 10% while the sales tax rate is 9%

Combined rate:
(1 - 0.10 * 10) * (1 + 0.01 * 9)
0.981

Final cost:
$18.99 * 0.981
$18.63

As a check, let's find the final cost if we applied the discount then sales tax step by step.
($18.99 - 10%) + 9%
($18.99 - $18.99 * 0.01 * 10) + 9%
$17.09 + 9%
$17.09 + $17.09 * 0.01 * 9
$18.63

It checks out.

This is a quick table of combined rates using various sales tax and discount rates. The iOS App Numbers is used to generate this table.

Example: What is the final cost for at item originally priced $69.95 that is discounted 35%. The sales tax rate is 10%.

From the table above, the combined rate is 0.715. The final cost is $69.95 * 0.715 = $50.01.


I hope you find this helpful, and as always I appreciate your comments.

I want to do another mathematical series. I plan to do a short series of ordinary differential equations within the next couple of months, but if there is anything you suggest, subjects, calculators, calculator programming languages, please do. Many thanks as always.

My next blog entry will be within a couple of weeks. I am taking care of family and also going on a short vacation next weekend - hopefully the weather at Landers, CA will be nice as I go on my first astronomical star party.

Eddie



This blog is property of Edward Shore. 2013

Classic RPN Stack Operations

  Classic RPN Stack Operations Starting Stack: T:  d Z:  c Y:  b X:  a OVER :   Copies b to the Z and X stacks, while leaving ...