How to Find the Antilog of Values in R? - GeeksforGeeks

22 Dec, 2021
The antilog or anti-logarithm is the inverse process of finding log or logarithm. If q is the value of logb p then p is the antilog of q to the base b that is, q = logb p then p = antilogb q
Examples,
antilog2 3 = 8, since 23 yields 8
antilog4 2 = 16, since 42 yields 16
antilog10 4 = 10000, since 104 yields 10000
The antilog or anti-logarithm of a number, number to base, the base can be calculated as,
Syntax:
basenumber
Here,
base: a positive integer (base of antilog)
number: an integer whose antilog to be computed
Return type:
a positive integer: antilog of number to base 
Example 1:
In this example, we will see how we can calculate antilog of the following positive numbers,
antilog2 (3)
antilog4 (2)
antilog10 (4)
antiloge (4.60517018598809)
Since antilog2 (3) is equal to 23 = 8, antilog4 (2) is equal to 42 = 16 and antilog10 (4) is equal to 104 = 10000 we can calculate these values with the help of exponentiation operator (^) in R. We can also compute the antilogarithm of a number to base e by passing a single parameter to the exp() inbuilt function. 
R
# R program to illustrate how we can# compute antilog # An integer whose antilog to be computednumber = 3 # Initializing basebase = 2 # Computing antilog valueanswer = base ^ number # Print the value of antilogprint(paste("The value of antilog2(3) is equal to", answer)) # Initializing basebase = 4 # An integer whose antilog to be computednumber = 2 # Computing antilog valueanswer = base ^ number # Print the value of antilogprint(paste("The value of antilog4(2) is equal to", answer))  # An integer whose antilog to be computednumber = 4 # Initializing basebase = 10 # Computing antilog valueanswer = base ^ number # Print the value of antilogprint(paste("The value of antilog2(3) is equal to", answer)) # An integer whose antilog to be computednumber = 4.60517018598809 # Print the value of antilogprint(paste("The value of antiloge(4.60517018598809) is equal to", exp(number)))
Output:
Example 2:
In this example, we will see how we can calculate antilog of the following negative numbers,
antilog2 (-3)
antilog4 (-2)
antilog10 (-4)
antiloge (-4.60517018598809)
Since antilog2 (-3) is equal to 2-3 = 1 / 8 , antilog4 (-2) is equal to 4-2 = 1 / 16 and antilog10 (-4) is equal to 10-4 = 1 / 10000 we can calculate these value with the help of exponentiation operator (^) in R.  We can also compute the antilogarithm of a number to base e by passing a single parameter to the exp() inbuilt function. 
R
# R program to illustrate how we can compute antilog # An integer whose antilog to be computednumber = -3 # Initializing basebase = 2 # Computing antilog valueanswer = base ^ number # Print the value of antilogprint(paste("The value of antilog2(-3) is equal to", answer)) # Initializing basebase = 4 # An integer whose antilog to be computednumber = -2 # Computing antilog valueanswer = base ^ number # Print the value of antilogprint(paste("The value of antilog4(-2) is equal to", answer))  # An integer whose antilog to be computednumber = -4 # Initializing basebase = 10 # Computing antilog valueanswer = base ^ number # Print the value of antilogprint(paste("The value of antilog10(-4) is equal to", answer)) # An integer whose antilog to be computednumber = -4.60517018598809 # Print the value of antilogprint(paste("The value of antiloge(-4.60517018598809) is equal to", exp(number)))
Output:
anikakapoor
Picked
R-Mathematics
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to Change Axis Scales in R Plots?
Replace Specific Characters in String in R
How to filter R dataframe by multiple conditions?
R - if statement
How to filter R DataFrame by values in a column?
How to import an Excel File into R ?
Time Series Analysis in R