4. myimproperintegral(f,a,tol) which takes three inputs: a: A real number. f: A
ID: 3372640 • Letter: 4
Question
4. myimproperintegral(f,a,tol) which takes three inputs:
a: A real number.
f: A function handle for a function for which the improper integral R %u221E
a
f(x) dx converges.
tol: A real number assumed to be positive and quite small.
Approximates R %u221E
a
f(x) dx. The way this should work is as follows: Use a while loop to approximate
R b
a
f(x) dx using quad for b = a, a + 1, a + 2, ... until successive values di%uFB00er by less than tol.
Returns: The %uFB01nal value.
this is an example of what you should get
5. myintegralapprox(f,a,b,tol) which takes four inputs:
f: A function handle.
a: A real number.
b: A real number assumed to be greater than a.
tol: A real number assumed to be positive and quite small.
Approximates R b
a
f(x) dx. The way this should work is as follows: Start by setting a variable n = 1.
A for loop on the inside should calculate the midpoint sum using n intervals and a while loop on the
outside should test successive midpoint sums until two successive sums di%uFB00er by less than tol. Each
time the value of n should increase by 1.
Returns: The %uFB01nal value.
this is an example of what you should get
Explanation / Answer
k
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.