Formula - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Formula (/showthread.php?tid=3092) Pages:
1
2
|
RE: Formula - Jack - 10-02-2024 I suspect that Chris expects the arguments to asin and sin to be in degrees RE: Formula - bplus - 10-02-2024 When you take the _Asin(sin(a)) I expected it to return the angle a. It is returning everything between 0 and +|- 90 degrees, it may be right I never use _Asin(). OK Code: (Select All) ? sin(_pi/4), sin(_pi(3/4)) RE: Formula - SMcNeill - 10-02-2024 (10-02-2024, 10:19 PM)bplus Wrote: When you take the _Asin(sin(a)) I expected it to return the angle a. It won't though. Here's why: SIN (30) = 0.5 SIN (150) = 0.5 So _ASIN(0.5) is going to tell you it's 150... How? Same SIN value, same ASIN angle returned. RE: Formula - vince - 10-03-2024 (10-02-2024, 10:19 PM)bplus Wrote: When you take the _Asin(sin(a)) I expected it to return the angle a._asin is bound to -pi/2 < a < pi/2 , so any higher value will just roll over, I guess why they call it "arc" sine RE: Formula - bplus - 10-03-2024 "How?" Don't tell, offer the 2 choices: Code: (Select All) Print ArcSinDegrees$(Sin(_Pi / 4)) RE: Formula - Chris - 10-03-2024 Thanks for Your advice. This code works. I# = _R2D(_ASIN(F# * Sin(_D2R(H#)))) Regards - Chris RE: Formula - bplus - 10-03-2024 Glad you have it worked out. I got a new ArcSin function out of it now I need to figure out what to do with a Function with 2 answers to it Probably not acceptable to math definition of function but this one tells the whole truth of what the angle might be. RE: Formula - SMcNeill - 10-03-2024 (10-03-2024, 02:39 PM)bplus Wrote: Glad you have it worked out. You'll never know what the angle might be. _ASIN(0.5) -- this might be 30 degrees. It might be 150. It might be 390 degrees. It might be 510. Ot could be -330. Or maybe -210.... So when you hit the _ASIN button, it tells you the first and simplest value that it can be -- 30 degrees. You can never confer that angle back from the value alone, multiple angles all return that same sine value. RE: Formula - bplus - 10-03-2024 It's always one of 2 angles as I showed in reply #15, except at pi/2 and -pi/2, saying it is from one angle only is incomplete answer. RE: Formula - bert22306 - 10-04-2024 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" 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 |