Re: [Haskell-cafe] Geometry
Steve Schafer wrote: x = a - sqrt(a^2 - b^2) I don't know offhand if there's a straightforward way to arrive at this result without using trigonometry. Here you go, though with a slightly different result (same as Joel Koerwer): a^2=(b^2)/4+(a-x)^2 (Pythagoras) solving x: -- x(1,2) = a +/- sqrt (a^2 - b^2/4) (I) Did anyone compare the answers? (I) aai a b = (x1,x2) where x1 = a + sqrt disc x2 = a - sqrt disc disc = a^2-b^2/4 Others: schafer a b = a - sqrt(a^2 - b^2) jedaï a b = a * (1 - cos (b/(2*a))) stefan a b = a - a * sqrt (1 - b*b / a*a) joel a b = a - sqrt (a*a - b*b/4) Assume a and b are given: a=10; b=8 Results: *Main aai 10 8 (19.165151389911678,0.8348486100883203) the answer is the smaller value the other value = the diameter of the circumference minus x (0.00 secs, 523308 bytes) *Main schafer 10 8 4.0 (0.01 secs, 524924 bytes) *Main jedaï 10 8 0.789390059971149 (0.01 secs, 524896 bytes) *Main stefan 10 8 NaN (0.00 secs, 524896 bytes) *Main stefan 10 8 4.0 (0.01 secs, 524896 bytes) *Main joel 10 8 0.8348486100883203 (0.01 secs, 524896 bytes) Where do I go wrong (I)? Thanks @@i ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
Correction stefan a b = a - a * sqrt (1 - b*b / a*a) should be: stefan a b = a - a * sqrt (1 - b*b / (a*a)) *Main stefan 10 8 4.0 (0.01 secs, 524896 bytes) Thanks @@i ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
On Mon, 27 Aug 2007 19:05:06 +0200, you wrote: Where do I go wrong (I)? b is defined to be _half_ of the chord (the semichord, I suppose). You're assuming it to be the entire chord. Steve Schafer Fenestra Technologies Corp. http://www.fenestra.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
2007/8/27, Steve Schafer [EMAIL PROTECTED]: b is defined to be _half_ of the chord (the semichord, I suppose). You're assuming it to be the entire chord. Based on the drawing I thought it was the length of the arc (in blue) ? -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
The author of the question (Tony Morris) actually asked two different questions, and so people gave two different replies :) To quote Tony: "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." So, the solution to the drawing, where a is the radius and b is the arc: x = a * (1 - cos(b/2a)) (because cosine = adjacent / hypotenuse) The solution to the textual question, where a is the radius and b is the distance between the two points on the circumference: (a-x)2 + (b/2)2 = a2 = x2 - 2ax + a2 + (b/2)2 = a2 = x2 - 2ax + (b/2)2 = 0 = x = a sqrt(4a2 - b2) / 2 (solution to quadratic) = x = a - sqrt(a2 - b2/4) (move /2 into sqrt, and can't be +sqrt because that would make x greater than a) So in Haskell sol1 a b = a * (1 - cos (b / (2*a))) sol2 a b = a - sqrt (a*a - (b*b)/4) Cheers, Peter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Geometry
-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 Thanks for any tips or keywords with which to google! - -- Tony Morris http://tmorris.net/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG0iM6mnpgrYe6r60RAqfDAJ4gFAdr7zP1ehLl8H2MaCzCNfAvhQCgmL8D 4nrxrK13O9EBNv/ojPIMJXI= =eaxX -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
Hi Tony, x is called the sagitta. At least when making a telescope mirror it is[1]. By bisecting your angle with another radius, you'll see that you have a right triangle with hypotenuse a, and legs of length (b/2) and (a-x). Then sagitta a b = a - sqrt (a*a - b*b/4) Considered as a function of half the angle subtended by the points on the circumference, this is called the versine. http://en.wikipedia.org/wiki/Versine [1] http://www.stellafane.com/atm/atm_grind/atm_measure_sag.htm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
You've got a which is the radius of the circle, and b which is the length of the arc, thus you've got the angle between the two red radiuses : u = b / a So with basic trigonometry, we can deduce a - x = a * cos(u/2) x = a *( cos(u/2) - 1) -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
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 signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
2007/8/27, Chaddaï Fouché [EMAIL PROTECTED]: You've got a which is the radius of the circle, and b which is the length of the arc, thus you've got the angle between the two red radiuses : u = b / a So with basic trigonometry, we can deduce a - x = a * cos(u/2) x = a *( cos(u/2) - 1) -- Jedaï Actually that would be x = a * (1 - cos (b/(2a))) Ooops o_O -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
On Mon, 27 Aug 2007 11:04:58 +1000, you 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 Thanks for any tips or keywords with which to google! So a is the radius of the circle, and b is half the length of the chord. From basic trigonometry: b = a * sin @ where @ is half of the angle between the two radii as drawn in the picture. Then: x = a * (1 - cos @) Using the trigonometric identity sin^2 @ + cos^2 @ = 1 and rearranging, we get: x = a - sqrt(a^2 - b^2) I don't know offhand if there's a straightforward way to arrive at this result without using trigonometry. By the way, I found http://www.1728.com/circsect.htm by Googling height chord. Steve Schafer Fenestra Technologies Corp. http://www.fenestra.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Geometry
On Sun, 26 Aug 2007 21:30:30 -0400, you wrote: I don't know offhand if there's a straightforward way to arrive at this result without using trigonometry. Duh. Of course there is Steve Schafer Fenestra Technologies Corp. http://www.fenestra.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe