Talk:Numerical integration: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Parser note (C): add note about copying incorrect Java and Ada)
(→‎Copying Bad Code: a little more explanation please)
Line 7: Line 7:
It seems a lot of people copied the Java and Ada entries without actually thinking about the code or testing it. The right rectangle examples were leaving out the final rectangle; this was originally probably a copy/paste error from the left-rectangle, which does want to stop 1 h early. The mid rectangle routines were all just averaging the beginning and endpoint of each rectangle rather than sampling the middle. This is essentially recreating trapezium. In some cases, trapezium is also wrong, because while you count the endpoints only once, each interior function is used twice, and should be multiplied by 2. These particular entries were not doing that. Testing would have found most of these problems.
It seems a lot of people copied the Java and Ada entries without actually thinking about the code or testing it. The right rectangle examples were leaving out the final rectangle; this was originally probably a copy/paste error from the left-rectangle, which does want to stop 1 h early. The mid rectangle routines were all just averaging the beginning and endpoint of each rectangle rather than sampling the middle. This is essentially recreating trapezium. In some cases, trapezium is also wrong, because while you count the endpoints only once, each interior function is used twice, and should be multiplied by 2. These particular entries were not doing that. Testing would have found most of these problems.
--[[User:TimToady|TimToady]] 07:51, 11 September 2010 (UTC)
--[[User:TimToady|TimToady]] 07:51, 11 September 2010 (UTC)
:IIRC I copied the C example to make the Java example. I had used the C example for a homework assignment in college on these algorithms. I'd like a little more explanation on these problems. Maybe some pseudocode? You understand my resistance since I probably spent a week or two talking about these integration rules in a class with a reputable professor at my college. It is highly possible that I still didn't code them right, though. --[[User:Mwn3d|Mwn3d]] 16:19, 11 September 2010 (UTC)

Revision as of 16:19, 11 September 2010

The Trap function in the Java example does not call F(X). Is this an error? --Waldorf 14:21, 21 December 2007 (MST)

Good catch. I'm working on it now. --Mwn3d 14:29, 21 December 2007 (MST)

Parser note (C)

Writing the C code, I've used the var name If (Integrated function, in my mind), and noticed the syntax highlighter highlights If as if! It should be case sensitive! --ShinTakezou 23:38, 16 December 2008 (UTC)

Copying Bad Code

It seems a lot of people copied the Java and Ada entries without actually thinking about the code or testing it. The right rectangle examples were leaving out the final rectangle; this was originally probably a copy/paste error from the left-rectangle, which does want to stop 1 h early. The mid rectangle routines were all just averaging the beginning and endpoint of each rectangle rather than sampling the middle. This is essentially recreating trapezium. In some cases, trapezium is also wrong, because while you count the endpoints only once, each interior function is used twice, and should be multiplied by 2. These particular entries were not doing that. Testing would have found most of these problems. --TimToady 07:51, 11 September 2010 (UTC)

IIRC I copied the C example to make the Java example. I had used the C example for a homework assignment in college on these algorithms. I'd like a little more explanation on these problems. Maybe some pseudocode? You understand my resistance since I probably spent a week or two talking about these integration rules in a class with a reputable professor at my college. It is highly possible that I still didn't code them right, though. --Mwn3d 16:19, 11 September 2010 (UTC)