MySQL EXP() Function

The EXP() function in MySQL is used to calculate e raised to the power of a specified number. The constant e (approximately 2.718281...) is the base of the natural logarithms, and this function is useful when you need to perform exponentiation with the base e.


Syntax

EXP(number)

Definition and Usage

  • The EXP() function returns e raised to the power of the specified number.
  • The result is calculated as enumbere^{number}, where e is the Euler's number (approximately 2.718).

Parameter Values

Parameter Description
number Required. A numeric value representing the exponent to which e should be raised.

Technical Details

  • Works in: From MySQL 4.0
  • Result: The result is a floating-point number which represents enumbere^{number}.

Examples

Example 1: Calculate e raised to the power of 1

SELECT EXP(1);

Result:

EXP(1): 2.718281828459045

Explanation: e1=2.718281828459045e^1 = 2.718281828459045, which is the constant e itself.


Example 2: Calculate e raised to the power of 2

SELECT EXP(2);

Result:

EXP(2): 7.3890560989306495

Explanation: e2≈7.389056e^2 \approx 7.389056, which is the value of e raised to the power of 2.


Example 3: Calculate e raised to the power of a negative number

SELECT EXP(-1);

Result:

EXP(-1): 0.36787944117144233

Explanation: e−1≈0.367879e^{-1} \approx 0.367879.


Usage Notes

  • The EXP() function is particularly useful in fields involving exponential growth/decay models, such as finance, physics, and natural sciences, where exponential equations are commonly used.
  • If you need the natural logarithm (logarithm base e), you can use the LN() function, which is the inverse of EXP().
  • The EXP() function calculates values involving e and can handle both positive and negative exponents.

This function is commonly used in scenarios like compound interest calculations, population growth models, or other formulas involving exponential functions.


Was this article helpful?