User:Arseniiv/Fitting: Difference between revisions
m fix a typo |
m oh, mod wasn’t working at all, why would I write this?.. |
||
Line 15: | Line 15: | ||
A step of N-edX is <math>S := X/N</math>, so now we round <math>I_k</math> to integer multiples <math>S</math> to get their equalized variants: | A step of N-edX is <math>S := X/N</math>, so now we round <math>I_k</math> to integer multiples <math>S</math> to get their equalized variants: | ||
:: <math>E_k := \mathsf{round}(s I_k) / s</math><ref>if there’s no <math>\mathsf{round}(x)</math> function in your environment, it can be defined as | :: <math>E_k := \mathsf{round}(s I_k) / s</math><ref>if there’s no <math>\mathsf{round}(x)</math> function in your environment, it can be defined as <math>\lfloor x + \frac12 \rfloor - \frac12</math> using floor <math>\lfloor\ldots\rfloor</math>; these agree up to cases when <math>x</math> is exactly a half-odd-integer</ref>. | ||
Then we can get errors of this approximation as <math>\Delta_k := I_k - E_k</math>. Note that always <math>-\frac S2 \le \Delta_k \le +\frac S2</math> but the largest negative error and the largest positive error might not be “balanced” and sum to zero, nor any other measure of well-fitting might be minimized: all because we fixed ourselves to necessarily fit one of the notes exactly (<math>I_0</math> being exactly zero). We can fix that by subtracting the average <math>d</math> of all <math>\Delta_k</math> that we are interested in (arithmetic mean, RMS or something else), or, in the simplest case of minimizing the largest absolute error attained, subtract <math>d := \frac12(\min_k \Delta_k + \max_k \Delta_k)</math>. | Then we can get errors of this approximation as <math>\Delta_k := I_k - E_k</math>. Note that always <math>-\frac S2 \le \Delta_k \le +\frac S2</math> but the largest negative error and the largest positive error might not be “balanced” and sum to zero, nor any other measure of well-fitting might be minimized: all because we fixed ourselves to necessarily fit one of the notes exactly (<math>I_0</math> being exactly zero). We can fix that by subtracting the average <math>d</math> of all <math>\Delta_k</math> that we are interested in (arithmetic mean, RMS or something else), or, in the simplest case of minimizing the largest absolute error attained, subtract <math>d := \frac12(\min_k \Delta_k + \max_k \Delta_k)</math>. |