JPhrases/SimpsonIntegraton/ExtremeTesting
Simpson Integration: How to Test it
This continues the testing done here but carried to extremes.
Our basic sanity test of integrating with the Simpson method was one that is very well-defined with a known answer of zero. However, there is a known "busy" function - (1 o. %) - which is the sine of the reciprocal of x as x approaches zero. This still ought to integrate to very close to zero as the function is still periodic with roughly equal positive and negative areas.
So we can define this busy function like this:
Marge=: 1 o. %
This is what Marge looks like from 0.0001 to 0.001 for 10,000 points:
How good is our Simpson integration over this same range?
That does not look too bad. We are off by very small amounts.
An Even Busier Function
Now let's look at an even busier "function":
Bart=: ([: -/\ 1 o. %) * [: -/\ 2 o. %
Uh oh! Bart looks like a monster! Here is how well it integrates:
It's not bad for such a monster.