Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions