JavaScript-wiskunde tanh ()

De JavaScript-functie Math.tanh () retourneert de hyperbolische tangens van een getal.

Het komt overeen met (e x - e -x ) / (e x + e -x ) in de wiskunde.

De syntaxis van de Math.tanh()functie is:

 Math.tanh(x)

tanh(), zijnde een statische methode, wordt aangeroepen met behulp van de Mathklassenaam.

Math.tanh () Parameters

De Math.tanh()functie neemt:

  • x - Een nummer

Retourwaarde van Math.tanh ()

  • Geeft als resultaat de tangens hyperbolicus van het opgegeven getal.

Voorbeeld: Math.tanh () gebruiken

 // Math.tanh(x) is (e**(x) - e**(-x))/(e**(x) + e**(-x)) var num = Math.tanh(0); console.log(num); // 0 var num = Math.tanh(1); console.log(num); // 0.7615941559557649 var num = Math.tanh(-1); console.log(num); // -0.7615941559557649 var num = Math.tanh(2); console.log(num); // 0.9640275800758169

Uitvoer

 0 0,7615941559557649 -0,7615941559557649 0,9640275800758169

Aanbevolen metingen:

  • JavaScript Math atanh ()
  • JavaScript Math sinh ()

Interessante artikelen...