Results 1 to 7 of 7

Thread: Trig Question -> acos in C++ = what in VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    4

    Trig Question -> acos in C++ = what in VB

    What does the acos function in C++ become when using VB? Thanks

    Willy

  2. #2
    Hyperactive Member thinktank2's Avatar
    Join Date
    Nov 2001
    Location
    Arctic
    Posts
    272
    There is no built in acos function (only atn)

    see this for acos function

    http://www.vbforums.com/showthread.p...ht=arcCosine+a

  3. #3
    Hyperactive Member thinktank2's Avatar
    Join Date
    Nov 2001
    Location
    Arctic
    Posts
    272
    Basically ...

    Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

  4. #4
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151
    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.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    They would result in those provided in the VB documentation anyway 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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151
    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.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width