Friday, December 18, 2009

InverseSin

hmmm..
So, after being able to Sin(x) and all.
I continue with inverseSin..
But there is no define function for me to use.
So, i had to create my own function.
How to create a function? wat is it?
go check out 1 of my past post 4 it.
http://kaiyuan2lifeless.blogspot.com/2009/10/functions-in-vb.html
lol..

So, the function was this

Private Function ArcSin(ByVal x As Single)
Dim pi As Single
pi = 4 * Atn(1)
ArcSin = Atn(x / Sqr(-x * x + 1))
ArcSin = x * 180 / pi
End Function

Spot the mistake?
tick...
tock..
tick...

the correct one should be this

Private Function ArcSin(ByVal x As Single)
Dim pi As Single
pi = 4 * Atn(1)
ArcSin = Atn(x / Sqr(-x * x + 1))
ArcSin = ArcSin * 180 / pi <<< look at this x has been replace by ArcSin
End Function

hmm..., it gave me some headache 4 a while.
So, whenever there is an error...
always go back to basic..
look back of what you had learn an you can solve it.

No comments: