How do I compute the arcot (inverse cotangent) in PHP?
PHP has many builtin trig math functions, but 开发者_如何学Pythonthe inverse cotangent does not seem to be available as one of them. This is also referred to as arccot. Does anyone have the function equivalent in PHP to compute this?
You can use arctan(x) to calculate arccot(x):
function acot(x) {
return pi()/2 - atan(x);
}
Do you have arctan
in PHP? Given x
and you want to computer arccot(x)
, you could compute arctan(1/x)
since this equals arccot(x)
.
Try using Math_Complex
PEAR package to do that: http://pear.php.net/manual/en/package.math.math-complex.math-complexop.acot.php
精彩评论