is there any function in PHP which would g开发者_如何学Pythonet the cotangent and arccotangent of my number?
Thanks
And arccotangent(a) would be atan(1/a).
Take a look at the tan function in the PHP manual for the cotangent, notably the comment here for cotangents
<?php
//FOR PHP 4
function cot($rad)
{
return tan(M_PI_2 - rad2deg($rad));
}
//FOR PHP 3
function cot($rad)
{
return tan(M_PI/2 - rad2deg($rad));
}
?>
See here for #2
http://php.net/manual/en/function.atan.php
theres a cotan funciton in teh comments for http://php.net/manual/en/function.tan.php
I believe there are no built-ins for those. So you'll have to write/find some. Cot is in the comments for tan() on php.net
http://php.net/manual/en/function.tan.php
tan
will give you the tangent. Cotangent is 1/tan
. You can easily use the arctan
function to calculate the arccotan taking in mind that
arccot x = (PI / 2) - arctan x
精彩评论