[PD] better tabread4~
matju at artengine.ca
Thu Jun 26 18:18:20 CEST 2008
On Tue, 24 Jun 2008, Charles Henry wrote:
> On Tue, Jun 24, 2008 at 9:24 PM, Mathieu Bouchard <matju at artengine.ca> wrote:
>> I don't think that more than one alternative will be necessary. For 4-point
>> table lookups that go through all the original points, I don't know why
>> anyone would aim lower than a C2 piecewise-polynomial. Unfortunately, it
>> would be somewhat too late to just call it [tabread4~]. Or not.
> How low is too low? hmmm....
I fucked up here. To get a C2 curve you may need to solve an equation
system covering the whole table (!). Anyhow, a C1 system is fine enough
for most uses, and it would be already much better than pd's.
The thing is that you can only match the 2nd derivatives if you let the
1st derivatives just match but freely float. Then there will be one curve
going through all points of the whole table supposing that the 2nd
derivative is zero at the beginning and end of the table. Clearly this is
a wholly different game because you need to compute a 2nd table to
remember what the 1st derivatives are supposed to be and then you can't
change anything in the 1st table without recomputing the 2nd table from
scratch, or something.
> When we have an interval between samples, we wish to fit a polynomial
> (because it's fast, I guess) that satisfies our constraints. We could
> specify the polynomial has the same values at x[-1],x, x, x
No, you don't set those 4 constraints because else you will get exactly
the same polynomial that tabread4~ already figures out, and we know that
it is not C1. You need to drop x[-1] and x as conditions.
> or we could set x,x and x'=(x-x[-1])/2 and x'=(x-x)/2
> again, 4 constraints, cubic polynomial, etc...
Seems reasonable. What I want has to have constraints on x' and x'.
Those would be a possibility. The problem is that it uses a gap of 2
samples instead of one, so it uses a "blurry" derivative, but the
alternative is to have to pick between forward-difference and
backwards-difference. The "blurry" derivative happens to be the average of
the 1-sample forward-difference and backward-difference.
> and x''=x-2*x+x[-1] and x''=x-2*x+x
> 6 constraints, 5th degree polynomial
I think that the replacement for tabread4~ should be another cubic, so
that it takes almost the same time to compute it. What I said about C2 was
based on a mistaken reading of webpages trying to refresh myself on
splines. I should've been more careful.
> and if you additionally wanted it to actually go through x[-1] and
> x, it would be 7th degree
No, you shouldn't care about matching those extra points because anyway
only the curve between x and x is used. The two outer points should
be used only to figure out what derivatives to use.
> But not all possibilities are worth analyzing... I'm not even sure
> what kind of method to use to narrow the field.
The "blurry" derivative above seems to be fine... I'd have to try it, but
I should be working on other things now. I suppose that Cyrille already
has everything figured out anyway. I just feel like talking about math
_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
More information about the Pd-list