The math.asinh(x) function computes the inverse hyperbolic sine of a real number x. Unlike circular inverse sine (math.asin) which is restricted to ratios between -1.0 and +1.0, math.asinh(x) has an unrestricted domain spanning from -∞ to +∞, returning a real number without ever raising domain errors.
Exact Inverse: math.asinh() reverses the forward hyperbolic sine math.sinh() (math.sinh(math.asinh(x)) == x for any real number x).
The math.asinh() function is part of the standard math module:
import math
result = math.asinh(x)
| Parameter | Type | Required? | Description |
|---|---|---|---|
x |
float or int |
Yes | Any real number. Supports positive, negative, and zero values with no domain restrictions. |
Return Value: Returns a floating-point number (float) spanning from -∞ to +∞.
Evaluating math.asinh() for zero, positive, and negative values:
import math
print("asinh(0): ", math.asinh(0)) # 0.0
print("asinh(1): ", math.asinh(1)) # 0.881373587019543
print("asinh(-1): ", math.asinh(-1)) # -0.881373587019543 (odd symmetry)
print("asinh(10): ", math.asinh(10)) # 2.99822295029797
print("asinh(-10):", math.asinh(-10)) # -2.99822295029797
asinh(0): 0.0
asinh(1): 0.881373587019543
asinh(-1): -0.881373587019543
asinh(10): 2.99822295029797
asinh(-10): -2.99822295029797
Mathematically, the inverse hyperbolic sine is defined in terms of the natural logarithm and square root:
asinh(x) = ln(x + √(x2 + 1))
You can verify this identity directly in Python:
import math
x = 2.5
val_builtin = math.asinh(x)
val_formula = math.log(x + math.sqrt(x**2 + 1))
print("math.asinh(2.5):", val_builtin)
print("Log formula: ", val_formula)
print("Is close? ", math.isclose(val_builtin, val_formula)) # True
Unlike circular inverse trigonometry (math.asin and math.acos which are restricted to [-1.0, 1.0]) and hyperbolic tangent (math.atanh which is restricted to (-1.0, 1.0)):
math.asinh(x) is defined for every real number from -∞ to +∞.ValueError: math domain error for real numeric arguments.math.asinh(x) asymptotically approaches ln(2x).import math
huge_val = 1e9
print("asinh(1,000,000,000):", math.asinh(huge_val))
print("ln(2 * x) estimate: ", math.log(2 * huge_val))
Here is how circular arc sine (math.asin) and hyperbolic arc sine (math.asinh) compare:
| Feature | math.asin(x) (Circular) |
math.asinh(x) (Hyperbolic) |
|---|---|---|
| Geometric Base | Unit Circle: x2 + y2 = 1 | Unit Hyperbola: x2 - y2 = 1 |
| Input Domain | Strictly bounded: [-1.0, 1.0] | Unrestricted: (-∞, +∞) |
| Output Range | Angle in radians: [-π/2, π/2] | Real numbers: (-∞, +∞) |
| Involves Angles / Degrees? | Yes (can be converted with math.degrees) |
No (pure dimensionless hyperbolic growth) |
Visualizing the smooth, continuous odd function curve across [-10, 10] using Matplotlib:
import math
import matplotlib.pyplot as plt
x_vals = [i * 0.2 - 10.0 for i in range(0, 101)] # -10 to +10
y_vals = [math.asinh(x) for x in x_vals]
plt.plot(x_vals, y_vals, label="asinh(x)", color="#0b8043")
plt.axhline(0, color="gray", linewidth=0.8, linestyle="--")
plt.axvline(0, color="gray", linewidth=0.8, linestyle="--")
plt.title("Inverse Hyperbolic Sine Curve")
plt.xlabel("Input x (-inf, +inf)")
plt.ylabel("asinh(x)")
plt.grid(True)
plt.legend()
plt.show()
In econometrics and data science, log transformations (ln(x)) fail when datasets contain zero or negative financial values (e.g. net profits, losses, cash flows). The Inverse Hyperbolic Sine (IHS) transformation is widely adopted because it handles zero and negative numbers seamlessly while retaining logarithmic properties for large numbers:
$$ ext{IHS}(x) = ext{asinh}(x) = \ln(x + \sqrt{x^2 + 1})$$
Let's build an IHS financial data transformer verified with unit assertions:
import math
def ihs_transform(values, scale=1.0):
if scale <= 0:
raise ValueError("Scale parameter must be strictly positive.")
return [round(math.asinh(v / scale), 4) for v in values]
cash_flows = [100.0, 10.0, 0.0, -10.0, -100.0]
transformed = ihs_transform(cash_flows, scale=1.0)
# Unit Assertions
assert transformed[2] == 0.0 # Handles zero smoothly (unlike log)
assert transformed[0] == -transformed[4] # Symmetrical polarity preserved
assert transformed[1] == -transformed[3] # Symmetrical polarity preserved
assert transformed[0] == 5.2983 # asinh(100) ~ 5.2983
assert transformed[4] == -5.2983 # asinh(-100) ~ -5.2983
print("Original Cash Flows: ", cash_flows)
print("IHS Transformed Values:", transformed)
print("All IHS transformation assertions passed successfully!")
Open in Google Colab View on GitHub
Run all math.asinh() examples interactively, test unrestricted domain inputs, verify logarithmic formula equivalence, and implement IHS econometric data transformations directly in Google Colab.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.