Compact Simpson's 3/8 Rule(??)
10-04-2019, 06:20 PM
Post: #19
 Albert Chan Senior Member Posts: 1,659 Joined: Jul 2018
RE: Compact Simpson's 3/8 Rule(??)
(09-25-2019 06:47 PM)Csaba Tizedes Wrote:
Code:
h = (b - a) / n sum = f(a) + f(b) For i = 1 To n - 3 Step 3   sum = sum + 3 * f(a + i * h) + 3 * f(a + (i+1) * h) + 2 * f(a + (i+2) * h) Next result = 3 / 8 * h * sum

I don't think this work.
We assumed n divisible by 3, and put a weight of 1 (3 3 2) ... (3 3 2) 3 3 1

However, above generate weight of 1 (3 3 2) ... (3 3 2) 0 0 1

You could also pull the (2*, 3*, 3*) from inside the loop, and scale it all in 1 step.
Code:
h = (b - a) / n s2 = 0 s3 = f(a + h) + f(a + 2*h) For i = 3 To n-3 Step 3     s2 = s2 + f(a + i*h)     s3 = s3 + f(a + (i+1)*h) + f(a + (i+2)*h) Next i result = 3/8 * h * (f(a) + f(b) + 2*s2 + 3*s3)
 « Next Oldest | Next Newest »

 Messages In This Thread Compact Simpson's 3/8 Rule(??) - Namir - 12-13-2015, 02:26 PM RE: Compact Simpson's 3/8 Rule(??) - Dieter - 12-13-2015, 03:38 PM RE: Compact Simpson's 3/8 Rule(??) - rprosperi - 12-13-2015, 04:05 PM RE: Compact Simpson's 3/8 Rule(??) - Dieter - 12-13-2015, 04:39 PM RE: Compact Simpson's 3/8 Rule(??) - toml_12953 - 09-25-2019, 10:02 PM RE: Compact Simpson's 3/8 Rule(??) - walter b - 12-13-2015, 07:32 PM RE: Compact Simpson's 3/8 Rule(??) - rprosperi - 12-13-2015, 08:09 PM RE: Compact Simpson's 3/8 Rule(??) - Dieter - 12-14-2015, 08:13 PM RE: Compact Simpson's 3/8 Rule(??) - rprosperi - 12-14-2015, 08:44 PM RE: Compact Simpson's 3/8 Rule(??) - Dieter - 12-18-2015, 09:19 PM RE: Compact Simpson's 3/8 Rule(??) - Namir - 12-13-2015, 05:05 PM RE: Compact Simpson's 3/8 Rule(??) - Dieter - 12-13-2015, 07:45 PM RE: Compact Simpson's 3/8 Rule(??) - Csaba Tizedes - 09-25-2019, 06:47 PM RE: Compact Simpson's 3/8 Rule(??) - Thomas Klemm - 12-18-2015, 11:58 PM RE: Compact Simpson's 3/8 Rule(??) - rprosperi - 12-19-2015, 01:51 AM RE: Compact Simpson's 3/8 Rule(??) - walter b - 12-19-2015, 07:39 AM RE: Compact Simpson's 3/8 Rule(??) - Dieter - 12-19-2015, 08:53 AM RE: Compact Simpson's 3/8 Rule(??) - rprosperi - 12-19-2015, 05:24 PM RE: Compact Simpson's 3/8 Rule(??) - Albert Chan - 10-04-2019 06:20 PM

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