<div dir="ltr">On Wed, Feb 10, 2016 at 1:25 AM, <span dir="ltr"><<a href="mailto:spitzak@gmail.com" target="_blank">spitzak@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Bill Spitzak <<a href="mailto:spitzak@gmail.com">spitzak@gmail.com</a>><br>
<br>
Simpsons uses cubic curve fitting, with 3 samples defining each cubic. This<br>
makes the weights of the samples be in a pattern of 1,4,2,4,2...4,1, and then<br>
dividing the result by 3.<br>
<br>
The previous code was using weights of 1,2,6,6...6,2,1. Since it divided by<br>
3 this produced about 2x the desired value (the normalization fixed this).<br>
Also this is effectively a linear interpolation, not Simpsons integration.<br></blockquote><div><br></div><div>It is not true that the previous code used these weights because it only ran for half the segments (it had += 2). The intention with the code was to do both the 4 and the 2 weight in one loop, but for that to work a1 and a2 would have to be updated, which the code didn't do. So it was indeed buggy, and I think the new code is correct.<br><br></div><div>There should be spaces before the parentheses in the SAMPLE() macros, though.<br></div><div><br><br></div><div>Søren<br></div><br></div></div></div>