def splder(tck, n=1):
 if (n < 0):
  return splantider(tck, (- n))
 (t, c, k) = tck
 if (n > k):
  raise ValueError(('Order of derivative (n = %r) must be <= order of spline (k = %r)' % (n, tck[2])))
 sh = ((slice(None),) + ((None,) * len(c.shape[1:])))
 with np.errstate(invalid='raise', divide='raise'):
  try:
   for j in range(n):
    dt = (t[(k + 1):(-1)] - t[1:((- k) - 1)])
    dt = dt[sh]
    c = (((c[1:((-1) - k)] - c[:((-2) - k)]) * k) / dt)
    c = np.r_[(c, np.zeros(((k,) + c.shape[1:])))]
    t = t[1:(-1)]
    k -= 1
  except FloatingPointError:
   raise ValueError(('The spline has internal repeated knots and is not differentiable %d times' % n))
 return (t, c, k)

def splder ( tck , n = 1 ) : if ( n < 0 ) : return splantider ( tck , ( - n ) ) ( t , c , k ) = tck if ( n > k ) : raise ValueError ( ( 'Order of derivative (n = %r) must be <= order of spline (k = %r)' % ( n , tck [ 2 ] ) ) ) sh = ( ( slice ( None ) , ) + ( ( None , ) * len ( c . shape [ 1 : ] ) ) ) with np . errstate ( invalid = 'raise' , divide = 'raise' ) : try : for j in range ( n ) : dt = ( t [ ( k + 1 ) : ( - 1 ) ] - t [ 1 : ( ( - k ) - 1 ) ] ) dt = dt [ sh ] c = ( ( ( c [ 1 : ( ( - 1 ) - k ) ] - c [ : ( ( - 2 ) - k ) ] ) * k ) / dt ) c = np . r_ [ ( c , np . zeros ( ( ( k , ) + c . shape [ 1 : ] ) ) ) ] t = t [ 1 : ( - 1 ) ] k -= 1 except FloatingPointError : raise ValueError ( ( 'The spline has internal repeated knots and is not differentiable %d times' % n ) ) return ( t , c , k )
compute the spline representation of the derivative of a given spline parameters tck : bspline instance or a tuple of spline whose derivative to compute n : int .