def derivative(self, t, n=<NUM_LIT:1>):
p = self.bpoints()<EOL>if n == <NUM_LIT:1>:<EOL><INDENT>return <NUM_LIT:2>*((p[<NUM_LIT:1>] - p[<NUM_LIT:0>])*(<NUM_LIT:1> - t) + (p[<NUM_LIT:2>] - p[<NUM_LIT:1>])*t)<EOL><DEDENT>elif n == <NUM_LIT:2>:<EOL><INDENT>return <NUM_LIT:2>*(p[<NUM_LIT:2>] - <NUM_LIT:2>*p[<NUM_LIT:1>] + p[<NUM_LIT:0>])<EOL><DEDENT>elif n > <NUM_LIT:2>:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>
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.