Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript: cotangent and arccotangent

I had searched on the internet and I could not find the method of the Math object that returns the ctg and arcctg of an angle. Is there such a method or should I just create my own function using these mathematical formulas:

enter image description here

enter image description here

like image 365
s.dragos Avatar asked Aug 31 '16 08:08

s.dragos


1 Answers

There is not, and if you want them you will have to define them yourself. Fortunately, they are easy:

function ctg(x) { return 1 / Math.tan(x); }
function arcctg(x) { return Math.PI / 2 - Math.atan(x); }
like image 187
Amadan Avatar answered Nov 02 '22 19:11

Amadan