Python has math library and has many functions regarding to it. One such function is
expm1(). This function mathematically computes the value of
exp(x) - 1. This method can be used if we need to compute this very value.
Syntax : math.expm1()
x : Number whose exp(x)-1 has to be computed.
Returns : Returns the computed value of “exp(x)-1”
Code #1 : Demonstrate the working of expm1()
The expm1 value using positive integer : 53.598150033144236 The expm1 value using negative integer : -0.950212931632136
There would be a question why
expm1() method was even created if we could always compute exp() and then subtract 1 from it. The first reason is that value
exp() - 1 is used a lot in mathematics and science applications and formulas.
The most important reason is that for smaller value of x, of the order less than e-10,
expm1() method give a result more accurate than
exp() - 1.
Code #2 : Comparing expm1() and exp()-1
The value with exp()-1 : 1.000000082740371e-10 The value with expm1() : 1.00000000005e-10
- Python - tensorflow.math.expm1()
- numpy.expm1() in Python
- Python math library | isnan() method
- Python math library | exp() method
- Python math library | isfinite() and remainder() method
- Python math library | isclose() method
- Python math library | gamma() function
- Python - Read blob object in python using wand library
- Learning Model Building in Scikit-learn : A Python Machine Learning Library
- Pytube | Python library to download youtube videos
- Python Faker Library
- FuzzyWuzzy Python library
- Python | Schedule Library
- Python | Holidays library
- Python | Visualize missing values (NaN) values using Missingno Library
- Introduction to pyglet library for game development in Python
- Python Numerizer Library
- Python Pyforest Library
- How to install Librosa Library in Python
- Python Numerize Library
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.