The SINH()
function in SQLite calculates the hyperbolic sine of a value. The hyperbolic sine is a mathematical function that can return any real number and grows exponentially as its input increases or decreases.
Syntax
SINH(x)
Where x
is a numeric expression.
Example 1
Here’s a simple example to demonstrate:
SELECT SINH(3);
Output:
+------------------+
| SINH(3) |
+------------------+
| 10.0178749274099 |
+------------------+
Example 2
Here are a few calculations of interest:
SELECT
SINH(0),
SINH(-2),
-SINH(2),
SINH(-2) = -SINH(2);
Output:
+---------+-------------------+-------------------+---------------------+
| SINH(0) | SINH(-2) | -SINH(2) | SINH(-2) = -SINH(2) |
+---------+-------------------+-------------------+---------------------+
| 0.0 | -3.62686040784702 | -3.62686040784702 | 1 |
+---------+-------------------+-------------------+---------------------+
Example 3
Let’s explore how SINH()
behaves with different input values:
-- Create a test table with various numbers
CREATE TABLE test_values (
value_id INTEGER PRIMARY KEY,
x FLOAT
);
-- Insert some test values
INSERT INTO test_values (x) VALUES
(-2),
(-1),
(-0.5),
(0),
(0.5),
(1),
(2);
-- Calculate hyperbolic sine values
SELECT
x,
ROUND(SINH(x), 6) as sinh_value
FROM test_values;
Output:
+------+------------+
| x | sinh_value |
+------+------------+
| -2.0 | -3.62686 |
| -1.0 | -1.175201 |
| -0.5 | -0.521095 |
| 0.0 | 0.0 |
| 0.5 | 0.521095 |
| 1.0 | 1.175201 |
| 2.0 | 3.62686 |
+------+------------+
Output Grows Exponentially
The output of SINH()
grows exponentially as the input increases:
SELECT
SINH(1),
SINH(2),
SINH(3),
SINH(4),
SINH(5);
Output:
+-----------------+------------------+------------------+------------------+------------------+
| SINH(1) | SINH(2) | SINH(3) | SINH(4) | SINH(5) |
+-----------------+------------------+------------------+------------------+------------------+
| 1.1752011936438 | 3.62686040784702 | 10.0178749274099 | 27.2899171971278 | 74.2032105777888 |
+-----------------+------------------+------------------+------------------+------------------+
Common Use Cases
SINH()
is commonly used in:
- Scientific calculations
- Engineering applications
- Financial modeling
- Signal processing
- Physics equations
Mathematical Formula
For those interested, the hyperbolic sine is defined as:
SINH(x) = (e^x - e^-x) / 2
where e is Euler’s number (approximately 2.71828).