(12C Platinum) Successive Discounts
12-22-2018, 05:07 AM (This post was last modified: 12-22-2018 05:16 AM by Gamo.)
Post: #1
 Gamo Senior Member Posts: 756 Joined: Dec 2016
(12C Platinum) Successive Discounts
Successive discount is the discount offered on the discount.
It is similar to compound interest (interest on interest).

A company many offer two trade discount, 20% and 5%.
One customer may be entitled to a 20% discount and another
will get 5%, depending on status (jobber, wholesaler, retailer, etc.), and
a third customer of different status will receive 20% and 5%.

The two discounts cannot be simply added together
(20% + 5% = 25%) is inapplicable.

You have to use the following formula:

X = Price
Y = Discount %
Z = Discount %

Selling Price = X - [Y + Z - (Y*Z / 100)] * X

---------------------------------------------------

Procedure:

Price [R/S]
Discount % [R/S]
Discount % [R/S]

Answer display Total Discount% briefly then Selling Price.

***If you have the third discount.***

RCL 3 [R/S]
RCL 1 [R/S]
Discount % [R/S]

Answer display Total Discount% briefly then Selling Price.

----------------------------------------------------------------
Example: FIX 2

If original price is $135 and the trade discount are 20% and 15% What is the Selling Price. 135 [R/S] display 135.00 20 [R/S] display 20.00 15 [R/S] display briefly 32.00 then 91.80 Answer: Total Discount Rate is 32% Selling Price is$91.80
------------------------------------------------
The successive discount on a product in a store is giving as
5%, 10% and 15%. The store price of the product is $1000. Then calculate overall discount and selling price of the product. 1000 [R/S] display 1000.00 5 [R/S] display 5.00 10 [R/S] display briefly 14.50 then 855.00 Answer for Total Discount % of the first two discount is 14.5% and Selling Price is$855.00

To add the third discount.

RCL 3 [R/S] display 1000.00
RCL 1 [R/S] display 14.50
15 [R/S] display briefly 27.33 then 726.75

All Total of Three discount % is 27.33%
Selling price is $726.75 -------------------------------------------------- Program: ALG mode Code:  STO 3 R/S STO 1 R/S STO 2 (RCL1 + RCL2) - (RCL1 x RCL2 ÷ EEX2) = STO1 PSE PSE RCL3 - (RCL3 x RCL1 %) = Program: RPN Code:  STO3 R/S STO1 R/S STO2 RCL1 RCL2 + RCL1 RCL2 x EEX 2 ÷ - STO1 PSE RCL3 RCL3 RCL1 % - Gamo 12-22-2018, 09:07 AM (This post was last modified: 12-22-2018 06:10 PM by Dieter.) Post: #2  Dieter Senior Member Posts: 2,397 Joined: Dec 2013 RE: (12C Platinum) Successive Discounts (12-22-2018 05:07 AM)Gamo Wrote: The two discounts cannot be simply added together (20% + 5% = 25%) is inapplicable. You have to use the following formula: X = Price Y = Discount % Z = Discount % Selling Price = X - [Y + Z - (Y*Z / 100)] * X That's a quite complicated way of calculating accumulated discounts. Edit: and most important, it's wrong. The term within the square brackets is the total discount in percent, so there is a factor 100 missing. Doing it with discount factors is easier and not limited to just two successive discounts. Simply calculate 1 – d/100 for each discount rate d and multiply these factors. For 5%, 10% and 15% this yields 0,95 · 0,90 · 0,85 = 0,72675. Multiply the original price by this and get the discounted price. Also 1 minus that factor is the total discount rate, i.e. 0,27325 or 27,325%. The last program in this post uses this approach. (12-22-2018 05:07 AM)Gamo Wrote: The successive discount on a product in a store is giving as 5%, 10% and 15%. The store price of the product is$1000.
Then calculate overall discount and selling price of the product.

1000 [R/S] display 1000.00
5 [R/S] display 5.00
10 [R/S] display briefly 14.50 then 855.00

Answer for Total Discount % of the first two discount is 14.5% and
Selling Price is $855.00 To add the third discount. RCL 3 [R/S] display 1000.00 RCL 1 [R/S] display 14.50 15 [R/S] display briefly 27.33 then 726.75 Waaaay too complicated. ;-) You don't even need a program for this: Enter original price [ENTER] [ENTER] [ENTER] For each discount: Enter discout rate [%] [–] and get the dicounted price Finally press [Δ%] to see the total discount in percent. Example: 1000 [ENTER] [ENTER] [ENTER] 5 [%] [–] => 950,00 10 [%] [–] => 855,00 15 [%] [–] => 726,75 [Δ%] => –27,33 total discount in % After this you can press [%] to see the total discounted amount. Another [+] returns to the discounted price. [%] => –273,25 (total discount in € or$ or whatever)
[+]  =>   726,75   (the discounted price again)

If you really want to use a program, what about this one (RPN mode):

Code:
01 STO 0 02 R/S 03 x=0? 04 GTO 08 05 % 06 - 07 GTO 02 08 R↓ 09 RCL 0 10 X<>Y 11 Δ%

It can even be done without any data registers:

Code:
01 ENTER 02 ENTER 03 R/S 04 X=0? 05 GTO 09 06 % 07 - 08 GTO 03 09 + 10 Δ%

As usual, reset the program with f [PRGM] first.

Enter initial price [R/S]

Enter as many discounts as you want, each followed by [R/S]
The discounted price is displayed

After the last discount enter 0 [R/S]
The total discount in percent is displayed

1000 [R/S] => 1000,00

5 [R/S] => 950,00 (price after first discount)
10 [R/S] => 855,00 (price after second discount)
15 [R/S] => 726,75 (price after third discount)

0 [R(S] => –27,33 (total discount is 27,33%)

Here is another version that also displays the intermediate discount percentages.

Code:
01 STO 0 02 1 03 STO 1 04 1 05 RCL 1 06 - 07 EEX 08 2 09 x 10 PSE 11 RCL 0 12 RCL 1 13 x 14 R/S 15 RCL 1 16 % 17 STO-1 18 GTO 04

Same example:

f [PRGM]

1000 [R/S] =>    "0,00" 1000,00
5 [R/S] =>   "5,00"   950,00
10 [R/S] => "14,50"   855,00
15 [R/S] => "27,33"   726,75

When a result is displayed you may press [X<>Y] to show the accumulated discount rate and the disounted price again.

[X<>Y]   27,33
[X<>Y] 726,75

Dieter

Note: this post has been edited several times to add more programs and some other ideas which I had after I posted the original message. ;-)
12-23-2018, 09:11 AM
Post: #3
 Werner Senior Member Posts: 891 Joined: Dec 2013
RE: (12C Platinum) Successive Discounts
(1 + i%/100)*(1+j%/100) = 1 + (i%+j%+i%*j%/100)/100

So,
In:
Y: i%
X: j%
Out
X: i%+j%+i%*j%/100

Then
Code:
 %  LASTX  +  +
returns the accumulated percentage.

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
12-23-2018, 09:33 AM (This post was last modified: 12-23-2018 09:35 AM by Dieter.)
Post: #4
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: (12C Platinum) Successive Discounts
(12-23-2018 09:11 AM)Werner Wrote:  (1 + i%/100)*(1+j%/100) = 1 + (i%+j%+i%*j%/100)/100

So,
In:
Y: i%
X: j%
Out
X: i%+j%+i%*j%/100

Yes, that's the term in square brackets in Gamo's formula.
Except the sign which has to be negative here – we are calculating discounts.

Using your suggestion, the complete program can be as short as this:

Code:
01 % 02 CHS 03 LstX 04 + 05 + 06 % 07 -

1000 [ENTER] 5 [ENTER] 10
[R/S] => 855,00  (discounted price)
[Δ%] => –14,50  (total discount in %)

But it still works only for two discount rates.

Dieter
12-23-2018, 03:05 PM
Post: #5
 Gamo Senior Member Posts: 756 Joined: Dec 2016
RE: (12C Platinum) Successive Discounts
Thanks Dieter

The manual calculations is a good one.
Easy to remember those steps too.

Gamo
12-23-2018, 03:13 PM (This post was last modified: 12-23-2018 03:13 PM by SlideRule.)
Post: #6
 SlideRule Senior Member Posts: 1,497 Joined: Dec 2013
RE: (12C Platinum) Successive Discounts
Given three successive discounts as i%, j%, & k%, the total discount is …

Δ = i + j - (ij/100)%

Σ = Δ + k - (Δk/100)%

… calculate the initial compound discount, then substitute this result for the first term, with the third discount as the second term in the initial compound discount formula for the TOTAL discount {recursive loop}.

BEST!
SlideRule
12-23-2018, 06:16 PM (This post was last modified: 12-23-2018 06:17 PM by Dieter.)
Post: #7
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: (12C Platinum) Successive Discounts
(12-23-2018 03:13 PM)SlideRule Wrote:  … calculate the initial compound discount, then substitute this result for the first term, with the third discount as the second term in the initial compound discount formula for the TOTAL discount {recursive loop}.

Not recursive, but iterative.
For instance this way:

Code:
01 ENTER 02 0 03 R/S 04 % 05 CHS 06 LstX 07 + 08 + 09 GTO 03

Enter the inital price [R/S], then the first, second, third, ... percentage [R/S].

1000 [R/S] => 0,00   no discount yet
5 [R/S] =>   5,00   5% discount so far
10 [R/S] => 14,50    now it's 14,5%
15 [R/S] => 27,33    and finally 27,3%

[%] => 273,25   discount
[–]  => 726,75   final price

Dieter
12-23-2018, 07:45 PM
Post: #8
 SlideRule Senior Member Posts: 1,497 Joined: Dec 2013
RE: (12C Platinum) Successive Discounts
(12-23-2018 06:16 PM)Dieter Wrote:  Not recursive, but iterative.
Dieter

OK!

re·cur·sive
/rə'kərsiv/
characterized by recurrence or repetition.
MATHEMATICS
relating to or involving the repeated application of a rule, definition, or procedure to successive results.

it·er·a·tive
/'idə,rādiv/
relating to or involving iteration, especially of a mathematical or computational process.

it·er·a·tion
/idə'rāSH(ə)n/
repetition of a mathematical or computational procedure applied to the result of a previous application

BEST!
SlideRule
12-24-2018, 06:32 AM (This post was last modified: 12-24-2018 06:47 AM by Gamo.)
Post: #9
 Gamo Senior Member Posts: 756 Joined: Dec 2016
RE: (12C Platinum) Successive Discounts
The meaning between Iteration and Recursion is very interesting to find out.

So I did some searching around the web and here what they said the different and explanation.

----------------------------------------------

Iteration and Recursion are key Computer Science techniques used in creating algorithms and developing software.

In simple terms, an iterative function is one that loops to repeat some part of the code, and a recursive function is one that calls itself again to repeat the code.
Using a simple for loop to display the numbers from one to ten is an iterative process.
Examples of simple recursive processes aren't easy to find, but creating a school timetable by rearranging the lessons, or solving the Eight Queens Problem are common examples.

----------------------------------------------

The old recruiting practice says, "Never hire a developer who computes the factorial using Recursion". Recursion is often used without considering alternatives before using it.
Though it is true that recursive solution is often more elegant and easier to spot than the iterative solution, one should take care not to abuse it.
Complex Recursion that is hard to understand should probably be considered a "bad smell" in the code and a good candidate to be replaced with Iteration
(usually in combination with some other Refactorings).
Moreover, iterative solutions are usually more efficient than recursive solutions as they don't incur the overhead of the multiple method calls.

We use Recursion when we have to perform a complex task that can be broken into the several subtasks.
Recursion is implemented as a method that calls itself to solve subtasks.
During the recursive call the values of the local fields of the method are placed on the method stack until the subtask performed by a recursive call is completed.
Thus, whenever recursive method is called, local fields are put on the method stack and used again after the recursive call is completed.
The general approach to Refactoring could probably be to implement the alternative Stack that "simulates" the method stack where the local fields could be placed
(the java.util.Stack class is a good candidate for this job).

--------------------------------------------------

Gamo
12-24-2018, 11:25 AM (This post was last modified: 12-24-2018 11:32 AM by Thomas Klemm.)
Post: #10
 Thomas Klemm Senior Member Posts: 2,154 Joined: Dec 2013
RE: (12C Platinum) Successive Discounts
(12-24-2018 06:32 AM)Gamo Wrote:  … a recursive function is one that calls itself again to repeat the code.

That might also be a function ping calling a function pong and vice versa.
Or involve even more functions.

(…)

Quote:The old recruiting practice says, "Never hire a developer who computes the factorial using Recursion".

These times are fortunately over.

(…)

Quote:During the recursive call the values of the local fields of the method are placed on the method stack until the subtask performed by a recursive call is completed.

Cf. tail call and continuation-passing style.

(…)

Quote:(the java.util.Stack class is a good candidate for this job).

You don't want future generations hate you, do you?

Cheers
Thomas
12-24-2018, 12:52 PM (This post was last modified: 12-24-2018 01:31 PM by Albert Chan.)
Post: #11
 Albert Chan Senior Member Posts: 2,704 Joined: Jul 2018
RE: (12C Platinum) Successive Discounts
(12-24-2018 11:25 AM)Thomas Klemm Wrote:
(12-24-2018 06:32 AM)Gamo Wrote:  … a recursive function is one that calls itself again to repeat the code.

That might also be a function ping calling a function pong and vice versa.
Or involve even more functions.

My primepi.lua does the ping/pong/more way ...

Usage: lua primepi.lua 1e12 ==> 37607 912018

https://primes.utm.edu/howmany.html
 « Next Oldest | Next Newest »

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