Problem 42698. Why the heck are they blinking!?!?
Merry Christmas everyone! Sadly, the lights you've had on your tree for so many years burned out, and it's time to get a new set. Being a skilled (and cheap!) mathematician, you realize that you can estimate the total length of the strings of lights you'll need for your tree with two simple parameters:
 The radius of the base of the tree (in feet)
 The Number of rows of lights you want on your tree, from top to bottom.
The rows of lights are equally spaced vertically around the tree. Given these two variables, calculate how long your string of lights has to be in order to wrap around your tree. You want to buy the minimum possible length of lights, because NOBODY likes having to untangle any more lights than they have to!
Helpful hints  The answers calculated below model the lights on your tree as a twodimensional Spiral of Archimedes, so the number of rows of lights is equal to the number of times your spiral makes a full 360degree loop. The final Cartesian coordinate of your spiral should be (width, 0). If someone far smarter than I am wants to make the full threedimensional version of this problem, knock yourself out!
Solution Stats
Problem Comments

8 Comments
If the answer to this problem is L=F(w,n), the answer for a tree of height h is L=F(d,n*w/d), where d=sqrt(h^2+w^2).
It seems that the reference answer to the arc length given in the test suite is doubled. This is possibly due to the confusion on the parameter w ("the Width of the base of the tree", which literally means the diameter of the base). But the test suite seems to use w as the radius of the base; thus doubling the final answer. Am I missing something here?
Peng, you're correct. I'll blame that oversight on a bit too much Egg Nog, and change the problem description.
Tim, does the fact that the spiral is also travelling in the Zdirection change the length? Is there a distortion due to the 3D nature of the spiral? I honestly don't know, which is why I added the helpful hint; in case someone could answer that, did the full 3D calculation, and came up with a more correct answer. If the length of the 2D spiral is equal to the 3D one, then your equation is correct; that's actually how I calculated it originally before realizing that I could just use the base of the tree as a variable instead of both the height and base. Does anyone who can actually do this sort of calculation want to chime in here?
Yes, the height does increase the length. For example, w=4 n=5 h=0 gives L=63.1273, while w=4 n=5 h=8 gives L=64.0530. The formulas I used were r=w*t/(2*n*pi), x=r*cos(t), y=r*sin(t), and z=h*(1t/(2*n*pi)), and then L is the integral of sqrt(dxdt^2+dydt^2+dzdt^2)*dt from 0 to 2*n*pi.
Got the same results as Tim. My tree was upside down: γ=2∙π∙n, x(θ)=w/γ∙θ∙cos(θ), y(θ)=w/γ∙θ∙sin(θ), z(θ)=h/γ∙θ, L=∫̥ᵞ √(x’²+y’²+z’²)dθ. Anyway, h→∞≡L→∞, proves that h matters.
I wasn't really sure how to model the zcoordinate as a function of height. I had a hunch it would be the case, but I couldn't actually figure out how to do it. Thanks to the smart people in the thread for coming up with the equations for it!
The problem description should mention that the spiral starts at (0,0).
Solution Comments
Show commentsProblem Recent Solvers24
Suggested Problems

2495 Solvers

Replace NaNs with the number that appears to its left in the row.
2967 Solvers

Increment a number, given its digits
643 Solvers

765 Solvers

144 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!