View Single Post
Old 21st May 2009, 06:55   #43  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
@Wilbert,

From your post 7 you missed out on the polynomial for the [-4,-3]segment. Also some of the constraints were not present. I have marked these in Red. Also some of the constraints you have expressed in negated form, these I have adjusted these and marked them in Blue, the original expression is above in Light Gray.
Code:
Y_I(x) = h3*x3 + h2*x2 + h1*x + h0, for x in [-4,-3]
Y_I(x) = g3*x3 + g2*x2 + g1*x + g0, for x in [-3,-2]
Y_I(x) = f3*x3 + f2*x2 + f1*x + f0, for x in [-2,-1]
Y_I(x) = e3*x3 + e2*x2 + e1*x + e0, for x in [-1,0]
Y_I(x) = a3*x3 + a2*x2 + a1*x + a0, for x in [0,1]
Y_I(x) = b3*x3 + b2*x2 + b1*x + b0, for x in [1,2]
Y_I(x) = c3*x3 + c2*x2 + c1*x + c0, for x in [2,3]
Y_I(x) = d3*x3 + d2*x2 + d1*x + d0, for x in [3,4]
Analysing the set of constraints it appears that half are redundant, this make sense as the overall function is symmetrical about zero.

Extracting the sets of constraint equations to do with each polynomial and pairing it with it's reflection about zero gives :-

Equations for ai & ei
Code:
  y2 = -e3 + e2 - e1 + e0
  y4 =  a3 + a2 + a1 + a0

  y3 = e0
  y3 = a0

  3*f3 - 2*f2 + f1 =  3*e3 - 2*e2 + e1
 -3*e3 + 2*e2 - e1 = -3*f3 + 2*f2 - f1
  3*a3 + 2*a2 + a1 =  3*b3 + 2*b2 + b1

 -6*f3 + 2*f2 = -6*e3 + 2*e2
  6*a3 + 2*a2 =  6*b3 + 2*b2

  e1 = a1

  2*e2 = 2*a2
Equations for bi & fi
Code:
  y1 = -8*f3 + 4*f2 - 2*f1 + f0
  y5 =  8*b3 + 4*b2 + 2*b1 + b0

  y2 = -f3 + f2 - f1 + f0
  y4 =  b3 + b2 + b1 + b0

  12*g3 - 4*g2 + g1 =  12*f3 - 4*f2 + f1
 -12*f3 + 4*f2 - f1 = -12*g3 + 4*g2 - g1
  12*b3 + 4*b2 + b1 =  12*c3 + 4*c2 + c1

 -12*g3 + 2*g2 = -12*f3 + 2*f2
  12*b3 + 2*b2 =  12*c3 + 2*c2

  3*f3 - 2*f2 + f1 =  3*e3 - 2*e2 + e1
 -3*e3 + 2*e2 - e1 = -3*f3 + 2*f2 - f1
  3*a3 + 2*a2 + a1 =  3*b3 + 2*b2 + b1

 -6*f3 + 2*f2 = -6*e3 + 2*e2
  6*a3 + 2*a2 =  6*b3 + 2*b2
Equations for ci & gi
Code:
  y0 = -27*g3 + 9*g2 - 3*g1 + g0
  y6 =  27*c3 + 9*c2 + 3*c1 + c0

  y1 = -8*g3 + 4*g2 - 2*g1 + g0
  y5 =  8*c3 + 4*c2 + 2*c1 + c0

 -27*g3 + 6*g2 + g1 = -27*h3 + 6*h2 + h1
  27*c3 + 6*c2 + c1 =  27*d3 + 6*d2 + d1

 -18*g3 + 2*g2 =  -18*h3 + 2*h2
  18*c3 + 2*c2 =  18*d3 + 2*d2

 -18*g3 + 2*g2 = 0
  18*c3 + 2*c2 = 0

  12*g3 - 4*g2 + g1 =  12*f3 - 4*f2 + f1
 -12*f3 + 4*f2 - f1 = -12*g3 + 4*g2 - g1
  12*b3 + 4*b2 + b1 =  12*c3 + 4*c2 + c1

 -12*g3 + 2*g2 = -12*f3 + 2*f2
  12*b3 + 2*b2 =  12*c3 + 2*c2
Equations for di & hi
Code:
  y-1= -64*h3 + 16*h2 - 4*h1 + h0
  y7 =  64*d3 + 16*d2 + 4*d1 + d0

  y0 = -27*h3 + 9*h2 - 3*h1 + h0
  y6 =  27*d3 + 9*d2 + 3*d1 + d0

 -24*h3 + 2*h2 = 0
  24*d3 + 2*d2 = 0

 -27*g3 + 6*g2 + g1 = -27*h3 + 6*h2 + h1
  27*c3 + 6*c2 + c1 =  27*d3 + 6*d2 + d1

 -18*g3 + 2*g2 = -18*h3 + 2*h2
  18*c3 + 2*c2 =  18*d3 + 2*d2
Thus the system should be solvable with just this half of the equations.
Code:
> eqn:={
> y3 = a0,
> y4 = a3 + a2 + a1 + a0,
> y4 = b3 + b2 + b1 + b0,
> y5 = 8*b3 + 4*b2 + 2*b1 + b0,
> y5 = 8*c3 + 4*c2 + 2*c1 + c0,
> y6 = 27*c3 + 9*c2 + 3*c1 + c0,
> y6 = 27*d3 + 9*d2 + 3*d1 + d0,
> y7 = 64*d3 + 16*d2 + 4*d1 + d0,
> 3*a3 + 2*a2 + a1 = 3*b3 + 2*b2 + b1,
> 12*b3 + 4*b2 + b1 = 12*c3 + 4*c2 + c1,
> 27*c3 + 6*c2 + c1 = 27*d3 + 6*d2 + d1,
> 6*a3 + 2*a2 = 6*b3 + 2*b2,
> 12*b3 + 2*b2 = 12*c3 + 2*c2,
> 18*c3 + 2*c2 = 18*d3 + 2*d2,
> 18*c3 + 2*c2 = 0,
> 24*d3 + 2*d2 = 0};
Can you please confirm this with your Maple Wilbert.

Also I think this constraint is also available 12*b3 + 2*b2 = 0, not sure about the 12 maybe it should be 9, my brain is quite rusty on this stuff.

Also we know a0=1 and b0,c0,d0=0 so we may be able to reduce the equation clutter even more, making it feasible to deduce spline100, spline144, spline196 and spline256 coefficients
IanB is offline   Reply With Quote