If fx is approximated by the three-point centered


Part A -

1) Derive a 4-point formula for an approximation of f"(x) in terms of f(x-3h), f(x-h), f (x), and (x + 2h). Hint: write the Taylor series for f(x - 3h), f(x - h), and f(x+ 2h), and take an appropriate linear combination of these. Also, find the error term.

2) If f"(x) is approximated by the Three-Point Centered Difference formula.

f(x - h) - 2f(x) + f(x + h)/h2

Find the value of the step size, h, which minimizes the upper bound of |E(f, h)|, where E(f, h) is the sum of the round-off and truncation errors. As in class, start by letting f(x- h) y- + ε-, f(x + h) = y+ + ε+, and f(x) = y0 + ε0, where it y-, y0 and y+ are the approximate values of the function evaluations, and ε-, ε0 and ε+ are the errors. Again, assume that |ε-| ≈ ε, |ε0| ≈ ε, and |ε+| ≈ ε, where ε is approximately machine epsilon.

3) Apply Richardson's Extrapolation once starting with the Two-Point Backward Difference formula, f(x) - f(x-h)/h to find a higher-order formula to approximate f '(x). This formula is of what order?

4) Integrate Newton's divided-difference interpolating polynomial to prove the formula

-hh P(x) dx = (1/3)h.

1386_Figure.png

5) Consider the quadrature rule

01f(x)dx ≈ c1f(0) + c2f(1/4) + c3f(1)

Find c1, c2, and c3 such that the quadrature rule integrates the functions f(x) = 1, x, and x2 exactly. (Note that the points are not evenly spaced.) What is the degree of precision of this quadrature formula?

6) Recall that the error in a quadrature rule based on an interpolant P(x) = ax2 + bx + c for f(x) on three evenly-spaced nodes x0, x1, and x2, can be written as

E(x) = x_0x_2((x - x0) (x - x1)( x - x2 )f"(c(x))/6)dx

Find an upper bound for |E(x)| in terms of h. the distance between adjacent nodes, and M3, where M3 = maxx∈[x0-x2]|If"(x)|. You may use the fact that |abF(x)dx| ≤ ab|F(x)|dx for any integrable function F(x)and interval [a, b].

7) If 01 ex^2 dx is approximated with the Composite Trapezoid Rule, determine the number of panels m needed for the upper bound of the absolute value of the error term to be less than any positive real number E.

8) Apply the composite Simpson's Rule with m = 2 panels to the integral. Compute the absolute error between the exact integral and the approximation.

0πxcosxdx

9) Can use calculator with 4 digit rounding. Apply Romberg Integration to find R33 for the integral

01x2dx

Part B -

1) Compute a vector of the exact absolute errors in the Three-Point Centered Difference formula for f"(2), where f(x) = sinx, with h = 10-1,...,10-12. Plot your vector versus h using MATLAB's loglog(). Use the vector to estimate the optimal value of h in MATLAB, and compare this value with your results in problem #2. Use ε = 10-16 (roughly machine epsilon), and also use an upper bound for the fourth derivative for all x ∈ R. What happens as h keeps getting smaller?

2) Write a function m-file to approximate the integral in #7 with the Composite Trapezoid Rule on m panels. The function should accept any number of panels m, any integration bounds, a and b, and any function, func, as input: function int = trapfun (m, a, b, func).

First, run your function for m = 100 panels, and output the approximation. Next, to achieve an error of E = 10-6, run your function with the value of m using your result in #7. Output this approximation.

7) If 0∫1ex^2dx is approximated with the Composite Trapezoid Rule, determine the number of panels m needed for the upper bound of the absolute value of the error term to be less than any positive real number E.

3) Now, write a function m-file to approximate the integral in #7 with the Composite Simpson's Rule on m panels. The function should accept any number of panels m, any integration bounds, a and b, and any function, func, as input function int = simpfun (m, a, b, func). Run your problem for m = 50 panels, and output the approximation.

4) Modify the function romberg.m posted in eLearning, to a function, called rombergmod, that stops generating rows of the matrix (tableau) when the absolute value of the difference between successive diagonal entries is less than a specified error, i.e., use the function call,

r = rombergmod[f, a, b, error]

Inside the function, set the maximum number of rows to be a "large" number, specifically 100. You may need to use an external function m-file, romfun.m, for the function input for f. Run your function for error 0.5x10-8. How many function evaluations (evaluations of the integrand) are used to compute the last diagonal element in the matrix, given this error? This element is what order of approximation?

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Simulation in MATLAB: If fx is approximated by the three-point centered
Reference No:- TGS01699033

Expected delivery within 24 Hours