How do I write Sin^-1 in AHK? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jsbjsb12345
Posts: 14
Joined: 08 Jul 2020, 19:00

How do I write Sin^-1 in AHK?

Post by jsbjsb12345 » 29 Nov 2022, 22:04

Hi, Trying to do this in AHK:

sin(x) = 0.5
x = sin^-1(0.5)
x = 30°

This doesn't work:

Code: Select all

MsgBox, % Sin**-1(0.5)
as the **-1 seems to break it.

I don't know much about math, I read the general math and trigonometry section of the AHK reference to no avail.

Thanks!! :wave:

gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: How do I write Sin^-1 in AHK?  Topic is solved

Post by gregster » 29 Nov 2022, 22:18

Like this:

Code: Select all

pi := 4*ATan(1)
MsgBox, % ASin(0.5) * 180 / pi		; returns 30.000000
Since the arcsine function returns radians, you have to convert it to degrees:
https://www.autohotkey.com/docs/commands/Math.htm#Trigonometry wrote:Note: To convert a radians value to degrees, multiply it by 180/pi (approximately 57.29578). To convert a degrees value to radians, multiply it by pi/180 (approximately 0.01745329252). The value of pi (approximately 3.141592653589793) is 4 times the arctangent of 1.

Post Reply

Return to “Ask for Help (v1)”