![]() ![]() Test your program on x = 0.3, x = 0.5, x = 0.8, and x = 1. This is a pre-defined symbolic constant in ⟨ loat. We can use the built-in epsilon value that is included in, ELT EPSILON, to test the difference between the standard value and the series value. Note that there are six decimal places for the second and third columns eight for the fourth. When this quantity become less than FLT_EPSILON, the iterations should stop. ![]() And the "Diff" column is the difference between e ∧ x and Sum. The "Sum" column is the value of the summation of the Taylor series during that particular iteration. The " e ∧ x ′′ column is the value of exp ( x ). ![]() 2) Have the program calculate e x by using the Taylor series given above and print the following table:įor x = 0.3 : The number of iterations required for convergence is: 7 For x = 0.8 The number of iterations required for convergence is: 10 The "\# Iter" is the current iteration in the growing sum in the series. This value should be a double that is greater than or equal to zero. Functionality Your program should do the following: 1) Ask the user to enter the " x " value. 3) unsigned long factorial (int n ) -this function will calculate n ! and return the result as an unsigned long. Your program should contain at least these functions (more are fine): 1) main () - the standard main function 2) double convertEtoX (double x ) - this function will calculate e x using the Taylor series above within expsilon. The equation we will implement is: e x = ∑ i = 0 ∞ ( i )! x i = 1 + 1 ! x + 2 ! x 2 + 3 ! x 3 + 4 ! x 4 + ⋯ For this program, let's calculate the Taylor series expansion for the exponential function: e x. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |