Re: Derivative of splinefit w.r.t. control points.




In article <1dc2c$433176d6$82a1bc06$7365@xxxxxxxxxxxxxxxx>,
Maurice van de Rijzen <bertvansesamamstraat@xxxxxxxxxxx> writes:
>Dear Peter,
>
>I already thought so.
>But my problem is that I use the spline-toolbox of Matlab and therefore
>I don't have direct acces to the equations.
>Furthermore is my problem bivariate the makes bit more difficult.
>I use a natural cubic spline.
>I hoped it would be possible to retrieve them in one way or the other
>from the spline-coefficients either on the polynomials or B-spline
>formulation.
>Do you know whether this would be possible?
>Thanks,
>Maurice
>

the natural cubic spline can be computed quite simply by a tridiagonal system
in 1D and a block tridiagonal one for the tensor product 2D case. the good
message: the spline coefficients are of course linearly dependent on the
function values, (but not the node positions!)
hence the simple forward difference quotient, with a stepsize of
one say, gives already the correct derivative numerically, hence you can use
the toolbox as a black box and compute those derivatives numerically.
the coefficients are given by a strucutre and you must access a component of the
structure in order to get direct access to the coefficients. then you build a
correponding new structure for the derivatives of the spline with respect to the
y's. however, in 2D, this might give quite a huge number of computations. but
anyway, also done directly done analytically, this gives lots of work, but
the speciality is that you have to solve systems with the same matrix and many
different right hand sides. for example , for the moments of the spline in
1D the system is tridiagonal
A(h(2),...,h(n))*(m(2),...,m(n-1))' = ((y(3)-y(2))/h(2)-(y(2)-y(1))/h(2) ,
......... , (y(n)-y(n-1))/h(n)-(y(n-1)-y(n-2))/h(n-1))'
where the data are (x(1),y(1)),...,(x(n),y(n)), m(i)=s''(x(i))/6
h(i)=x(i)-x(i-1) i=2,..,n and
A=tridiag(h(i),2*(h(i)+h(i+1)),h(i+1): i=2,...,n-1)
m(1)=m(n)=0 (the natural end condition). if you differentiate this with respect
to y(3) say, then you get on the right hand side only two entris not=0 and
the same coefficient matrix. hence using this property directly would save
a lot of work.
hth
peter








>> In article <26396943.1127226707247.JavaMail.jakarta@xxxxxxxxxxxxxxxxxxxxxx>,
>> Maurice <bertvansesamstraat@xxxxxxxxxxx> writes:
>> >Dear All,
>> >I'm working on an optimization problem using splines.
>> >Now I've the following question.
>> >Say that I've a cubic natural spline f(x).
>> >This implies that the variables of the function are the values at the control points,(y(0)..y(N)).
>> >Is it possible to determine the derivative of the fit in a certain evaluation point analytically.
>> >df/dy(0) | x=x_eval.
>> >Thanks in advance,
>> >Maurice
>>
>> yes of course. go through the complete algorithm to compute the spline and
>> differentiate each equation , using chain rule, with respect to the y's.
>> then you will get the derivative of the splines' coefficients with respect to
>> the data and can evaluate the derivative of the spline with respect to the data
>> by evaluating the representation with the new coefficients instead of the
>> original ones.
>> hth
>> peter
>>
.



Relevant Pages

  • Re: Cubic Spline in parametric form
    ... The functions 'spline' and 'pchip' are available in the bae MATLAB ... The values in S.coefs are the spline polynomial coefficients, ... I need to connect points with cubic splines. ...
    (comp.soft-sys.matlab)
  • Re: FORTRAN TYPE construct?
    ... I am in fact using the F77 SPLINE and SPLINT. ... correct values in the arrays, ... So make sure that you allocate enough space to hold these coefficients ...
    (comp.lang.fortran)
  • Re: Derivative of splinefit w.r.t. control points.
    ... > don't have direct access to the equations. ... I don't have Matlab, but Mathematica. ... all the "equations" variables are the 4th item in the Spline ... >> by evaluating the representation with the new coefficients instead of the ...
    (sci.math.num-analysis)
  • Re: Derivative of splinefit w.r.t. control points.
    ... >I'm working on an optimization problem using splines. ... >Say that I've a cubic natural spline f. ... >Is it possible to determine the derivative of the fit in a certain evaluation point analytically. ... then you will get the derivative of the splines' coefficients with respect to ...
    (sci.math.num-analysis)
  • Re: Function and derivative interpolation
    ... This solves my problems with the derivatives. ... approximations is what they mean implicitly. ... Also, higher order finite difference ... spline model is a global construction. ...
    (comp.soft-sys.matlab)