Post Reply 
The most compact algorithm for Simpson's rule??
12-12-2015, 09:16 PM (This post was last modified: 12-12-2015 10:14 PM by Dieter.)
Post: #6
RE: The most compact algorithm for Simpson's rule??
(12-12-2015 08:29 PM)Namir Wrote:  Yes, A ends up as B+h causing the loop to stop iterating.

Since the test if A>B is done *after* the summation this leads to f(B+h) as the last added term – and yields a wrong result. The last term should be f(B–h), resp. f(B) with your method of computing this value twice. As already suggested, all this is better done with a simple loop counter.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: The most compact algorithm for Simpson's rule?? - Dieter - 12-12-2015 09:16 PM



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