[Haskell-cafe] Geometry
Stefan O'Rear
stefanor at cox.net
Sun Aug 26 21:24:19 EDT 2007
On Mon, Aug 27, 2007 at 11:04:58AM +1000, Tony Morris wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I went camping on the weekend and a friend of mine who is a builder
> asked me many questions on geometry as they apply to his every day work
> - - most of which I could answer.
>
> However, there was one that I couldn't and I am having trouble googling
> a solution (for lack of keywords?). I'm hoping a fellow Haskeller could
> help me out (in Haskell of course).
>
> The problem is finding the unknown x from the two knowns a and b in the
> given image below (excuse my Microsoft Paintbrush skills). I may have
> misunderstood his problem (we were drawing in dirt) and actually, it is
> the straight line between the two points on the circumference that are
> known and not the specified 'b', but I figure I could derive one
> solution from another if I have misunderstood him.
>
> Here is my image:
> http://tinyurl.com/2kgsjy
This is a fairly simple exercise in trigonometry. Call the angle
subtended by b, θ. Then:
b = a sin(θ/2)
a - x = a cos(θ/2)
by the relation between circles and trig functions. From this we can
(algebraicly) derive:
sin(θ/2) = b / a
x = a - a cos(θ/2)
x = a - a (1 - b² / a²)^½ (nb, I'm assuming θ is less than 180° here)
And as you request:
problem a b = a - a * sqrt (1 - b*b / a*a)
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070826/da84ba78/attachment.bin
More information about the Haskell-Cafe
mailing list