The arguments passed down to intpoly are the polynomial


Create a function called intpoly( ) that can numerically integrate the polynomial function y = ax2 + bx + c from a lower limit to an upper limit, where a, b, and c are constants. Your numerical integrator must allow the user to use the Trapezoidal method or Riemann sums method (as we used in discussion) depending on the choice of the user. If the value of choice is 1, the Riemann sums method will be used to numerically integrate the polynomial (you may use either a left, right, or midpoint Riemann sums method). If the value of choice is 2, the Trapezoidal method will be used to numerically integrate the polynomial.

The main program calls the function intpoly( ) and has the following form:

% numerically integrate y(x) = ax^2 + bx + c

%  from lowerlimit to upperlimit

a = 2; b = 2; c = 1;

% from 0 to 1

lowerlimit = 0;

upperlimit = 1;

% number of discretizations

N = 1000;

% choice: 1 = Riemann, 2 = Trapezoidal

choice = 2;

disp( intpoly(a,b,c,lowerlimit,upperlimit,N,choice) )

The arguments passed down to intpoly( ) are the polynomial coefficients (a,b,c), the lower and upper limits of integration (lowerlimit,upperlimit), the number of discretizations (N), and the method of integration (choice). The area is returned to the main program.

Solution Preview :

Prepared by a verified Expert
Business Management: The arguments passed down to intpoly are the polynomial
Reference No:- TGS02308237

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)