Julia Exponential Function

Julia Exponential Root is used to find the exponent of a number.

In this tutorial, we will learn how to use the exponential function, exp() with examples.

If the argument to the exponential function is near zero and you require an accurate computation of the exponential function, use expm1(x) function.

Example 1 – Julia Exponential Function

Exponential function with Integer

julia> x = 2
2

julia> exp(x)
7.38905609893065

Exponential function with Floating Point Numbers

julia> x = 3.5241
3.5241

julia> exp(x)
33.92322896714677

Exponential function with Complex Numbers

julia> x = 3 + 5im
3 + 5im

julia> exp(x)
5.697507299833739 - 19.26050892528742im

Example 2 – Julia Exponential Function – expm1

The accurate value of an exponential function is calculated with expm1() function. In the following example, we compared the accurate value of the exponential of an extremely small value (near to zero) with exp() function.

julia> x = 0.000000001
1.0e-9

julia> exp(x)
1.000000001

julia> expm1(x)
1.0000000005000001e-9

Conclusion

In this Julia Tutorial, we learned about Julia Exponential Function and its usage with the help of example scripts.