Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Formula
#20
I like to do things "straight stick," so to speak. Try this stuff out to your heart's content.

Code: (Select All)
_Title "Test sine, cosine, arcsin, arccos functions"
Screen _NewImage(120, 35, 0)
Color 1, 7
Cls
pi = 3.141592653589793
1 Input "Enter x in degrees"; x
xRad = x * pi / 180
SinX = Sin(xRad)
CosX = Cos(xRad)
yrad = _Asin(SinX)
zrad = _Acos(CosX)
y = yrad * 180 / pi
z = zrad * 180 / pi
Print
Print "Angle input x = "; x
Print
Print "Sin(x) = "; SinX
Print "Cos(x) = "; CosX
Print
Print "ArcSin(Sin(x)) in radians = "; yrad, "ArcSin(Sin(x)) in degrees = "; y
Print "ArcCos(Cos(x)) in radians = "; zrad, "ArcCos(Cos(x)) in degrees = "; z
Print
Input "Continue or exit (x to exit) "; cont$
If cont$ = "x" Then End
Print
GoTo 1
End

Thing is, it's really simple to convert radians to degrees or degrees to radians.

Radians * 180/pi = degrees.
Degrees * pi/180 = radians.

Seems easier than remembering the spacial function name, to me.

(Typo corrected. I saw I was printing out the y angle twice at the end, as opposed to y and then z. Sorry. This works right.)

Just so you can see why these formulas hold, simple derivation.

Question: How many radians is 30 degrees?

Answer consists of simple algebra:

2pi / 360 = xradians / 30

Solve for xrad

xrad = 30 * pi/180

xrad = 0.5236 radians

Or the other way around. How many degrees is pi radians?

Answer:

2pi / 360 = pi radians / x

Solve for x (cross multiply)

2pi * x = 360 * pi radians

x degrees = pi radians * 180/pi

x = 180 degrees
Reply


Messages In This Thread
Formula - by Chris - 10-02-2024, 07:46 PM
RE: Formula - by bplus - 10-02-2024, 07:50 PM
RE: Formula - by Chris - 10-02-2024, 08:16 PM
RE: Formula - by bplus - 10-02-2024, 08:51 PM
RE: Formula - by SMcNeill - 10-02-2024, 09:02 PM
RE: Formula - by Chris - 10-02-2024, 09:10 PM
RE: Formula - by bplus - 10-02-2024, 09:23 PM
RE: Formula - by bplus - 10-02-2024, 09:28 PM
RE: Formula - by SMcNeill - 10-02-2024, 09:35 PM
RE: Formula - by SMcNeill - 10-02-2024, 09:30 PM
RE: Formula - by Jack - 10-02-2024, 10:01 PM
RE: Formula - by bplus - 10-02-2024, 10:19 PM
RE: Formula - by SMcNeill - 10-02-2024, 10:24 PM
RE: Formula - by vince - 10-03-2024, 12:14 AM
RE: Formula - by bplus - 10-03-2024, 04:06 AM
RE: Formula - by Chris - 10-03-2024, 08:59 AM
RE: Formula - by bplus - 10-03-2024, 02:39 PM
RE: Formula - by SMcNeill - 10-03-2024, 06:18 PM
RE: Formula - by bplus - 10-03-2024, 06:51 PM
RE: Formula - by bert22306 - 10-04-2024, 04:11 AM



Users browsing this thread: 8 Guest(s)