This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programming Diversions and the fly likes A puzzle for trigonometry fans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "A puzzle for trigonometry fans" Watch "A puzzle for trigonometry fans" New topic
Author

A puzzle for trigonometry fans

Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
There is a circle of grass with the radius R. We want to let a sheep eat the grass from that circle by attaching the sheep's leash on the edge of the circle. What must be the length of the leash for the sheep to eat exactly half of the grass?
(I am gettin back to work now )

The Rancher Formerly Known As Nanhesru Ningyake.
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
What? No takers?
Eager Beaver
Ranch Hand

Joined: Feb 26, 2001
Posts: 187
Nan,
Can there be multiple leashes tied to the sheep from diff points on the periphery.
Suma MM
Ranch Hand

Joined: Apr 30, 2001
Posts: 31
That was a real good one.......
I hope i don't prove myself to be one of those who need "trigonometry for dummies"!!
Is the answer [sqrt(pi square + 4)]*[(R/2)] ?!?!?!
[YES!! Typing the answer expression did take more time than evaluating it! And it did remind me of those 'first programming days' of mine when the prof had given a bunch of expressions on the exam and had asked us to write their "program-equivalents"!]
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
EB, there's only one leash, and that's tied to the edge of the circle. In the diagram below, you will need to determine L based on R.
<pre><big>
------o
/ | \
/ | \
/ | \
| R |L |
|--------o | |
| | |
\ �mmm~ /
\ /\/\ /
\ /
------</pre></big>
Suma, I'm afraid your answer is not correct. This is one of those looks easy but fairly difficult to solve problems
You are right about your answer: I had almost forgotten those math expression to "program-equivalent" conversion exercises back in school!

[This message has been edited by Nanjangud Nanjundaiah (edited June 29, 2001).]
Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
Let L denote the length of the leash.
Let O be the center of the grass circle, and Q the location where the leash is fastened.
Let P and P' be the two points on the circumference of the grass circle at distance L from Q.
Let B denote the measure of angle PQO in radians,
and (C = pi - 2B) the measure of POQ.
Because PQO is isosceles, we have L = 2 R cos B.
The pie-shaped region emanating from O and reaching from P to P' has area (1/2) R2 (2C) = R2 C.
The pie-shaped region emanating from Q and reaching from P to P' has area L2 B.
Together these regions cover the sheep's eating area, but they both cover the quadrangle OPQP', so we must subtract its area,
2 ( (1/2) R L sin B) = R L sin B.
We obtain
(R2 C) + (L2 B) - R L sin B = (1/2) pi R2,
from which
(R2 (pi - 2B))+(4 R2 B cos2 B)-(2 R2 sin B cos B) = (1/2) pi R2,
or
pi - 2B + 4 B cos2 B - 2 sin B cos B = pi/2.
We solve this numerically for B, and obtain
B = 0.952848, C = 1.235897, L=1.158728R.
Suma MM
Ranch Hand

Joined: Apr 30, 2001
Posts: 31
Originally posted by Nanjangud Nanjundaiah:
EB, there's only one leash, and that's tied to the edge of the circle. In the diagram below, you will need to determine L based on R.
<pre><big>
------o
/ | \
/ | \
/ | \
| R |L |
|--------o | |
| | |
\ �mmm~ /
\ /\/\ /
\ /
------</pre></big>
Suma, I'm afraid your answer is not correct. This is one of those looks easy but fairly difficult to solve problems
You are right about your answer: I had almost forgotten those math expression to "program-equivalent" conversion exercises back in school!

[This message has been edited by Nanjangud Nanjundaiah (edited June 29, 2001).]

Yes, I did realize (a couple of minutes after posting the answer) that I went wrong coz I had made an assumption "Sectors are triangles, sometimes atleast, atleast when I need them that way!"
Suma MM
Ranch Hand

Joined: Apr 30, 2001
Posts: 31
Originally posted by Mak Bhandari:
Together these regions cover the sheep's eating area, but they both cover the quadrangle OPQP', so we must subtract its area,

Ur solution was really good....
Could u elaborate on the above point? Because I have a doubt if the 2 semi-circles (rather, 'semi-circlish' regions)- one covered by the chord QP and the circle itself and the other covered by the chord QP' and the circle itself were taken into consideration while accounting for the "sheep's total eating area"???
Thanks!
Sahir Shibley
Ranch Hand

Joined: Apr 08, 2000
Posts: 275

^l'kllw'{opurlyz'kv'uv{'zll'{opz'wyvislt'hz'h'ylhs'johsslunl
^o?'kvu{'?v|'{y?'{v'wvz{'zvtl'{opun'tvyl'johsslunpun'{ohu'{opz
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
Hey Mak, is it just pure coincidence that your solution matches word-to-word with the page where it's been posted?
Sahir Shibley
Ranch Hand

Joined: Apr 08, 2000
Posts: 275
`v|'wlvwsl'shjr'vypnpuhsp{?'z{w'[y?'iylhrpun'{opz
[This message has been edited by Sahir Shibley (edited June 29, 2001).]
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
Sahir, is that something to be deciphered?!
Sahir Shibley
Ranch Hand

Joined: Apr 08, 2000
Posts: 275

[opz'jhu'vus?'il'kljpwolylk'i?'{ol'mvssv~lyz'vm'Jovun
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
hz'p{'xy?'P{'z|zwpjpvu'[y?'?v|'hyl
(This is called hypocrisy )
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4442
    
    5

Cracked it! well, almost there... see output for offset = -7


Junilu - [How to Ask Questions] [How to Answer Questions]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4442
    
    5

Re the solution given: seems to me there is one flaw in the logic, which was clearly made by someone who has never been around sheep. If the leash is tied around the sheep's neck, then you should take into consideration the distance between the point where the leash is tied and the sheep's mouth. And if you really want to be a stickler for details, you should also consider the length of the sheep's tongue. The sheep's mouth is the working end, not the sheep's neck!
Ok, I'm just being a d*ck. So, sue me
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Well Junilu, if you're going to bring reality into this then I prefer the followiing solution (shamelessly stolen from the link NN gave):
Impossible. Even if we ignore the possibility of extraterrestrial causes of crop circles, the circle of grass can only have arisen because of an irrigation device which pivots in the center of the circle. The sheep (being a stupid animal) will get tangled up in the irrigation mechanism, and will never finish eating his half of the grass.

"I'm not back." - Bill Harding, Twister
Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
I was within a fraction of cracking this but was missing out on one point.. then i searched the net and found the solution.. since nobody was posting here, i thought i'd post the solution from that page since it was explained so nicely..
not claiming any credit for the words..
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
Mak, it would have been nice if your explanation had accompanied your original post.
Anyway, here's another puzzle:
On the occasion of the Hindu festival of Durga Pooja, Byomkesh Bakshi's mom had made some delicious roshogollas. Now those of you who've eaten these yummy sweetmeats know that these are solid and spherical in shape. After the family had dinner on their mahogany table that night, mommy forgot to keep the bowl of remaining roshogollas back in the fridge.
Now their mansion was in the woods, with plenty of bugs creeping around. Late in the night, when everyone was sleeping, one enterprising worm climbed up the table, headed straight for the roshogolla bowl. It chose one particularly fat roshogolla, and started eating it, making a cylindrical hole right through the center.
Now in the morning, Byomkesh (who's a smart detective) woke up early, walked into the dining room, and was aghast seeing this roshogolla with a hole in it. Being a math enthusiast, he took a tape and measured the length of the hole. It was exactly 4cm. He smiled to himself, and wondered what was the volume remaining... and with some clever math, found it! Then he proceeded to eat that roshogolla.
So, dear rancher, can you tell me how many cubic centimeters of roshogolla did Byomkesh eat? (He had to see a doctor after that, but that is an irrelevant detail).

[This message has been edited by Nanjangud Nanjundaiah (edited June 30, 2001).]
Peter Lyons
Ranch Hand

Joined: Sep 12, 2000
Posts: 202
I believe you need to give us the diameter of the hole, not just the length.
Sahir Shibley
Ranch Hand

Joined: Apr 08, 2000
Posts: 275

Senor Nanjangud,
I hope you realise that there are various possible radii for the globe depending on the thickness of the worm. Once you provide a diameter for the hole then it becomes quite easy to get the radius of the globe.
Eg: if l is half the length of the hole and w is half the diameter of the hole then the radius of the globe r
can be obtained by
r<sup>2</sup> = l<sup>2</sup> + w<sup>2</sup>
[This message has been edited by Sahir Shibley (edited July 02, 2001).]
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
All unnecessary information has been omitted
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Since he got sick afterwards, that means the worm must have still been in the roshogolla. Given that the length (diameter) of the roshogolla was 4, he consumed 4/3 * pi * (2)^3 and some worm to go with it. That equates to 32/3 * pi
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Kristy McClure
Greenhorn

Joined: Jun 19, 2001
Posts: 13
I think the most expedient solution is to fence off half the circle and let the sheep run free


pardon me, but you've obviously mistaken me for someone who gives a damn...
Sahir Shibley
Ranch Hand

Joined: Apr 08, 2000
Posts: 275
Originally posted by Mister Math:
Since he got sick afterwards, that means the worm must have still been in the roshogolla. Given that the length (diameter) of the roshogolla was 4, he consumed 4/3 * pi * (2)^3 and some worm to go with it. That equates to 32/3 * pi

That must have been a mighty thin worm to leave a hole equal in length to the diameter of the globe. Since that was a zero gauge worm we cant be sure if the hole exists or not.
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
Originally posted by Mister Math:
Given that the length (diameter) of the roshogolla was 4

The diameter of the roshogolla is not known... so it could hypothetically be as big as Earth
Also remember drilling a hole thru a roshogolla takes the caps off, and makes the length of the hole not equal to the diameter:<pre><big>
------- ---
/ | | \ ^
/ | | \ |
/ | | \ |
| | | | |
| | | | 4 cm
| | | | |
\ | | / |
\ | | / |
\ | | / v
------- ---
</pre></big>
But you and Sahir are pretty close to the correct reasoning just proceed along the same lines! And FYI, the worm was not in that roshogolla when Byomkesh ate it

[This message has been edited by Nanjangud Nanjundaiah (edited July 02, 2001).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
in otherwords, give our answer in terms of the radius of the worm?
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
Mister Math, let me be more clear: The answer you gave is correct - it is 32/3 * pi. Now if you can only explain in better words how you got there (Sahir has the clue in his post!)
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Well, worms don't really eat meat do they? So it must have been an imaginary worm.
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
Sweetmeats don't contain meat. This is a vegetarian math puzzle
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The only good explanation I can give is...42.
Nanjangud Nanjundaiah
Ranch Hand

Joined: May 15, 2001
Posts: 186
Whaddya mean 42, Monsieur Math?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
please can someone help me solve for the equation
for B step by step? I understand the solution but
just couldnt solve for B. Thx
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
*BUMP*
Stu Glassman
Ranch Hand

Joined: Jul 01, 2002
Posts: 91
Firstly, 6 * 9 = 42
Now, what do you mean by half of the roshogolla? If it's by mass, then we need to account for clumps of large mass (in the case of a rasin roshogolla), or are we assuming uniform mass distribution?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
{Now, what do you mean by half of the roshogolla? If it's by mass, then we need to account for clumps of large mass (in the case of a rasin roshogolla), or are we assuming uniform mass distribution?}
No self respecting roshogolla will have raisins in it.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
please can someone help me solve for the equation
for B step by step?

I guess you're talking about Mak Bhandari's post from over a year ago? When he says
We solve this numerically for B
that means he's using numeric methods to solve. It basically means he's using a program which guesses numbers for the solution and keeps guessing until it's close enough to stop. Writing such programs is a complex topic in general, worth some study. Search for "numerical methods" and specifically "root finding". A good simple starting point is the bisection method, which is implemented in JavaScript (!) here. Enjoy...
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Would there be any lady sheep possible in this problem?


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

Joined: Nov 22, 2008
Posts: 18944
R. Let the sheep eat half of the grass and then take it to another place
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A puzzle for trigonometry fans
 
Similar Threads
WA #1.....word association
Generic Types extending Abstract implementing Interface
puzzled by this question
Generics - how to make a Sheep eat Grass
S&K Book Chapter 7 question 10