Open In App
Related Articles

Calculate Hyperbolic tangent of a value in R Programming – tanh() Function

Improve Article
Improve
Save Article
Save
Like Article
Like

tanh() function in R Language is used to calculate the hyperbolic tangent of the numeric value passed to it as argument.

Syntax: tanh(x)

Parameter:
x: Numeric value

Example 1:




# R code to calculate hyperbolic tangent of a value
  
# Assigning values to variables
x1 <- -90
x2 <- -30
  
# Using tanh() Function
tanh(x1)
tanh(x2)


Output:

[1] -1
[1] -1

Example 2:




# R code to calculate hyperbolic tangent of a value
  
# Assigning values to variables
x1 <- pi
x2 <- pi / 3
  
# Using tanh() Function
tanh(x1)
tanh(x2)


Output:

[1] 0.9962721
[1] 0.7807144
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 01 Jun, 2020
Like Article
Save Article
Similar Reads