×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

How do you write functions acs(arc cos) and asn(arc sin)

 Forum Search FAQs Links MVPs

How do you write functions acs(arc cos) and asn(arc sin)

(OP)
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

RE: How do you write functions acs(arc cos) and asn(arc sin)

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:

Arctan:
^y        **********
|  *******
|**
-------------------*------------------>x
**|
*******  |
**********         |

Arccos:

(-1, 2pi)
*    ^y
*    |
*   |
** |
***
(0, pi)| **
|   *
|    *(1, 0)
---------+----*------>x

Arcsin:
(-1, pi)
^y   *
|    *
|   *
(0,0)| **
--------***--------->x
** |
*   |
*    |
*    |
(1,-pi)  |

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!