Simpson's Rule Implementation trick?
03-18-2016, 08:47 PM
Post: #3
 Namir Senior Member Posts: 1,004 Joined: Dec 2013
RE: Simpron Rule Implementation trick?
By initializing the sum as:

Code:
sum = f(a) + f(b) + 4*f(a+h)

Code:
 sum = f(a) + f(b)
We can then iterate over the terms multiplied by 2 and then by 4. We can do this:

Code:
for i=2 to n step 2   sum = sum + 2*f(a+i*h) + 4*f(a + (i+1)*h) next

Or, borrowing from the old threads:

Code:
c = 2 for i=2 to n   x = x + h   sum = sum + c*f(x)   c = 6 - c next
 « Next Oldest | Next Newest »

 Messages In This Thread Simpson's Rule Implementation trick? - Namir - 03-18-2016, 12:11 AM RE: Simpson Rule Implementation trick? - Dieter - 03-18-2016, 01:14 PM RE: Simpron Rule Implementation trick? - Namir - 03-18-2016 08:47 PM RE: Simpron Rule Implementation trick? - Vtile - 03-18-2016, 11:15 PM RE: Simpron Rule Implementation trick? - Namir - 03-18-2016, 11:53 PM RE: Simpron Rule Implementation trick? - Vtile - 03-19-2016, 01:14 AM RE: Simpron Rule Implementation trick? - ttw - 03-19-2016, 04:59 AM RE: Simpron Rule Implementation trick? - Dieter - 03-19-2016, 06:45 AM RE: Simpron Rule Implementation trick? - Namir - 03-19-2016, 02:21 PM RE: Simpson Rule Implementation trick? - Dieter - 03-19-2016, 05:05 PM RE: Simpron Rule Implementation trick? - Paul Dale - 03-19-2016, 06:50 AM RE: Simpron Rule Implementation trick? - Namir - 03-19-2016, 02:22 PM

User(s) browsing this thread: 1 Guest(s)