Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. You have already learned the formula for Simpson's rule. This is a perfect situation for using VBA and a For Loop. Use the data
4. You have already learned the formula for Simpson's rule. This is a perfect situation for using VBA and a For Loop. Use the data that was given to for problem 3,4 , which is X (conversion) and 1/ra (the inverse of consumption rate). Recall that we are going to integrate this data from X=0 to X=0.8, and further remember that after integrating you will need to multiply by 100 mol/ min (and further recall that you already did this once, so you know the answer that should come out!). There are two tricks required here. The first one, you learned while doing this problem for Trapezoid rule; using an If statement inside a For Loop with a counter "i". However, in this case, you need to use the If statement to break the world into 3 categories: 1) The first and the last data point, where the factors used by the Simpson's rule are equal to 1, 2) all even indexed data points, where the factors used by the Simpson's rule are equal to 4 , and 3) all odd indexed data points THAT ARE NOT THE FIRST OR LAST DATA POINT, where the factors used by the Simpson's rule are equal to 2. The trick that is required to determine if a number is odd or even is the Mod function. The Mod function will take two numbers and divide the first by the second and tell you what the remainder is. The idea would be to take the counter variable i and divide it by 2 ; if the remainder is 1 , the counter is odd, if the remainder is 0 , the counter is even. The syntax would be: Elself iMod2=0 Then You should already have the data from HW \#8 in columns A and B. Pull the data from the spreadsheet using Range variable types and the Set command. Ask the user for the number of data POINTS in an input box. You can find the delta X value in multiple ways, so l'll leave that to you. Print the value of your answer into cell D10. DO NOT HARDCODE the sequence of factors, i.e., 1,4,2,4,2,4,2,4,1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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