Question: 4 (a) Write, test and debug an adaptive 3-point Gaussian integration code gadap.m of the form function [int, abt] = gadap(a, b, f, r, tol)

![code gadap.m of the form function [int, abt] = gadap(a, b, f,](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f31e3ada625_01866f31e3a51f10.jpg)
4 (a) Write, test and debug an adaptive 3-point Gaussian integration code gadap.m of the form function [int, abt] = gadap(a, b, f, r, tol) % a,b: interval endpoints with a b % f: function handle f (x, r) to integrate % r: parameters for f % to1: User-provided tolerance for integral accuracy % nt: Approximation to the integral % abt: Endpoints and approximations Build a list abt = {a,, bi, tj, , [an, bn,tn]} of n intervals [aj, bj] and ap- proximate integrals t, J9 f(x,r)dx, computed with 3-point Gaussian in- T, r)dx, computed wl point GGaussian in tegration from problem 3. Initialize with n -1 and [a1, bi] - [a, b]. At eaclh step j = 1,2 , subdivide interval j into left and right half-intervals I and r, and approximate the integrals t and tr over each half-interval by 3-point Gauss ian quadrature. If 4 (a) Write, test and debug an adaptive 3-point Gaussian integration code gadap.m of the form function [int, abt] = gadap(a, b, f, r, tol) % a,b: interval endpoints with a b % f: function handle f (x, r) to integrate % r: parameters for f % to1: User-provided tolerance for integral accuracy % nt: Approximation to the integral % abt: Endpoints and approximations Build a list abt = {a,, bi, tj, , [an, bn,tn]} of n intervals [aj, bj] and ap- proximate integrals t, J9 f(x,r)dx, computed with 3-point Gaussian in- T, r)dx, computed wl point GGaussian in tegration from problem 3. Initialize with n -1 and [a1, bi] - [a, b]. At eaclh step j = 1,2 , subdivide interval j into left and right half-intervals I and r, and approximate the integrals t and tr over each half-interval by 3-point Gauss ian quadrature. If
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
