analytics

Friday, August 15, 2014

smooth curve fitting by triangularization of derivative

Suppose you have some points, for this example I'll use:
[[1,1],[3,3],[4,2]]
Like so:
First connect them with straight lines:
Now imagine you are considering the derivative:
The next step is to do what I'm calling triangularizing the above step function. This means to find the midpoints of AB and CD, E and F. Then find the point G that preserves the total area under the original step function. 
This makes a new curve when you remove B and C, 
Now this is a new approximation for the derivative, so we integrate and set the constant of integration so A goes to [1,1] where it was originally:
To get smoother and smoother approximation, iterate the derivative and triangularization step and integrate the corresponding number of times. 





Monday, August 11, 2014

Dimensional interpolation

Suppose you have a list of points symmetrically distributed around x=0 at integers...
For this method you need (n-1)/2 variables so in this case for 5 points we need 2, let's call them x and y....
Consider the following polynomial in 2 variables with 9 a(n) coefficients:
I generate the following table based on the points to be interpolated, x and y can each have values [-1,0,1], and the sum x+y is related to the range of the function. So x=-1 y=-1 x+y = -2, from the list of points the value of the function at -2 is 3 so A is three there. 
So I can solve for the 9 unknowns a1..a9 with 9 equations made from the table above:

So we can vary x between -1..1 and y between -1..1 with every possible pairwise combination to generate a plot:

Note that it is not single valued, because there are a lot of ways to add to 0 with x equaling a number between -1 and 1 and y also a number from -1 to 1. But it still does nicely interpolate the points other than that.
I haven't tried but I imagine wider ranges with more variables would work as well. I also suppose you could narrow the thickness of the band by ranging one variable over a smaller interval like y from -.5...5 and x from -1.5..1.5

Sunday, August 10, 2014

ruler

Every distance between 1 and 50 is between some pair of lines on this ruler:
Some are duplicates because there are 13 lines and 13*12/2 = 78 possible pairings and only 50 possible markings. It seemed not to be possible to make one where every distance is only marked once, as I showed for a bunch of cases on the computer by exhaustion.