Funkcja JavaScript Math.cosh () zwraca hiperboliczny cosinus liczby.
Odpowiada (e x + e -x ) / 2 w matematyce.
Składnia Math.cosh()
funkcji to:
Math.cosh(x)
cosh()
jako metoda statyczna jest wywoływana przy użyciu Math
nazwy klasy.
Parametry Math.cosh ()
Math.cosh()
Funkcja przyjmuje się:
- x - liczba
Wartość zwracana z Math.cosh ()
- Zwraca cosinus hiperboliczny podanej liczby.
Przykład: użycie Math.cosh ()
// Math.cosh(x) is (e**(x) + e**(-x))/2 var num = Math.cosh(0); console.log(num); // 1 var num = Math.cosh(1); console.log(num); // 1.5430806348152437 var num = Math.cosh(-1); console.log(num); // 1.5430806348152437 var num = Math.cosh(2); console.log(num); // 3.7621956910836314
Wynik
1 1,5430806348152437 1,5430806348152437 3,7621956910836314
Zalecane lektury:
- JavaScript Math acosh ()
- JavaScript Math sinh ()