The Buzzard Posted April 27, 2010 Posted April 27, 2010 Hi everyone, I was trying to solve a right triangle earlier, But I found some problems that developed which I think was due to precision. I gave up on that thought and am now trying to solve this problem as shown below using an Isosceles Triangle. I found a formula for this which looked easy, But gave me odd results. I am not sure if I am using it correctly. Can someone please explain this formula? Quote
Lee Mac Posted April 27, 2010 Posted April 27, 2010 Buzzard, You would use Pythagoras Thm, think of the triangle as two right angled triangles and solve for the side you need Pythagoras: a^2 = b^2 + c^2 Here, 'L' is the hypotenuse, 'A' is one side, and '(B/2)' is the other, hence: L^2 = A^2 + (B/2)^2 ==> A^2 = L^2 - (B/2)^2 Quote
alanjt Posted April 27, 2010 Posted April 27, 2010 (defun test (b c) (sqrt (- (* c c) (* b b)))) Quote
The Buzzard Posted April 27, 2010 Author Posted April 27, 2010 Thanks Lee, I am trying to find the length of A. The formula you are showing in my case would be written like this? a^2 = b^2 + L^2 Just trying to confirm this since I have been seeing many different letters used and it gets confusing. Quote
Lee Mac Posted April 27, 2010 Posted April 27, 2010 Hi Buzzard, check my post - it should show an example, I edited it Quote
alanjt Posted April 27, 2010 Posted April 27, 2010 (defun test (b c) (sqrt (- (* c c) (* (/ b 2.) (/ b 2.))))) Quote
The Buzzard Posted April 27, 2010 Author Posted April 27, 2010 When you refer to the value of B, Is that 7.6916^2 or 15.3832^2. Either way I calculate it, It comes out very large. I would think the answer should be 15.3814. Quote
The Buzzard Posted April 27, 2010 Author Posted April 27, 2010 (defun test (b c) (sqrt (- (* c c) (* (/ b 2.) (/ b 2.))))) alanjt, What is the period after the 2 for? Quote
alanjt Posted April 27, 2010 Posted April 27, 2010 alanjt, What is the period after the 2 for? Do divide with a real number, instead of an integer. Quote
Lee Mac Posted April 27, 2010 Posted April 27, 2010 When you refer to the value of B, Is that 7.6916^2 or 15.3832^2. Either way I calculate it, It comes out very large. I would think the answer should be 15.3814. I assume that you are labelling 'B' as the base of the Isosceles triangle, so the side of each right angled triangle would be B/2 The calculation would be: A^2 = L^2 - (B/2)^2 A^2 = 17.1973^2 - 7.6916^2 Therefore: A = sqrt ( 236.586 ) = 15.3814 (4 d.p) Quote
The Buzzard Posted April 27, 2010 Author Posted April 27, 2010 alanjt, Close, But no cigar. It returns 16.7618 when it should be 15.3814. I am not sure what I am doing wrong here? Quote
The Buzzard Posted April 27, 2010 Author Posted April 27, 2010 I assume that you are labelling 'B' as the base of the Isosceles triangle, so the side of each right angled triangle would be B/2 The calculation would be: A^2 = L^2 - (B/2)^2 A^2 = 17.1973^2 - 7.6916^2 Therefore: A = sqrt ( 236.586 ) = 15.3814 (4 d.p) Ok Lee, Now I got it. The answer returned was squared. Quote
The Buzzard Posted April 27, 2010 Author Posted April 27, 2010 Ok, I think I have this figured out. I will need to rewrite my function differently now. Thanks to the both of you guys. Quote
The Buzzard Posted April 27, 2010 Author Posted April 27, 2010 Lee & Alan, I just rewritten my function with the new calculations and it is on the money. I sort of combined Lee's formula with Alan's approach and it works great. Thanks again for the brain loaner. The Buzzard Quote
alanjt Posted April 27, 2010 Posted April 27, 2010 alanjt, Close, But no cigar. It returns 16.7618 when it should be 15.3814. I am not sure what I am doing wrong here? How'd you get 16.7618? Both equations work on my end: (defun test (b c) (sqrt (- (* c c) (* b b)))) Result: Command: (test 7.6916 17.1973) 15.3814 (defun test (b c) (sqrt (- (* c c) (* (/ b 2.) (/ b 2.))))) Result: Command: (test (* 2. 7.6916) 17.1973) 15.3814 I just multiplied the 7.6919 by 2.0 since I the original formula was taking half of b. However, of the two, I'd choose the former. I still can't figure out how you didn't get the correct result. These are written as a proper Pythagorean (just solved for a). Quote
The Buzzard Posted April 28, 2010 Author Posted April 28, 2010 How'd you get 16.7618?Both equations work on my end: (defun test (b c) (sqrt (- (* c c) (* b b)))) Result: Command: (test 7.6916 17.1973) 15.3814 (defun test (b c) (sqrt (- (* c c) (* (/ b 2.) (/ b 2.))))) Result: Command: (test (* 2. 7.6916) 17.1973) 15.3814 I just multiplied the 7.6919 by 2.0 since I the original formula was taking half of b. However, of the two, I'd choose the former. I still can't figure out how you didn't get the correct result. These are written as a proper Pythagorean (just solved for a). I think the symbols that I was using were responsible for the error. I may have gotten some mixed up some place. The program is now functioning well although I ran into some problems with getting bulge factor angles to be consistent. I made a temporary fix here till I can get the rest of the program completed. I will be posting the complete program soon and you will see what I did. Its a bit difficult for me to explain at this point. This has nothing really to do with these calculations that were provided here as they work very well. I just need to break things down a little different since the coordinate points I set up had to go a certain way and I mixed an option with toggle buttons to get a desired result. Should be a nice code when its done. Again, Thanks for the help on this, It worked out real well. The Buzzard Quote
alanjt Posted April 28, 2010 Posted April 28, 2010 I think the symbols that I was using were responsible for the error. I may have gotten some mixed up some place. The program is now functioning well although I ran into some problems with getting bulge factor angles to be consistent. I made a temporary fix here till I can get the rest of the program completed. I will be posting the complete program soon and you will see what I did. Its a bit difficult for me to explain at this point. This has nothing really to do with these calculations that were provided here as they work very well. I just need to break things down a little different since the coordinate points I set up had to go a certain way and I mixed an option with toggle buttons to get a desired result. Should be a nice code when its done. Again, Thanks for the help on this, It worked out real well. The Buzzard Glad you worked it out. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.