Question
Consider the following exponential function with a real variable, x: ??=??^x The Taylor series expansion for this function around x=0 is given as ??t=1+??/ 1!+??^2/
Consider the following exponential function with a real variable, x: ??=??^x
The Taylor series expansion for this function around x=0 is given as
??t=1+??/ 1!+??^2/ 2!+??^3/3!+?
Write a program that prompts the user to enter a floating-point number, x, and a nonnegative integer, n, that represents the highest power of x to be included in computing the Taylor series, yT. The program must have a recursive function with x and n as input parameters, and use it to compute yT. For example, if n=3, only the terms shown above must be included in yT. After yT is computed, the program must print the actual value of y using the math.exp() function, yT, and the absolute value of the percentage error, e, made in computing yT such that e=|100*(y- yT)/y|. You may directly use the math.factorial() function to compute the factorials in yT. Assume that the user gives the inputs properly, so the program does not need to check if they are valid or not.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started