Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

From lecture we saw f(z) d1 = b-a holds from a simple linear change of variables

ID: 3348342 • Letter: F

Question

From lecture we saw f(z) d1 = b-a holds from a simple linear change of variables- +1 2. We are going to estimate log(1.9) with Gaussian quadrature and linear interpolation. We know -1 For 8 we have w[0.3626837833783620, 0.3626837833783620, 0.3137066458778873 0.3137066458778873, 0.2223810344533745, 0.2223810344533745 0.1012285362903763, 0.1012285362903763] and x= [-0.1834346424956498, 0.1834346424956498, -0.5255324099163290 0.5255324099163290, -0.7966664774136267, 0.7966664774136267, -0.9602898564975363, 0.9602898564975363] (a) (3 points) Implement (1) for n8 and verify that your result works by com puting log(1.9) using your code and the gausstable.m function. (b) (10 points) Now assume that the integrand f() is only known on the grid where In order to evaluate our integrand at the points required by Gaussian quadra ture we need to use interpolation. Find k such that the relative error for log(1.9) is near the relative error you found in problem 2a and remark on how the interpolation step changed the results

Explanation / Answer

W = [.. values ..]

X = [ ...values...]

f(x) = 1/x

log(1.9) = int_{1}^{1.9} f(x)dx = 0.45*int_{-1}^{1}f(1.45+0.45x)dx

so the matlab code for computing int_{-1}^{1}f(1.45+0.45x)dx become

y=1/(1.45+0.45*x)

R=y.*w

result = 0.45*sum(R)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote