tags:

views:

201

answers:

3

PHP has many builtin trig math functions, but the 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?

+1  A: 

Try using Math_Complex PEAR package to do that: http://pear.php.net/manual/en/package.math.math-complex.math-complexop.acot.php

Lukman
+2  A: 

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).

tom10
+2  A: 

You can use arctan(x) to calculate arccot(x):

function acot(x) {
  return pi()/2 - atan(x);
}
sth