How to Find the Antilog of Values in R?
Last Updated :
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
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,
- 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
number = 3
base = 2
answer = base ^ number
print ( paste ( "The value of antilog2(3) is equal to" , answer))
base = 4
number = 2
answer = base ^ number
print ( paste ( "The value of antilog4(2) is equal to" , answer))
number = 4
base = 10
answer = base ^ number
print ( paste ( "The value of antilog2(3) is equal to" , answer))
number = 4.60517018598809
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,
- 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
number = -3
base = 2
answer = base ^ number
print ( paste ( "The value of antilog2(-3) is equal to" , answer))
base = 4
number = -2
answer = base ^ number
print ( paste ( "The value of antilog4(-2) is equal to" , answer))
number = -4
base = 10
answer = base ^ number
print ( paste ( "The value of antilog10(-4) is equal to" , answer))
number = -4.60517018598809
print ( paste ( "The value of antiloge(-4.60517018598809) is equal to" , exp (number)))
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...