Open In App

How to Find the Antilog of Values in R?

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,



Antilog:

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,

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 program to illustrate how we can
# compute antilog
 
# An integer whose antilog to be computed
number = 3
 
# Initializing base
base = 2
 
# Computing antilog value
answer = base ^ number
 
# Print the value of antilog
print(paste("The value of antilog2(3) is equal to", answer))
 
# Initializing base
base = 4
 
# An integer whose antilog to be computed
number = 2
 
# Computing antilog value
answer = base ^ number
 
# Print the value of antilog
print(paste("The value of antilog4(2) is equal to", answer))
 
 
# An integer whose antilog to be computed
number = 4
 
# Initializing base
base = 10
 
# Computing antilog value
answer = base ^ number
 
# Print the value of antilog
print(paste("The value of antilog2(3) is equal to", answer))
 
# An integer whose antilog to be computed
number = 4.60517018598809
 
# Print the value of antilog
print(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,

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 program to illustrate how we can compute antilog
 
# An integer whose antilog to be computed
number = -3
 
# Initializing base
base = 2
 
# Computing antilog value
answer = base ^ number
 
# Print the value of antilog
print(paste("The value of antilog2(-3) is equal to", answer))
 
# Initializing base
base = 4
 
# An integer whose antilog to be computed
number = -2
 
# Computing antilog value
answer = base ^ number
 
# Print the value of antilog
print(paste("The value of antilog4(-2) is equal to", answer))
 
 
# An integer whose antilog to be computed
number = -4
 
# Initializing base
base = 10
 
# Computing antilog value
answer = base ^ number
 
# Print the value of antilog
print(paste("The value of antilog10(-4) is equal to", answer))
 
# An integer whose antilog to be computed
number = -4.60517018598809
 
# Print the value of antilog
print(paste("The value of antiloge(-4.60517018598809) is equal to", exp(number)))

Output:


Article Tags :