Compact Simpson's 3/8 Rule(??)
|
12-13-2015, 02:26 PM
(This post was last modified: 12-13-2015 03:07 PM by Namir.)
Post: #1
|
|||
|
|||
Compact Simpson's 3/8 Rule(??)
Here is the pseudo-code for a compact version of Simpson's 3/8 Rule. This rule divides the integral range [A, B] into N (=3m where m>1) divisions. The area is calculated using:
area = 3*h/8*(f(A) + 3*f(x(1)) + 3*f(x(2)) + 2*f(x(3)) + ... + f(B)) The following pseudo-code is able to apply the sequence of coefficient values of 3,3, and 2 for every three points, starting with x=A+h and until X=B-h. Code: Give f(x), interval [A, B] and N divisions where N=3m for any m>1. The variable I cycles between 1, 2, and 3. The coefficient C is calculated using a special (and simple) quadratic equation to yield 3, 3, and 2 for I=1, 2, and 3. Here is an alternate form that uses memory registers (suitable for calculators) Code: Give f(x), interval [A, B] and N divisions where N=3m for any m>1. The main point in this thread and the one about a compact (basic) Simpson's Rule is to perform one summation of f(x) per loop iteration. Enjoy! Namir |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)