Here's the problem that got me stuck for ages:
My friend owns a roller shade company and he need to make boxes for them. He makes the barrels himself and they come in various diameters. Now he has to roll a shade of length L onto in and after each turn, the total diameter increases exponentially (because it is a spiral and spirals grow exponentially, not linearly). Then we can obtain the total diameter of the barrel and the shade rolled onto. Once we have that, we can order boxes of correct dimensions.
Here is a picture of the situation:

Now, the only way i tried to solve this problem is by rolling and counting the number of turns made first.
So lets denote:
Length of shade: L
Width of shade: W
Thickness of shade: h
diameter of barrel : D
3.1412 : pi
n = number of rolls
Now lets roll the first turn: we can do that by subtracting the circumference of the diameter++ from the sheet of shade.
n = 1 => So 1st turn: [L - pi(D)] cm left to roll onto
n = 2 => 2nd turn: [(L - pi(D)) - pi(D+h)]
<=> [(L - pi(2D + h)] cm left to roll onto. pi(D+h) means that the new circumference has increased by the thickness of the shade, which also varies in size.
n = 3 => 3rd turn: [(L - pi(D)) - pi(D+h) - pi(D+2h)]
<=> [(L - pi(D)) - pi((D+h) + (D+2h))]
<=> [(L - pi(D)) - pi(2D + 3h)]
<=> [(L - pi(3D + 3h)] cm left to roll onto.
n = 4 => 4th turn yields: [L - pi(4D + 6h)] cm left to roll onto
n = 5 => 5th roll yields: [L - pi(5D+10h)] cm left to roll onto
n = 6 => 6th roll yields: [L - pi(6D + 15h)] cm left to roll onto
... nth roll
So for n>1 rolls:
We can observe a pattern. If we look at the last digit in each equation, we see 1, 3, 6, 10, 15, ...
And this pattern is best described as triangular numbers: http://en.wikipedia.org/wiki/Triangular_numbers
So we can actually write a program that can generate a list/range of numbers from
2 -> m # {2,3,4,5,......,(m-1)}, lets call this list m
then we create a regular list starting from 1 -> p # {1,2,3,4,.........,p}, lets call this list p
Assume m and p are natural numbers. Then we add each number in a specific way:
for i in range(0,m):
p[i+1] = p[i] + m[i]
Then list p will have elements: {1,3,6,10,15,...}
and save it in an ordered list named Q. Then, if we can start with our base case, n = 1, we can substitute each number from this ordered list to the last digit in our n+1 equation corresponding to the proper index. So we will have an ordered list Q of triangular numbers. That would solve the problem creating the pattern.
Now for the coefficient of D, we can see a similar pattern but it seems to be related to the number of rolls. So for every new equation for (n+1) turns, we can form a formula:
Assume that n > 0:
Length remaining to roll =
if n = 1, [ ( L - pi( (n)D ) ]
else if n > 1, [ ( L - pi( (n)D + Q[n-2]*h ) ) ]
Q[n-2] indicates the index of the element in Q
So now we have a general formula to calculate the number of turns possible given a length of a shade and the diameter of the barrel. We dont care much about the width of the barrel and shade as it does not affect our calculations.
Now since we can predict the length of any nth roll, we can write some code to check if the length remaining is smaller than the length required for the next (n+1) roll and if it is smaller, we can stop there and return 'N', the number of rolls possible.
We now have the number of turns possible but I still cannot find a way to find the diameter at that Nth point. I am still working on it but if anyone has any hints, please let me know, that would be great!
I hope you enjoyed this problem as much as I did.
2 comments:
I guess I'm surprised the diameter increases exponentially. I'll need to think about it a bit.
Well, by exponentially, I mean that it does not increase linearly as if a drop of ink spreads uniformly on a piece of paper where all sides expand at the same rate.
I tried using soft iron-core wire and wound it around a piece of metal. I found that after 1.5 turns,the radius of one side is bigger than the radius of the other side. So i was trying to find a relationship between them, n=but I still can't find one... :(
Post a Comment