File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes can someone kindly check my math... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "can someone kindly check my math..." Watch "can someone kindly check my math..." New topic
Author

can someone kindly check my math...

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

i have a friend who wants to take 10 circles with a 2" diameter and arrange them in a circle. none will overlap - each circle is tangent to 2 other circles, and they are uniformly arranged.

we want to know the diameter of the circle that would enclose all of these circles. again, the encompasing circle would be tangent to each of the smaller circles.

my logic went like this:

i drew the 10-sided polygon formed by the centerpoint of each circle. this gives me a regular polygon with each side being 2". numbering the points around, i drew a line segments from

1->7
2->6
3->5
3->10
4->9
5->8
8->10

this gives you a bunch of rectangles (6) and right triangles (8). since each interior angle of the polygon is 144, it's easy to figure out the triangles are all either 36-54-90 or 18-72-90.

using trig, i figured out various segment lengths. i calculated the length from 1->7 to be 6.16".

then using the pythagorean, the length from 1->6 is then 6.48". the circle than encompases all the little circles should be tangent to each at the point where the line extended from 1->6 crosses the outside edge. this adds 1" on each end over the length 1->6 for the diameter of the big circle.

have i made any faulty assumptions (they ARE rectangles and right-triangles, right?) or made a mistake in my math???

i'm not sure if there is an easier way to do this, but i was hoping somebody could confirm what i did...

thanks

[ January 18, 2006: Message edited by: fred rosenberger ]
[ January 18, 2006: Message edited by: fred rosenberger ]

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

I get 8.155 as the diameter of the larger circle.

I follow you up to dividing the 10-sided polygon into 10 triangles with angles 72, 72, and 36. Since each angle of a ten-sided polygon is 144, 72 comes from bisecting it and 36 fills in the remaining side of the triangle.

The rest is math on a triangle. The triangle with angles 72, 72, and 36 has a side with length 2 opposite the angle 36.

Using :
x / sin(72) = 2 / sin(36)

Leads to the triangles having side length of 3.236. You then need to bisect this triangle since you want the length from the center of the larger circle to the center of the smaller circle. Using pathagorous, sqrt(3.236^2 - 1) = 3.078. Now you just need to double this and add 2 to the diameter to measure from the center of the small circles to the edge of the outer circle.


My Blog: Down Home Country Coding with Scott Selikoff
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
I get 8.57 by a very different method. Say one circle is at 0º, and the next is at 36º. The distance between the two is 2. Letting r be the radius of the circle on which all 10 lie, we have

2² = ( r - r*cos36º )² + r²sin²36º

r = 3.236

Add one for the radius of the circles, multiply by two to turn into diameter,

d = 8.47

It's close enough to Scott's that I probably goofed somewhere
[ January 18, 2006: Message edited by: Nick George ]

I've heard it takes forever to grow a woman from the ground
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I get the same answer as Nick, arrived at independently. If you connect the centers of all the circles you get a regular 10-sided polyhedron. Each side is 2" long and subtends 1/10 of 360° relative to the center, or 36°. Draw a line from center to the midpoint of a side, and another from the center to an adjacent midpoint. Now we've got a single right triangle with angle 18° and opposite side length 1". The hypotenuse must be (1")/sin(18°) . Add another 1" for the radius of the small circle, we get the radius of the containing circle. Double that to get the diameter.

d = 2 * (1 + 1/sin(28°) ) = 8.4721...


"I'm not back." - Bill Harding, Twister
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
Originally posted by Jim Yingst:
arrived at independently



Sure Jim.

Sure.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Excuse me, I meant to say "I get the same answer as George"

Doing it myself seemed easier than reading the three separate preceding solutions.
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
Very well, Yingst, very well.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

cool. i'm going to assume my method was correct, since (although i didn't state it clearly), my final result was 8.48".

i also didn't read anyone's solution very carefully, but since we all came up within a 1/100th of an inch, i'm satisfied.

thanks!!!

and Jim, don't you mean a 10-sided polyGON? i though a polyhedron was a 3-d object...
[ January 19, 2006: Message edited by: fred rosenberger ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Yep. Polygon. Funny thing, I distinctly remember typing polyhedron, realizing it was wrong, typing polygon, then later rewording the section. Apparently I managed to revert to polyhedron again at that point.
Jon Egan
Ranch Hand

Joined: Mar 24, 2004
Posts: 83
Since I see everyone giving the others grief in this thread, I'll pile on:

Fred: You don't need to start your posts with "i have a friend who wants ...". We're all friends here. You can admit you this was really for you.

Admitting you have a problem is the first step

-- Jon
 
jQuery in Action, 2nd edition
 
subject: can someone kindly check my math...