Given a positive number x, the task is to find the natural log (ln) and log to the base 10 (log10) of this number with the help of expansion.
Input: x = 5 Output: ln 5.000 = 1.609 log10 5.000 = 0.699 Input: x = 10 Output: ln 10.000 = 2.303 log10 10.000 = 1.000
- The expansion of natural logarithm of x (ln x) is:
- Therefore this series can be summed up as:
- Hence a function can be made to evaluate the nth term of the sequence for 1 ≤ x ≤ n
- Now to calculate log10 x, below formula can be used:
Below is the implementation of the above approach:
ln 5.000 = 1.609 log10 5.000 = 0.699
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Sum of the Tan(x) expansion upto N terms
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Sum of N terms in the expansion of Arcsin(x)
- Middle term in the binomial expansion series
- Program to print binomial expansion series
- Find the value of f(n) / f(r) * f(n-r)
- Find (1^n + 2^n + 3^n + 4^n) mod 5 | Set 2
- Find 2^(2^A) % B
- Find K such that |A - K| = |B - K|
- Find N from the value of N!
- Find the value of max(f(x)) - min(f(x)) for a given F(x)
- Find value of (1^n + 2^n + 3^n + 4^n ) mod 5
- Find value of (n^1 + n^2 + n^3 + n^4) mod 5 for given n
- Find larger of x^y and y^x
- Find the value of N XOR'ed to itself K times
- Find maximum among x^(y^2) or y^(x^2) where x and y are given
- Find the value of N when F(N) = f(a)+f(b) where a+b is the minimum possible and a*b = N
- Find the other number when LCM and HCF given
- Find gcd(a^n, c) where a, n and c can vary from 1 to 10^9
- Find two numbers whose sum and GCD are given
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.