# How to Calculate Antilog of Values in Python

The **antilogarithm (antilog)** refers to the inverse operation of a logarithmic (log) number. The antilog is used for finding the original number
from the log number.

For example, the antilog of the log with a base 10 (log_{10}) value can be found by raising the base value (10) to the
power of the log value. If log_{10}(x) = z then the antilog of z is 10^{z}.

The following examples illustrates for how to find antilog of various log bases,

Base |
Log |
Antilog |
---|---|---|

10 | log_{10}(5) = 0.6989 |
10^{0.6989} = 5 |

2 | log_{2}(5) = 2.3219 |
2^{2.3219} = 5 |

e | log(5) = 1.6094 | 2.7182^{1.6094} = 5 |

In Python, you can use the `10**x`

, `2**x`

, or `np.exp(x)`

functions to calculate the antilogs, depending on the base you
want to use.

## Example 1: Calculate the antilog of the log_{10} value

Suppose you have a value of log_{10} as follows:

```
# import package
import numpy as np
# calculate log10 value
log_val = np.log10(5)
# see log value
log_val
0.6989700043360189
```

Now, calculate the antilog of log_{10} value (0.6989) to get the original value of 5.

```
# raise base value 10 to the power of the log10 value
10**log_val
# output
5.0
```

By taking the antilog of log_{10} value, we obtained the original value of 5.

## Example 1: Calculate the antilog of the log_{2} value

Suppose you have a value of log_{2} as follows:

```
# import package
import numpy as np
# calculate log10 value
log_val = np.log2(5)
# see log value
log_val
2.321928094887362
```

Now, calculate the antilog of log_{2} value (2.3219) to get the original value of 5.

```
# raise base value 2 to the power of the log2 value
2**log_val
# output
5.0
```

By taking the antilog of log_{2} value, we obtained the original value of 5.

## Example 3: Calculate the antilog of natural log

Suppose you have a value of natural log as follows:

```
# import package
import numpy as np
# calculate log10 value
log_val = np.log(5)
# see log value
log_val
1.6094379124341003
```

Now, calculate the antilog of natural log value (2.3219) to get the original value of 5.

You can use `np.exp()`

function to calculate the antilog of natural log value.

```
# import package
import numpy as np
# calculate antilog
np.exp(log_val)
# output
5.0
```

By taking the antilog of natural log value, we obtained the original value of 5.

**Related**: How to Calculate Antilog of Values in R

## Enhance your skills with courses on Statistics and Python

- Introduction to Statistics
- Python for Everybody Specialization
- Python 3 Programming Specialization
- Statistics with Python Specialization
- Advanced Statistics for Data Science Specialization

This work is licensed under a Creative Commons Attribution 4.0 International License

Some of the links on this page may be affiliate links, which means we may get an affiliate commission on a valid purchase. The retailer will pay the commission at no additional cost to you.