Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Problem 5 : Error analysis in the Riemann Sum Algorithm When using the left Riemann sum algorithm, one does not know a priori what step
Problem : Error analysis in the Riemann Sum Algorithm When using the left Riemann sum algorithm, one does not know a priori what step size or number of intervals to choose so that the result is accurate to within a desired error tolerance the maximum error that can be tolerated This choice depends on the given function to integrate. For example, if one integrates the constant function, an algorithm using produces the exact result, ie no error. a Modify the rmlsum file to include a whileloop so that the program code terminates when an accuracy based on relative approximate error is achieved. In each iteration of the whileloop, double the number of the intervals ie the step size is reduced by one half in the numerical integration algorithm. The function's inputoutput structure should be: function fun maxtol where, I is the approximate result of the integration and is the number of intervals that would yield a result to satisfy the error tolerance criterion. Note that this output value of is not necessarily the minimum number of intervals to achieve the error tolerance. Apply this numerical solver to the following integral using maxtol One potential difficulty of the above approach is that it might take many iterations to achieve the error tolerance. In general, one would like to set a maximum number of iterations. b Modify the above numerical solver so that the whileloop checks both the error tolerance and the maximum number of iterations. In other words, the loop terminates when either the error is sufficiently small, or the maximum number of iterations is exceeded. The function structure should be: function fun maxtol, maxitr Test your program code on the same integral from part a using maxtol and maxit Note that because the number of intervals is doubled in each iteration, iterations would result in
Problem : Error analysis in the Riemann Sum Algorithm
When using the left Riemann sum algorithm, one does not know a priori what step size or number of intervals to choose so that the result is accurate to within a desired error tolerance the maximum error that can be tolerated This choice depends on the given function to integrate. For example, if one integrates the constant function, an algorithm using produces the exact result, ie no error.
a Modify the rmlsum file to include a whileloop so that the program code terminates when an accuracy based on relative approximate error is achieved. In each iteration of the whileloop, double the number of the intervals ie the step size is reduced by one half in the numerical integration algorithm. The function's inputoutput structure should be:
function fun maxtol
where, I is the approximate result of the integration and is the number of intervals that would yield a result to satisfy the error tolerance criterion. Note that this output value of is not necessarily the minimum number of intervals to achieve the error tolerance.
Apply this numerical solver to the following integral using maxtol
One potential difficulty of the above approach is that it might take many iterations to achieve the error tolerance. In general, one would like to set a maximum number of iterations.
b Modify the above numerical solver so that the whileloop checks both the error tolerance and the maximum number of iterations. In other words, the loop terminates when either the error is sufficiently small, or the maximum number of iterations is exceeded. The function structure should be:
function fun maxtol, maxitr
Test your program code on the same integral from part a using maxtol and maxit Note that because the number of intervals is doubled in each iteration, iterations would result in
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started