The value of Exponential function can be calculated using Taylor Series.
= 1 + x/1! + /2! + /3! + ......
To find its value using recursion, we will use static variables. For the power of x we will use p and for factorials we will use f as static variables.
The function shown below is used to increase the power of x.
p = p*x
The function below is used to find factorials.
f = f*n
The function below is used to calculate the summation of the series.
where r is the recursive call to the function.
Below is the implementation of the above idea.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Tail recursion to calculate sum of array elements.
- C program to calculate the value of nPr
- Program to calculate value of nCr
- Program to calculate the value of nCr Efficiently
- Efficient program to calculate e^x
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Write a program to calculate pow(x,n)
- Program to calculate Area Of Octagon
- Program to calculate GST from original and net prices
- Program to calculate distance between two points
- Program to calculate distance between two points in 3 D
- Program to calculate Electricity Bill
- Program to calculate the area of Kite
- Program to calculate Root Mean Square
- Program to calculate Profit Or Loss
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.