Question: Use Option Explicit and type all variables. Input from InputBox. Echo input values. Output to a file for both problems. Turn in your output file

Use Option Explicit and type all variables. Input from InputBox. Echo input values. Output to a file for both problems. Turn in your output file and your source listing.

1. Consider the following integral:

.2 [0.41 5--/(1-(1-.45 * x )12 ] * (1-x/ 2.22)

Write a VBA program to evaluate this integral using Simpson's 1/3 rule. Input the lower and upper limits and the first n from InputBox in the main Sub, Subl. But output from a 2nd Sub. Put the 1/3 rule in a 3rd Sub called by the main program. Use a function for the integrand. Note: you will need to include logic to account for the alternating 4's and 2's. Probably the easiest way is to include two for loops.

In the main Sub check your input to see that the input value of n is even. If not MsgBox a warning and leave the program and stop calculation. Begin with n 2. Compute the relative error, Ea, as the difference between the present value and the previous value. (For n - 2 the previous value was zero.) Put the call to Simpson inside a Do While loop and double n each time until you get an Ea value less than 103 in magnitude or you have made 15 attempts

Output should include each iterated value, and the corresponding values of n and Ea.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!