Question: Computing exponential function using infinite series. Exponential function exp ( x ) can be written as Taylor series expansion as = = 0 ! =

Computing exponential function using infinite series. Exponential function exp(x) can be written as Taylor series expansion as = =0!=1++22!+...+!+...(a)(12%) Write a C# method to implement exp(x). Attach the code. (Hint: use an error epsilon = say 10-7. Stop the calculation when the error is less than epsilon.)(b)(2%) Test your code with x =1, x =3, and x =5. Show the result such as myexp(1)=2.71828, myexp (3)=20.085, myexp(5)=148.41 etc. Here myexp is your code of exponential function (c)(2%) Compare your output with C# math librarys exp method for x =1, x =3 and x =5. Display the difference of myexp(x) Math.exp(x) and also (myexp(x) Math.exp(x))/ Math.exp(x). Is the percentage error small? (d)(4%) Test this with bigger x such as x =100. Show how many steps it takes to calculate when x is as big as 100; show the absolute error |myexp(x) Math.exp(x)| and the relative error |(myexp(x) Math.exp(x))/ Math.exp(x)|. What can you conclude about the absolute error and also relative error?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!