Click to See Complete Forum and Search --> : Trig Question -> acos in C++ = what in VB
Willy1110
Jan 23rd, 2002, 12:55 PM
What does the acos function in C++ become when using VB? Thanks :)
Willy
thinktank2
Jan 23rd, 2002, 01:10 PM
There is no built in acos function (only atn)
see this for acos function
http://www.vbforums.com/showthread.php?s=&threadid=53924&highlight=arcCosine+a
thinktank2
Jan 23rd, 2002, 01:13 PM
Basically ...
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Guv
Jan 23rd, 2002, 05:57 PM
Unless inverse cosine is explicitly requested by some text book problem, it is almost always possible to determine an angle via direct use of the VB Atn function, without the messy formula recommended by the VB documention for inverse cosine.
kedaman
Jan 23rd, 2002, 06:43 PM
They would result in those provided in the VB documentation anyway :p But I see the point, somtimes you could simplify the expression
2 * Atn(1)
never put these static expressions in vb code, evaluate them since the compiler wont
Guv
Jan 23rd, 2002, 07:28 PM
I was referring to direct use of the inverse tangent rather than using a formula for inverse sine or cosine.
In real world engineering and scientific problems, you are almost always working with triangles or Cartesian coordinates. When working with triangles, the sine of an angle is the ratio of the opposite side and the hypotenuse, while cosine sine is the ratio of the adjacent side and the hypotenuse. The tangent is the ratio of the opposite and adjacent sides. If you know the sides of the triangle, you can always use inverse tangent to determine angles, making it unnecessary to use inverse sine or cosine.
When working with Cartesian coordinates and a point (X, Y), the tangent is Y/X. Inverse tangent of (Y/X) can be used instead of inverse cosine [ X / Sqr(X^2 + Y^2) ].I have dealt with a lot of real world problems and have always been able to use inverse tangent directly, except for some problems assigned by a professor.
kedaman
Jan 23rd, 2002, 08:29 PM
I haven't found myself using other than arcus tangent either, especially for euler tranformation. However there's are real world problems like in electronics where you'd use arccos to convert between efficciency factor and phase (which are essentially representing the same thing, but so does polar and cartesian coodinates) I guess there's more than plenty of practical uses, otherways why would there exist such a function on my calculator :p
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.