Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: using arccos(x) function - Visual Basic  (Read 9119 times)

0 Members and 1 Guest are viewing this topic.

Tag_yer_dead

  • Guest
using arccos(x) function - Visual Basic
« on: May 22, 2007, 06:03:57 PM »
hey everybody,
I have a question involving visual basic -
im creating a program that allows you to draw a triangle, and will then compute the side lengths and
angle measurements.  However, i need to use inverse cosine to figure the angles out.

I know the formula for inverse cosine is
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

I get the error "Invalid Call Procedure, or Argument"
and arccos(x)=empty

If any one knows how to use the function, please give me some example code.
Thanks alot

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: using arccos(x) function - Visual Basic
« Reply #1 on: May 23, 2007, 03:15:14 AM »
In order to make the ArcCos function call, you need to define the function:

Code: [Select]
myVar = ArcCos(arg)

Public Function ArcCos(X As Double) As Double
   ArcCos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function

Hope this helps.  8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein