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.
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.
- Tail recursion to calculate sum of array elements.
- Program to check if an array is palindrome or not using Recursion
- C++ Program to print an Array using Recursion
- Program to find all Factors of a Number using recursion
- C Program to reverse the digits of a number using recursion
- C program to create copy of a singly Linked List using Recursion
- Program for length of a string using recursion
- Efficient program to calculate e^x
- C program to calculate the value of nPr
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Program to calculate the number of odd days in given number of years
- Program to calculate distance between two points
- Program to calculate area and volume of a Tetrahedron
- Program to calculate value of nCr
- Program to calculate Area Of Octagon
- Program to calculate GST from original and net prices
- Program to calculate Percentile of a student based on rank
- Program to calculate the Surface Area of a Triangular Prism
- Program to calculate area of an Circle inscribed in a Square
- Program to calculate distance between two points in 3 D
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.