(e, x)
return series.leadterm(w)
Returns (c0, e0) for e.
Returns (c0, e0) for e.
Returns ( c0 e0 ) for e .
def mrv_leadterm(e, x):
    """Returns (c0, e0) for e."""
    Omega = SubsSet()
    if not e.has(x):
        return (e, S.Zero)
    if Omega == SubsSet():
        Omega, exps = mrv(e, x)
    if not Omega:
        # e really does not depend on x after simplification
        series = calculate_series(e, x)
        c0, e0 = series.leadterm(x)
        if e0 != 0:
            raise ValueError("e0 should be 0")
        return c0, e0
    if x in Omega:
        #move the whole omega up (exponentiate each term):
        Omega_up = moveup2(Omega, x)
        e_up = moveup([e], x)[0]
        exps_up = moveup([exps], x)[0]
        # NOTE: there is no need to move this down!
        e = e_up
        Omega = Omega_up
        exps = exps_up
    #
    # The positive dummy, w, is used here so log(w*2) etc. will expand;
    # a unique dummy is needed in this algorithm
    #
    # For limits of complex functions, the algorithm would have to be
    # improved, or just find limits of Re and Im components separately.
    #
    w = Dummy("w", real=True, positive=True, bounded=True)
    f, logw = rewrite(exps, Omega, x, w)
    series = calculate_series(f, w, logx=logw)
    return series.leadterm(w)
def mrv_leadterm ( e , x ) : Omega = SubsSet ( ) if not e . has ( x ) : return ( e , S . Zero ) if Omega == SubsSet ( ) : Omega , exps = mrv ( e , x ) if not Omega : # e really does not depend on x after simplification series = calculate_series ( e , x ) c0 , e0 = series . leadterm ( x ) if e0 != 0 : raise ValueError ( "e0 should be 0" ) return c0 , e0 if x in Omega : #move the whole omega up (exponentiate each term): Omega_up = moveup2 ( Omega , x ) e_up = moveup ( [ e ] , x ) [ 0 ] exps_up = moveup ( [ exps ] , x ) [ 0 ] # NOTE: there is no need to move this down! e = e_up Omega = Omega_up exps = exps_up # # The positive dummy, w, is used here so log(w*2) etc. will expand; # a unique dummy is needed in this algorithm # # For limits of complex functions, the algorithm would have to be # improved, or just find limits of Re and Im components separately. # w = Dummy ( "w" , real = True , positive = True , bounded = True ) f , logw = rewrite ( exps , Omega , x , w ) series = calculate_series ( f , w , logx = logw ) return series . leadterm ( w )