开发者

PHP: counting arcctg and ctg

开发者 https://www.devze.com 2023-01-28 08:56 出处:网络
is there any function in PHP which would g开发者_如何学Pythonet the cotangent and arccotangent of my number?

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
0

精彩评论

暂无评论...
验证码 换一张
取 消