How do I do the formula
B= 180-arcsin((Ri-Cl/Re)
Printable View
How do I do the formula
B= 180-arcsin((Ri-Cl/Re)
Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Please post your question in one forum only. I replied to your other thread here... http://www.vbforums.com/showthread.p...threadid=98363
Laterz
VB has no inverse trig functions other than Atn (inverse Tangent). You can use so called derived functions as per a prior post.
In almost every practical situation, you can use the inverse tangent directly.
Sine and cosine are the ratios between the hypotenuse and a side of a right triangle. Tangent is the ratio of two sides of a right triangle.
Sine = OppositeSide / Hypotenuse
Cosine = AdjacentSide / Hypotenuse
Tangent = OppositeSide / AdjacentSide
If you keep the above ratios in mind you can work out how to use inverse tangent for inverse sine or inverse cosine.
If you have XY-coordinates, the following are valid.
Sine = Y / R
Cosine = X / R
Tangent = Y / X
Where R is the distance of the point from the origin.
R = Squareroot( X^2 + Y^2)
Digital-X-Treme, leif
Try not to waste performance by doing as few calculations as possible
X=Ri-Cl/ReQuote:
B = 180- Atn((Ri-Cl/Re) / Sqr(-(Ri-Cl/Re) * (Ri-Cl/Re) + 1))
B = 180- Atn(X / Sqr(-X * X + 1))
Guv
And I remeber you wondered why -X * X + 1 and not 1 - X * X
The answer is that X * X is evaluated first, if this operations is to take n cpu instructions the whole expression will take n+2; the negation of the result followed by incremention. The later expression would require either an extra register or be stored temporarily in RAM, while the register would be filled with 1 and then substract X * X from it which takes at least n+3, and the additional register.