I've looked in a couple of books, and can't find this anywhere, i'm looking for the opposite of the cos funtion, i.e. I know the cos of the angle, and need to know the actual size of the angle, is there an implicit function? If not, how can I achieve the same result? Any help would be much appreciated...

Recommended Answers

All 4 Replies

try this function :

Public Function ArcCos(ByVal X As Double) As Double
    If X <> 1 Then
        ArcCos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
    Else
        ArcCos = 0
    End If
End Function

Thanks, i'll check if it works, how does it work?What's Atn?What's the theory behind it?Any help would be much appreciated, i'd like to understand you see...

Atn is arctangent

let talk about math

tan(x) = sin(x) / cos(x)
cos(x) = sqr(1 - sin(x)^2)
tan(x) = sin(x) / sqr(1 - sin(x)^2)

so we got ArcSin = X / sqr(-X * X + 1)
and ArcCos = 90 - ArcSin
so ArcCos = (-X / sqr(-X * X + 1)) + 2 * Atn(1)

Thankyou very much for quenching my thirst for knowledge!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.