geordie_b Posted July 29, 2007 Share Posted July 29, 2007 Hi, this is really annoying me. I am trying to write a fucntion that will work out the angle of a triangle. I have the hypotenuse length value and the opposite length value. when working this out on a calculator i would do sin^-1(opposite/hypotenuse) How do i do this using the sin() or asin() functions as everything i have tried gives me the wrong answer Thanks Quote Link to comment Share on other sites More sharing options...
marcus Posted July 29, 2007 Share Posted July 29, 2007 Use sinh. http://us3.php.net/manual/en/function.sinh.php Quote Link to comment Share on other sites More sharing options...
zq29 Posted July 29, 2007 Share Posted July 29, 2007 sin() expects the passed argument to be in radians, so you'll get the wrong answer if your supplying it in degrees. You can use the deg2rad() function to convert. Quote Link to comment Share on other sites More sharing options...
geordie_b Posted July 29, 2007 Author Share Posted July 29, 2007 hi thanks for your replies but im still getting the wrong answer. my code reads.... $ooverh = (113 / 2) / 180; $sinooverh = asin($ooverh); $answer = rad2deg($sinooverh); This gives me the answer of 18.293 degrees when the correct answer from my calculator is 20.326 Any suggestions as to what i am doing wrong? Quote Link to comment Share on other sites More sharing options...
zq29 Posted July 29, 2007 Share Posted July 29, 2007 <?php $a = (113 / 2) / 180; echo sin(deg2rad($a)); //0.00547836719291 ?> That gives me the same answer as my calculator... Am I doing something wrong on the calculator? I haven't done any of this stuff for like 5 years, since school... Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 29, 2007 Share Posted July 29, 2007 Use sinh. http://us3.php.net/manual/en/function.sinh.php sinh is a function for the hyperbolic sin function not the trig function. Its a common pattern in many natural occurring curves, not anything to do with angle relationships in geometry. Quote Link to comment Share on other sites More sharing options...
Barand Posted July 29, 2007 Share Posted July 29, 2007 given a 3:4:5 triangle $opp = 3; $hyp = 5; $theta = rad2deg(asin($opp/$hyp)); // 36.87 deg Quote Link to comment Share on other sites More sharing options...
geordie_b Posted July 29, 2007 Author Share Posted July 29, 2007 given a 3:4:5 triangle $opp = 3; $hyp = 5; $theta = rad2deg(asin($opp/$hyp)); // 36.87 deg but if you work it out with a calculator the answer is 40.96 Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 29, 2007 Share Posted July 29, 2007 Not on my calculator. The way Barand showed was correct. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 29, 2007 Share Posted July 29, 2007 isn't a 3,4,5 right triangle a 30:60:90 triangle and thus your arcsin or inversin should be 30 or 60 degeres? Quote Link to comment Share on other sites More sharing options...
Barand Posted July 29, 2007 Share Posted July 29, 2007 Perhaps your batteries are getting low calc.exe in windows --> 36.869897645844021296855612559093 Quote Link to comment Share on other sites More sharing options...
geordie_b Posted July 29, 2007 Author Share Posted July 29, 2007 my calculator is broken http://www.csgnetwork.com/righttricalc.html gives the answer you guys say. I have a feeling my calculator is about to be broken some more EDIT - Calculator was in the wrong mode, just wasted a day trying to get php to match with a wrong answer Quote Link to comment Share on other sites More sharing options...
Barand Posted July 29, 2007 Share Posted July 29, 2007 ~cooldude a 30 : 60 : 90 triangle would be half an equilateral triangle with sides 2 : 1 : sqrt(3) Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 29, 2007 Share Posted July 29, 2007 summer is to long but its not a half an equilateral its a 45:45:90 it can't be half a triangle because the definition of a triangle is a 3 sided close shapes with net angle sum = pi but it is an equilateral triangle. Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 29, 2007 Share Posted July 29, 2007 I wonder how many sides half a triangle has? Three maybe? Given that an equilateral triangle has three 60 degree angle, my money's on Barand Quote Link to comment Share on other sites More sharing options...
corbin Posted July 29, 2007 Share Posted July 29, 2007 An equilateral triange is: 60 60 60 so if you split that in half: 30 60 180-(60+30) = 90 Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 29, 2007 Share Posted July 29, 2007 ~cooldude a 30 : 60 : 90 triangle would be half an equilateral triangle with sides 2 : 1 : sqrt(3) well you can't have half a triangle its an abstract value because the idea of sides is a counting number there are no "half" sides, a 60:60:60 is the ideal equilateral triangle, but a triangle is just an example of the correlation between angles and lengths of the interacting sides of objects. Equilateral is just a adjective to the word that means nothing really because you can have scalar version of the same equilateral triangle that will integrate to a different area (it is a scalar of the other version area of integration) but the the same value. The legs/base are individually equal to: (sqrt(3)/4)(t^2) where 2 is any scalar value applied to each side. Hope this helps clear up the misunderstanding we all have had on triangles, not that its important because its only a definition not an absolute. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 29, 2007 Share Posted July 29, 2007 An equilateral triange is: 60 60 60 so if you split that in half: 30 60 180-(60+30) = 90 no half would be 3 sides of length with t= 1/2 using my data so it be a 60 60 60 with sides of length sqrt(3)/16 Quote Link to comment Share on other sites More sharing options...
corbin Posted July 29, 2007 Share Posted July 29, 2007 Bleh.... I meant the angles... You're going all mathematical on me lol.... I just meant if you took a triangle like: 60 60 60 And drew a line perpendicular to one of the bases (or what ever you would call one of the lines from one of the 60 degree angels to another.... legs maybe? I know it would be legs if the triangle had a hypotenuse...) you would end up with the angles: 30 60 90 on one side of the line, and: 30 90 60 on the other side of the line. Quote Link to comment Share on other sites More sharing options...
Barand Posted July 29, 2007 Share Posted July 29, 2007 You'd think someone "going all mathematical" would have grasp of basic trig and not claim a triangle with sides 3:4:5 had angles 30:60:90 Here you are, the right-hand half of an eqiulateral triangle. Nothing abstract - just draw one on a piece of card and cut it vertically up the centre. [pre] | | \ |30\ | \ 2 sqrt3 | \ | \ |90 60\ |------ \ 1 [/pre] Quote Link to comment Share on other sites More sharing options...
dbillings Posted July 29, 2007 Share Posted July 29, 2007 If I hadn't read the thread at all my money would still be on Barand. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 29, 2007 Share Posted July 29, 2007 You can't use the word half its so wrong on so many levels. Half implies 50% 1/2 if 2 is whole half is 1. Half can't be applied it be half equal? it be half size? it be half angles? (yes there is a half angle formula but its irrelevant) It can't be half of anything its simply a triangle with sides of 3-4-5 that is its definitiion no more no less everything else is a derivation of this core information actually you can call it a 3-4 triangle because the third side must be 5 that is all it needs to be defined by no more no less, however you must note that neither 3 nor 4 are the hypotenuses in this case because then you could have a sqrt(7),3,4 one Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 29, 2007 Share Posted July 29, 2007 You can't use the word half its so wrong on so many levels. Half implies 50% 1/2 if 2 is whole half is 1. Half can't be applied it be half equal? it be half size? it be half angles? (yes there is a half angle formula but its irrelevant) Apparently mathematics has changed dramatically since Barand and I were in school. Either that, or a great deal was lost in translation. Quote Link to comment Share on other sites More sharing options...
Barand Posted July 29, 2007 Share Posted July 29, 2007 ~Andy I think cooldude may be a liitle embarassed at getting the angles wrong and for an einstein-wannabe it's a little hard for him to swallow. No doubt he'll bombard us with this utterly riveting claptrap till the cows come home. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 29, 2007 Share Posted July 29, 2007 lol the tilda in front of names makes it look like you are disappointed in people, i know i got the angles wrong, but saying its half equal is even more, what ever lets drop it. People make mistakes Quote Link to comment Share on other sites More sharing options...
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.