Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 460

What is the equation?

Person B removes 2 cups of water from Bucket A and pours it into Bucket B (holds 10 cups)
Person A pours 4 cups of water into Bucket A (holds 6 cups)

In this scenario, Bucket A would fill up in 2 seconds.  I would like to know if there is an equation that would apply to this scenario.
dia.png
0
TechOcean
• 3
• 3
• 2
• +2
3 Solutions

Commented:
The answer depends on whether A and B can work simultaneously or must work serially.
0

Commented:
If simultaneous then
B = 2*t               where B = size of bucket B and t is the desired time
then
t = B/2
-
If A is initally half you have to add 1/2 second to get the initial b person cup filled so equation would be
B = 2*t + 1/2
0

Commented:
>   "In this scenario, Bucket A would fill up in 2 seconds."

I think it's 3 seconds.

Let's say:
Bucket A = BA                         = 6 cups
Person A = PA                         = 4 cups
Person B = PB                         = 2 cups
Time = T                                  = ? sec

BA = (PA - PB) * T
6 = (4 - 2) * T
2T = 6
T = 3 sec

Because at:
Sec   Bucket A
1           2                        (Person A put 4 and Person B removes 2) Total remaining 2
2           2                        (Person A put 4 and Person B removes 2) Total remaining 4
3           2                        (Person A put 4 and Person B removes 2) Total remaining 6

Bucket A = BA                         = ?
Person A = PA                         = 4
Person B = PB                         = 2
Time = T                                  = 4

BA = (PA - PB) * T
BA = 8 cups

Bucket A = BA                         = 6
Person A = PA                         = ?
Person B = PB                         = 2
Time = T                                  = 4

BA = (PA - PB) * T
6 = 4*PA - 8
PA = 14 / 4
PA = 3.5 cups
0

Author Commented:
Bucket A would fill up in 2 seconds because Person B removes 2 cups of water before Person A adds 4 cups of water.

Also the scenario is an example of when incoming rate is faster than outgoing rate for Bucket A.  Therefore, the equation only tells me the sustainability time for Bucket A and not sustainability overall.  What about when the incoming rate is slower or equal to outgoing rate?  Where does Bucket B fit into the equation?
0

Commented:
How many cups are in A at the beginning?
(If 0, how can B remove 2 cups before A adds 4?)
0

Author Commented:
Initially Person B would remove 0 cups out of Bucket A.
0

Commented:
IF one is concerned with the time of filling bucket A AND the action takes place at the end of a second THEN if A is the number of cups per second for person A and B is the number of cups per second for person B and  S is the size of bucket A THEN the time t to fill bucket a is

S = At - Bt           or
t = S/(A - B)

If any of the conditions at the start of this answer are not met, you MUST discribe the different condition exactly.
0

Author Commented:
Scenario 1 (incoming rate>outgoing rate):
For every second Person B transfers 2 cups of water from Bucket A (holds up to 6 cups) to Bucket B (holds up to 10 cups) when there is water in Bucket A.  After Person B, Person A fills Bucket A with 4 cups of water.

Scenario 2 (incoming rate<=outgoing rate):
For every second Person B transfers 4 cups of water from Bucket A (holds up to 6 cups) to Bucket B (holds up to 10 cups) when there is water in Bucket A.  After Person B, Person A fills Bucket A with 2 cups of water.

Neither buckets can overflow and Person B always executes before Person A.  Numbers above are sample values to make it easier to come up with the equation.  Your variables are incoming and outgoing transfer rates, bucket sizes and sustainability time.

What is the equation that can be derived from both scenarios to predict how long Person A can keep pouring water into Bucket A before one of the buckets overflows?
0

Commented:
3           2                        (Person A put 4 and Person B removes 2) Total remaining 6

This makes no sense at all. For person B to take 2 out to get to 6 there would have been 8 in A. A would fill in 2 seconds as the asker originally guessed.

Also, the question specifically states that the events are sequential, so the discussion about simultaneousness and order is moot. I guess the question would still remain about what happens when B tries to take water from an empty A, but I feel it's safe to assume that he just waits.

Using aburr's variables.
The equation needs to take into account that A is filled before water is taken out. So the max amount in A at each second is A + (A-B)t (where in this example A=4 and B=2)
We are concerned with the max amount during each second since A does in fact fill before B can take more out.

So
S = A + (A-B)t
t = (S-A)/(A-B) rounded up to the nearest integer since it is a discrete number of steps. In the example given it happens to come out as an integer, but if bucket A held 7 cups it would fill in 3 seconds not 2.5
0

Commented:
In the 'Scenario 2' that you just posted, every time B goes to take water out of A, there will only be 2 cups in A. Using the same sequence (of B moving first) then A will always be filled and emptied every step and B will only get two cups. Since in the first second, B doesn't get any water (since B moves first and both start empty), It would take 6 seconds to fill B.
The equation in this scenario would be Sb = 1 + max(A,B)t
So B would fill when t = (Sb - 1)/max(A,B) again rounded up.

So for the generic problem when you don't know if A>B or not the equation for when one would fill would just be
t = min( ceiling( (S-A)/(A-B) ) , ceiling( t = (Sb - 1)/max(A,B) ))
Where ceiling means 'round up to nearest integer'
0

Featured Post

• 3
• 3
• 2
• +2
Tackle projects and never again get stuck behind a technical roadblock.