Jump to content

Wrong solution with sin() [solved]


php_joe

Recommended Posts

Hi, I'm having some problems with a math function not giving me the answer that I expect.

 

Wikipedia says that you can find a side of a triangle if you know an angle and 2 sides using the law of cosine:

a2c3a9527af895a3fa6e8e9d0bb1b30d.png

http://en.wikipedia.org/wiki/Law_of_cosines

 

so I used this code:

<?
$a = '5';
$b = '5';
$c = sqrt(pow($a, 2) + pow($b, 2) - (2 * $a * $b * cos(135)));
echo "$c";
?>

And it gave me the correct (I think) answer: 9.9902148003463

 

But when I try to find a side using 2 angles and a side using the law of sine it doesn't work.

 

The equation that I have is "b = (12 Sin 65)/(sin 50)" from http://home.alltel.net/okrebs/page93.html so I used this code:

<?
$b = 12 * sin(65) / sin(50);
echo "$b";
?>

Which, according the the website that I got it from, should have printed "14.2", but I got "-37.815911143213" instead.

 

What am I doing wrong?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.