Jump to content

ASin error


Recommended Posts

I am working with triangles and am finding one angle given a matching side and angle along with another side. To solve this, you would use law of sines. My triangle is a simple 45-45-90 so it is easily checked. The sides are 2, 2, and 2 radical 2 (2 * sqrt(2)).

In my example, I have one side equal to 2, the hypotenuse equal to 2 radical 2, and the angle opposite the 2 equal to 45 degrees. I am trying to find the degrees of the angle opposite the hypotenuse (which ends up being 90). Here is what I am trying to use:

$Side1 = 2
 $Side3 = 2 * Sqrt(2)
 $Angle1 = 45
 
 $Angle3 = _Degree(ASin(($Side3 * Sin(_Radian($Angle1))) / $Side1))
 ConsoleWrite($Angle3 & @CRLF)

If I remove the parameter for ASin and read the answer, it is 1.

ConsoleWrite(($Side3 * Sin(_Radian($Angle1))) / $Side1 & @CRLF)

If I do _Degree(ASin(1)), there is no problem. It returns 90. Can anyone confirm this?

Am I missing something super easy or is this a bug?

Edited by dantay9
Link to comment
Share on other sites

Because this is a float number. ArcSin(X) - X can not be more 1. Try the following.

$Angle3 = _Degree(ASin(Round(($Side3 * Sin(_Radian($Angle1))) / $Side1, 8)))

PS.

Why such complexity. The sum of angles of any triangle - 180.

$Angle3 = 180 - $Angle1 - $Angle2

Link to comment
Share on other sites

Thank you Yashied. That works. I forgot Autoit shortens all values to a certain number of decimal places. The reason for the complexity is that I only know one angle and two sides. To solve this, you must use law of sines (if there is a matching side and angle) or law of cosines (if all else fails).

Edited by dantay9
Link to comment
Share on other sites

Thank you Yashied. That works. I forgot Autoit shortens all values to a certain number of decimal places. The reason for the complexity is that I only know one angle and two sides. To solve this, you must use law of sines (if there is a matching side and angle) or law of cosines (if all else fails).

If it is rectangular triangle, you know two corners - 90 and another. Otherwise, the law of sinus and cosines are not working. They are only for rectangular triangles. Do you agree with me? :)

Hence the third angle is equal to:

$Angle3 = 180 - 90 - $Angle1 = 90 - $Angle1 (And you do not need ArcSin and ArcCos)

EDIT:

See this for more information.

Edited by Yashied
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...