def dEds(s, P, Q):
    """ 
    we have:   E = P/Q 
    therefore: dEds = E' = (P'Q - Q'P) / Q^2
    input
    P, Q: two polynomials that depend on L
    s: the independent (scaling) variable
    """
    Pp = P.deriv(1)(s)
    Qp = Q.deriv(1)(s)
    return (Pp*Q(s) - Qp*P(s)) / Q(s)**2