Could anyone please tell me how to write qbasic functions acs(arc cos) and asn(arc sin), and to input arguments for the functions via the keyboard. Th results should be in
radians.
You can create piecewise-defined functions (which can be represented in QB with a simple IF statement) for these using ATN (the arc of tangent function), which is the only inverse trig function built into QB. Just remember that cos^2(x) + sin^2(x) = 1. With this, you can take a cosine value and get one of the two possible sine values back, or a sine value and get one of the possible cosine values, either of which will give you a ratio that you can put into ATN() and get an angle back (in radians). Then, it's up to you to determine what quadrant that angle is in and transform in accordingly. Arcsin and arctan are always in the 1st or 4th quadrant, and Arccos is always in the 1st or 2nd quadrant. Here are sketches of the functions:
[tt]
Arctan:
^y **********
| *******
|**
-------------------*------------------>x
**|
******* |
********** |
Arcsin:
(-1, pi)
^y *
| *
| *
(0,0)| **
--------***--------->x
** |
* |
* |
* |
(1,-pi) |
[/tt]
The latter two graphs show the ENTIRE function. The range of the functions is as implied by the endpoints. As for the graph of arctan, it has the same range as arcsin, but its domain is the reals.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.