My results are all different, although the formula gets the right result in all the simple cases like hs=H/2; ha=H/2; xs=0; xa=0; etc...
I’m checking my solution…
I updated the test suites. I made a mistake in using full diameter instead of the semicircle's diameter. I also added a clarification to ensure only one option is considered.,
With regards to your solution. I think that your algorithm will work only if both the ant and spider are in the same side. Please take note that the ant is inside and the spider is outside. Please try again. Thanks.
The dotted line doesn't show it, but presumably the spider has to go up, over the top edge of the can, and down again. Also it can presumably choose whether to go clockwise or counterclockwise.
Hi William, I've included one solution into the problem itself. I hope this clarifies everything. Of course the circumference will not change. But if you would not consider inside/outside, the insects will appear to be closer together, and you will be get shorter distance than the correct one.
Try to imagine that the can is a sngle piece of paper folded in half and after which the edges perpendicular to the fold are joined together to form a cylinder.
Yes, that is exactly how I was imagining it, and I think my solution correctly computes the result for that situation. But unfortunately it only agrees with your numbers in the case of problem 1 (for which hs=ha and xs=xa).
William, you've corrected your net height after considering the spider/ant are outside/inside. That means viewing it flat, you have now one correct triangle side. You also need to adjust the other triangle side, again considering inside/outside.
Sorry, but I think it is incorrect to change the other side. The circumferential distance does not change as a result of inside/outside.
That solution has an error. In the equations for wa and ws, you should not be dividing by 2*pi.
Your right. Thanks so much...
I think that your algorithm will work only if both the ant and spider are in the same side. Please take note that the ant is inside and the spider is outside. For example, your formula for the net height is H - hs - ha. This is correct if they are on the same side. The correct net height should be: H - hs + ha. Thanks.
Make the vector [1 2 3 4 5 6 7 8 9 10]
Are you in or are you out?
Math with Roman Numerals
Community Problem 500!
Easy Sequences 42: Areas of Non-constructible Polygons
Easy Sequences 17: Mu Variant Function
Easy Sequences 37: Natural Factorable Polynomials
Easy Sequences 20: Counting Prime-sided Rectangles
Easy Sequences 47: Boxes with Prime Edges
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office