Question: Questions 1. Write a Matlab script that calls Romberg integration for f(x) = e-az from 0 to L with es = 10-12 and maxit =

Questions 1. Write a Matlab script that calls Romberg integration for f(x) = e-az from 0 to L with es = 10-12 and maxit = 100, for increasing value of L. 10 Start from L = 1 and increase L by 1 until is satisfied. We will call this value Lo. (Tip: Lo is less than 30) I e-arda 0 Ca 2. Compute the integral of f(x) = e-ax from 0 to Lo with the trapezoidal rule and the Simpson 1/3 rule for n-2,10, 40, 100, 400, 1000, n being the number of sub-intervals. For each n, compute the absolute error etrap to the exact value for the trapezoidal rule (not relative, not in %, ie. trap ?1, where trap is the trapezoidal approximation) and esimap the absolute error for the Simpson 1/3 rule (not relative, not in %, ie. ?simp-11, where simp is the Simpson 1/3 approximation). Plot the errors as a function of h- Lo in log-log in a single figure. Comment on the convergence rate Hand back your commented script, your errors plot and your comments on con- vergence Redo the same exercise for the integral of e, a> 0 between 0 and +o0. It is a bit more complicated, but it can be shown analytically that 0 Take a = 2, determine Lo using Romberg integration (with es = 10-12 and maxit-100) and eL = 10-10, and plot the errors for trapezoidal rule and Simpson 1/3 rule. (Tip: in this case, Lo is less than 10). The convergence is super-fast and totally unexpected. By a fortunate cancellation of errors, these 2 integration formulas are much more accurate than they are supposed to be, and precision issues occur for a rather small number of sub-intervals. Hand your commented script and your errors plot. Questions 1. Write a Matlab script that calls Romberg integration for f(x) = e-az from 0 to L with es = 10-12 and maxit = 100, for increasing value of L. 10 Start from L = 1 and increase L by 1 until is satisfied. We will call this value Lo. (Tip: Lo is less than 30) I e-arda 0 Ca 2. Compute the integral of f(x) = e-ax from 0 to Lo with the trapezoidal rule and the Simpson 1/3 rule for n-2,10, 40, 100, 400, 1000, n being the number of sub-intervals. For each n, compute the absolute error etrap to the exact value for the trapezoidal rule (not relative, not in %, ie. trap ?1, where trap is the trapezoidal approximation) and esimap the absolute error for the Simpson 1/3 rule (not relative, not in %, ie. ?simp-11, where simp is the Simpson 1/3 approximation). Plot the errors as a function of h- Lo in log-log in a single figure. Comment on the convergence rate Hand back your commented script, your errors plot and your comments on con- vergence Redo the same exercise for the integral of e, a> 0 between 0 and +o0. It is a bit more complicated, but it can be shown analytically that 0 Take a = 2, determine Lo using Romberg integration (with es = 10-12 and maxit-100) and eL = 10-10, and plot the errors for trapezoidal rule and Simpson 1/3 rule. (Tip: in this case, Lo is less than 10). The convergence is super-fast and totally unexpected. By a fortunate cancellation of errors, these 2 integration formulas are much more accurate than they are supposed to be, and precision issues occur for a rather small number of sub-intervals. Hand your commented script and your errors plot
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
