Question: Write a function that calculates the discrete integral of another function using Romberg integration by continuously doubling the number of intervals until a specified level

Write a function that calculates the discrete integral of another function using Romberg integration by continuously doubling the number of intervals until a specified level of ac- curacy has been met. The integrating function should output the value of the integral and print out the number of steps taken. Keep the following things in mind The first input into your function will be another function. you will have a variable, let's say f that will become any function the use inputs sin, cos, Log, etc... to input a function, it is necessary to use the Q symbol, but you will be able to use f as any other function see the difference.m function as a template . You don't need to keep track of the entire integral table (like we did in the example on paper), just the diagonal values. Core requirements Function name integrate Input Output Example a function handle, lower bound, upper bound, tolerance the estimated area (and a printout of how many intervals used) integrate(aexp, 0, 1, 1e-6) should output 1.7183 (with 64 intervals used Write a function that calculates the discrete integral of another function using Romberg integration by continuously doubling the number of intervals until a specified level of ac- curacy has been met. The integrating function should output the value of the integral and print out the number of steps taken. Keep the following things in mind The first input into your function will be another function. you will have a variable, let's say f that will become any function the use inputs sin, cos, Log, etc... to input a function, it is necessary to use the Q symbol, but you will be able to use f as any other function see the difference.m function as a template . You don't need to keep track of the entire integral table (like we did in the example on paper), just the diagonal values. Core requirements Function name integrate Input Output Example a function handle, lower bound, upper bound, tolerance the estimated area (and a printout of how many intervals used) integrate(aexp, 0, 1, 1e-6) should output 1.7183 (with 64 intervals used
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
