I was hoping to publish every Saturday, but this past Saturday I got sidetracked. So without further ado, I bring you the next installment in the trigonometry series of articles.
Each of the six basic trigonometric functions has an inverse function. The inverse functions for sine, cosine, and tangent (arcsine, arcosine, and arctangent, respectively) are already defined natively in PHP. In ASP, only the inverse function for tangent (arctangent) is defined, but we will create an adapter for it to be consistent with the abbreviation in PHP. We also need to define some constants that are already present in PHP but not in ASP.
Const M_PI = 3.14159265358979323846
Const M_PI_2 = M_PI / 2
asin = atn(x / sqr(1 - x ^ 2))
acos = M_PI_2 - asin(x)
atan = atn(x)
As you can probably guess, the inverse functions for cosecant, secant, and cotangent are arccosecant, arcsecant, and arccotangent.
acsc = asin(1 / x)
asec = M_PI_2 - acsc(x)
acot = M_PI_2 - atn(x)
return asin(1 / $x);
return (M_PI_2 - acsc($x));
return (M_PI_2 - atan($x));
Next time we'll do something different for a change. I promise.