Question: Please answer this code in C language. Guidelines : https://www.math.ucdavis.edu/~bremer/classes/fall2018/MAT128a/traprule.c Testcode: https://www.math.ucdavis.edu/~bremer/classes/fall2018/MAT128a/traptest1.c The integral (z) dr can be (crudely) estimated by approximating the area under

Please answer this code in C language.

Please answer this code in C language. Guidelines : https://www.math.ucdavis.edu/~bremer/classes/fall2018/MAT128a/traprule.c Testcode: https://www.math.ucdavis.edu/~bremer/classes/fall2018/MAT128a/traptest1.c

Guidelines : https://www.math.ucdavis.edu/~bremer/classes/fall2018/MAT128a/traprule.c

Testcode: https://www.math.ucdavis.edu/~bremer/classes/fall2018/MAT128a/traptest1.c

The integral (z) dr can be (crudely) estimated by approximating the area under the graph of (r) by a tapzod. In other words, by approximating the integrand via the affine function (a)b (b)a whose graph passes through points (a. /(a)) and (b. J(b)) This procedure gives us the (crude) approximation We now suppose that n > 1 is an integer, and let {r,r,n, points defined by r) be the sequence of (n + 1) If we decompose the integral (1) as 1(r) dr = (r) dr and use the preceding approximation to estimate each of the integrals in 2), then we obtain the J(z) dr = (r) dr -0 We call (3) the (n +1)-point trapezoidal quadrature rule on the interval [a, b . The points ro, ,-, Fm are called the nodes of the )-point trapezoidal rule on a, t, and the quantities o,w..u defined by where if j=0, n are called the weights of the (n1)-point trapezoidal rule. Note that using this notation, (3) can be rewritten as 7-0 Project one consists of writing a function called "traprule" which calculates the (n 1)-point trapezoidal rule. More specifically, your routine will take as input an integer 0 and double precision numbers b. It will return the nodes ro,n, rn and weights -uri, un of the (n 1)-point trapezoidal routine in user-supplied arrays. The file "traprule.c" gives the calling syntax for the "trapu" function. Your task is to implement the function as described there. The integral (z) dr can be (crudely) estimated by approximating the area under the graph of (r) by a tapzod. In other words, by approximating the integrand via the affine function (a)b (b)a whose graph passes through points (a. /(a)) and (b. J(b)) This procedure gives us the (crude) approximation We now suppose that n > 1 is an integer, and let {r,r,n, points defined by r) be the sequence of (n + 1) If we decompose the integral (1) as 1(r) dr = (r) dr and use the preceding approximation to estimate each of the integrals in 2), then we obtain the J(z) dr = (r) dr -0 We call (3) the (n +1)-point trapezoidal quadrature rule on the interval [a, b . The points ro, ,-, Fm are called the nodes of the )-point trapezoidal rule on a, t, and the quantities o,w..u defined by where if j=0, n are called the weights of the (n1)-point trapezoidal rule. Note that using this notation, (3) can be rewritten as 7-0 Project one consists of writing a function called "traprule" which calculates the (n 1)-point trapezoidal rule. More specifically, your routine will take as input an integer 0 and double precision numbers b. It will return the nodes ro,n, rn and weights -uri, un of the (n 1)-point trapezoidal routine in user-supplied arrays. The file "traprule.c" gives the calling syntax for the "trapu" function. Your task is to implement the function as described there

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!