Question
Write a C++ program that provides information dealing with the approximation of the sin() function using various terms from the Taylors series expansion. Use 4
Write a C++ program that provides information dealing with the approximation of the sin() function using various terms from the Taylors series expansion. Use 4 decimal places for all the numbers printed. First provide the following main menu: sin() function approximation tool Select an option 1 - Calculate the maximum allowed angle for a given number of terms 2 - Print angle and error for a given number of terms 3 Exit After performing either options 1 or 2, keep displaying the above menu until option 3 is selected which exists the program. When option 1 is selected, first ask the user to enter the error for calculating the maximum allowed angle. For instance, the user can enter 0.01. Then, ask the user to enter a specified number of terms in the Taylors series. For instance, 1, 3 and 6 were used in lab 4. Then, calculate and print the maximum angle for which the approximated function is within the specified error. This is the maximum angle for which the sin() function approximation produces an error less than or equal than the specified error. When option 2 is selected, ask the user to enter the beginning angle in radians, the stop angle in radians, the number of points to display, and the number of terms in the Taylors series. Then, display two columns with headers ANGLE and ERROR. Then, print the angle, and next the error. Print one angle-error pair per line. Then, display the main menu again. Option 2 is useful in order to inspect the function errors over angles of interest.
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