# 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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

##### 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

##### 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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

##### 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:

Edited by Yashied

## 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