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 Anybody for Geometry ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Anybody for Geometry ?" Watch "Anybody for Geometry ?" New topic
Author

Anybody for Geometry ?

Peter Chang
Greenhorn

Joined: May 06, 2003
Posts: 18
A certain city has a circular wall around it.
The wall has four gates pointing north, south, east and west.
A flag-post stands outside the city, three kms north of the north gate,
and it can just be seen from a point nine kms east of the South Gate.
What is the diameter of the wall that surrounds the city?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Dammit, HTML denied. I have an answer, but I'll wait for others.
[ January 27, 2005: Message edited by: David O'Meara ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

My answer is more than 10 and less than 50
Peter van de Riet
Ranch Hand

Joined: Apr 09, 2004
Posts: 112


a point nine kms east of the South Gate.


Is this right?
[ January 27, 2005: Message edited by: Peter van de Riet ]

Each number system has exactly 10 different digits.
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Pretty easy to solve if you give me options

Is the answer 9 ?

I just checked for the closest number satisfying the Pythagoras:
(3+x)square + (9)square = (Hypotenuse)square

[12*12 + 9*9 = 15*15]


- Varun
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Nope, you need a difference of 6, not 3...
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

What about a general solution for distance 'a' from the north gate, 'b' from the east gate?
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Originally posted by David O'Meara:
Nope, you need a difference of 6, not 3...


why?
[ January 27, 2005: Message edited by: K Varun ]
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Originally posted by David O'Meara:
What about a general solution for distance 'a' from the north gate, 'b' from the east gate?


Well i remmeber there use to be some equation for tangents meeting at some external point, dont remember it now ..
Also tangents from a same point to a circle are always equal ...

but not sure wht pythagoras wont work here. I just feel 9 should be an answer.

Wats ur reasoning ?
[ January 27, 2005: Message edited by: K Varun ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I can tell you're still imagining the curve of the wall. I was able to come up with an answer fairly quickly once I drew it and recognised the trick. It's all about where you put the circle
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Originally posted by K Varun:


why?

[ January 27, 2005: Message edited by: K Varun ]


Attempted ascii art:


Hopefully you'll see that the answer is x^2 = (r+3)^2 + (r+9)^2
ie the two sides have a difference of 6.
Also notice that you need to find r, not the lengths of the sides, and you need to find some way to define x to solve the equation...
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400


Here is how my diagram would be.
CB and CA are tangents to the circle. CA will just hit the circle somewhere around K

ABC is a right angled triangle, with B=90 degrees.

Now if you agree that B should be the south gate, you can see your diagram isn't satisfying the condition "it can just be seen from a point nine kms east of the South Gate"
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Originally posted by K Varun:
[QBit can just be seen from a point nine kms east of the South Gate[/QB]


Yes, but based on the elegant slution, I hope this is a typo. Still waiting on a response from the original poster.

Although I'm pretty sure I have a solution to your case, I just haven't solved for the final answer.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Well, since no one else is taking part, I'll drop my answer to the first and second types.

The first is the quetion as I drew it, assuming there is a typo in the question. Obviously the problem forms a triangle, from the center of town to the two flag poles. Less obvious, since it is right-angle triangle you can draw a circle containing these three points on its circumference, then the three sides must be (r+3), (r+9) and (2r). Solving a^2 + b^2 = c^2 for r gives two solutions, -3 and 15. I chose r=15.

To solve the second case, imagine it as the first case, using (r+m) (for some number m) instead of (r+9), then use similar triangles to remove m and solve for r. It should be solvable, but ends up with a fourth-order quadratic equation. No thanks.
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
eh just tried to google and here you go
9 is the answer.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
I've just come back from a teabreak after working out the answer 9. Why did you have to give a link?

Ok I have not look at the link yet, so I'll tell you how I did it anyway.

I found an angle for which I could write its tangent in two ways using the radius of the city as the unknown variable. I got it around to a simple cubic equation which I solved by guessing at a few possible roots. r = 4.5 solves it. So the diameter of the city is 9.

OK now I'll take a look at the link.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
They used Pythagoras to get a quartic?

With my approach you end up with a much simpler:

r * r * ( 2 * r + 3 ) = 243

for which 9 / 2 is the solution.
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
What did the seed say when it grew up?

Gee, I'm a tree!


I've heard it takes forever to grow a woman from the ground
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anybody for Geometry ?