Question
USING C++ trapezium function double trapezium(int trapezoids, double interval_start, double interval_end) { double span = (interval_end - interval_start) / trapezoids; int iter = 0; double
USING C++
trapezium function
double trapezium(int trapezoids, double interval_start, double interval_end) { double span = (interval_end - interval_start) / trapezoids; int iter = 0; double sum = 0; double x_0 = interval_start; while (iter B. (20 points) Approximating the Value of the Fresnel Integral, C(x) The Fresnel integrals: cos ( ) dt and S(x) sin (- ) dt appear in a number of areas of science and engineering Write a C++ program that has the user input a positive value x (of type double) and a positive value MaxTrapezoids (of type int), and then approximates C(x) using the Trapezium integration method First approximate C(r) using the Trapezium method with 1 trapezoid, then with 2 trapezoids, and so on, each time increasing the number of trapezoids by one until the last estimate uses MaxTrapeziods trapezoids. For each approximation, the program should print out the number of trapezoids used in that estimate and the result of the estimate. This process should be in a user-controlled continuation loop, as shown in the following example (user input is in Bold font): Enter x: 3.14159265 Enter # of Estimates (trapezoids): Estimates 1 2 C(x) 0.03283499 1.14969834 0.71268699 0.72872487 0.05055231 Continue? (y): y
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