From 2b274a98c898969ad5b753ed48b812617f6a709d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Rafael=20L=C3=A1zaro=20Nevado?= <119618710+Pedrop19@users.noreply.github.com> Date: Thu, 5 Oct 2023 12:42:09 +0200 Subject: [PATCH] Update trigonometry.js --- .../src/geometry-trigonometry/trigonometry.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/adv-math/src/geometry-trigonometry/trigonometry.js b/adv-math/src/geometry-trigonometry/trigonometry.js index a803bae..0f1c2e4 100644 --- a/adv-math/src/geometry-trigonometry/trigonometry.js +++ b/adv-math/src/geometry-trigonometry/trigonometry.js @@ -79,6 +79,48 @@ class Trigonometry { } return this.arctangent(1 / value); } + + // Method to calculate the hyperbolic sine of an angle in degrees + static sinh(degrees) { + const radians = (degrees * Math.PI) / 180; + return Math.sinh(radians); + } + + // Method to calculate the hyperbolic cosine of an angle in degrees + static cosh(degrees) { + const radians = (degrees * Math.PI) / 180; + return Math.cosh(radians); + } + + // Method to calculate the hyperbolic tangent of an angle in degrees + static tanh(degrees) { + const radians = (degrees * Math.PI) / 180; + return Math.tanh(radians); + } + + // Method to calculate the hyperbolic arcsine in degrees + static arsinh(value) { + const result = Math.asinh(value); + return (result * 180) / Math.PI; + } + + // Method to calculate the hyperbolic arccosine in degrees + static arcosh(value) { + if (value < 1) { + throw new Error('Invalid input for arcosh.'); + } + const result = Math.acosh(value); + return (result * 180) / Math.PI; + } + + // Method to calculate the hyperbolic arctangent in degrees + static artanh(value) { + if (value < -1 || value > 1) { + throw new Error('Invalid input for artanh.'); + } + const result = Math.atanh(value); + return (result * 180) / Math.PI; + } } module.exports = Trigonometry;