code: def derivative(self, t, n=1):
          
          p = self.bpoints()
          if n == 1:
              return 2*((p[1] - p[0])*(1 - t) + (p[2] - p[1])*t)
          elif n == 2:
              return 2*(p[2] - 2*p[1] + p[0])
          elif n > 2:
              return 0
          else:
              raise ValueError("n should be a positive integer.")
docs: returns the nth derivative of the segment at t.
          Note: Bezier curves can have points where their derivative vanishes.
          If you are interested in the tangent direction, use the unit_tangent()
          method instead.