Question: Develop a VBA program using Richardson's extrapolation to approximate the value of the integral of a given function. Check your program for the function given
Develop a VBA program using Richardson's extrapolation to approximate the value of the integral of a given function. Check your program for the function given in problem 2 with n = 50 and n = 100. You program should contain one subroutine to evaluate the function values and another subroutine to approximate and integral using the trapezoidal rule. Use the following logic in the main program: n1 = n n2 = 2 * n Call traprule (a, b, n1, areal) Call traprule (a, b, n2, area 2) integration = (area2 * 4 - areal)/3 Your traprule subroutine should have this logic to calculate the trapezoidal rule: h = (bb - aa)n Call evaluatefunction (aa, fa) Call evaluatefunction (bb, fb) For i = 1 To nn - 1 x = aa + h * i Call evaluate function (x, fx) fxSum + fx Next i area = h * (fa + 2 * fxSum + fb)/Of course, you'll have to write a subroutine (here named "evaulatefunction") to determine the values of the function at each x value. Develop a VBA program using Richardson's extrapolation to approximate the value of the integral of a given function. Check your program for the function given in problem 2 with n = 50 and n = 100. You program should contain one subroutine to evaluate the function values and another subroutine to approximate and integral using the trapezoidal rule. Use the following logic in the main program: n1 = n n2 = 2 * n Call traprule (a, b, n1, areal) Call traprule (a, b, n2, area 2) integration = (area2 * 4 - areal)/3 Your traprule subroutine should have this logic to calculate the trapezoidal rule: h = (bb - aa)n Call evaluatefunction (aa, fa) Call evaluatefunction (bb, fb) For i = 1 To nn - 1 x = aa + h * i Call evaluate function (x, fx) fxSum + fx Next i area = h * (fa + 2 * fxSum + fb)/Of course, you'll have to write a subroutine (here named "evaulatefunction") to determine the values of the function at each x value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
