From http://www.clarku.edu/~djoyce/trig/angle.html :
23. A balloon known to be 50 feet in diameter subtends at the eye an angle of 8 1/2 minutes. How far away is it?
Using calcagent (offline):
---
> (8.5 / 60) / 180
(8.5 / 60) / 180 = 0.000787037037037037
> that * pi
0.000787037037037037 * PI = 0.00247254977365863
> 50 / that
50 / 0.00247254977365863 = 20222.0398281467
> that / 5280
20222.0398281467 / 5280 = 3.82993178563384
Answer (from the web page):
23. The angle a is 8.5', which is 0.00247 radians. So the radius is r = l/a = 50/0.00247 = 20222' = 3.83 miles, nearly four miles.
---
9. How much does one change latitude by walking due north one mile, assuming the earth to be a sphere of radius 3956 miles?
---
> 1 / 3956
1 / 3956 = 0
> 1 / 3956.0
1 / 3956.0 = 0.000252780586450961
> (that * 180) / pi
(0.000252780586450961 * 180) / PI = 0.0144832607464819
> that * 60
0.0144832607464819 * 60 = 0.868995644788914
> that * 60
0.868995644788914 * 60 = 52.1397386873348
---
Answer:
9. Angle = 1/3956 = 0.0002528 radians = 0.01448° = 0.8690' = 52.14".
---
These examples demonstrate using calcagent to do word problems.
I can use "that" to refer to the immediately preceding calculation result.
I found it easier to use my agent than irb because things like Pi are included,
whereas I have to require the Math module in irb to use PI.
Note how I have to explicitly make one integer into a float when doing division.
I've tried to automate this in calcagent, but am having trouble reliably
detecting floats! In the second problem (#9) above, I forgot to add a ".0" to
at least one of the integers, and ended up with an integer result, so I had to
redo the calculation, adding ".0" to the final integer to get a floating point
result.
The goal is to have the bot read the word problem itself, and figure out the
equation to use (in this page, angle * radius = length), how to manipulate it
algebraically to isolate the desired variable on one side, and how to substitute
the given values for the terms in the equation. Also, the program would have
to know how to convert between degrees and radians, between feet and miles, etc.
Using the online version of calcagent, which delegates calculations and
conversions to Google's calculator:
Problem from web page:
1. Express the following angles in radians.
(a). 12 degrees, 28 minutes, that is, 12° 28'.
(b). 36° 12'.
---
> convert 12 degrees 28 minutes to radians
convert 12 degrees 28 minutes to radians? 0.21758438 radians
> convert 36 degrees 12 minutes to radians
convert 36 degrees 12 minutes to radians? 0.631809189 radians
---
Answer from web page:
1. (a). 0.2176. (b). 0.6318.
---
Problem 23 again:
23. A balloon known to be 50 feet in diameter subtends at the eye an angle of 8 1/2 minutes. How far away is it?
> convert 8 1/2 minutes to radians
convert 8 1/2 minutes to radians? 0.00247254977 radians
> 50 feet / that in miles
50 feet / 0.00247254977 radians in miles = 3.82993179 miles
Answer:
23. The angle a is 8.5', which is 0.00247 radians. So the radius is r = l/a = 50/0.00247 = 20222' = 3.83 miles, nearly four miles.
So, the answer from the web page is more complete because it shows the reasoning
behind the answer. I would like to make the bot do that. First step is to do the
math. Next, to automate the logic, so the bot performs the steps I have to
manually enter on its own after reading the problem...