コード例 #1
0
ファイル: parabolic.py プロジェクト: andydude/hyperops
def parabolic_IDM(expr, x, x0=0, n=5, check=True):
    """
    parabolic_IDM(f(x), x) -- parabolic iterate derivative matrix.

    Contains in each row the power series for each iterate
    where the columns represent the coefficients of the 
    power series. The IDM is a (n+1)*(n+1) matrix A where:
    A_j_k = 1/k! the k-th derivative of the j-th iterate of f
    evaluated at x=x0.
    """
    # is it a parabolic function?
    # the real parabolic-ness check
    if check and not is_parabolic(expr, x, x0):
        raise ValueError, "x0 == f(x0) must be a parabolic fixed point (f'(x0) == 1)"

    # initialize data
    ret = []
    ser = x

    # truncate power series each time,
    # because keeping useless coefficients
    # makes it so much slower. This is fast!
    for i in xrange(n + 1):

        # find Taylor series about x=x0
        ser = taylor(ser.subs(x=expr), x, x0, n)
        cof = get_coeff_list(ser, x, x0, n)
        ret.append(cof)

    # the coefficients of the identity function
    top = [0, 1] + [0 for i in xrange(n - 1)]
    return [top] + ret
コード例 #2
0
ファイル: parabolic.py プロジェクト: andydude/hyperops
def parabolic_flow_matrix(expr, t, x, x0=0, n=5):
    """
    parabolic_flow_matrix(f(x), t, x)

    The flow matrix for a parabolic function,
    basically the coefficients of x and t.

    This takes the flow coefficients (1-D list)
    and 'creates' a dimension (2-D matrix).
    """
    # this also checks parabolic-ness
    coeffs = parabolic_flow_coeffs(expr, t, x, x0, n)
    ret = []

    # # extract coeffs from series
    # coeffs = ser.coeffs(x)
    # coeffs2 = [0 for k in xrange(n + 1)]
    # for cof in coeffs:
    #     try:
    #         coeffs2[cof[1]] = cof[0]
    #     except:
    #         pass

    for i in xrange(n):
        if (i < 2):
            ret.append([coeffs[i]])
        else:
            ser = coeffs[i]
            # cof = coeffs[i].expand().coeffs(t)
            # extract coeffs from series
            cof = get_coeff_list(ser, t, 0, i-1)
            ret.append(cof)
    return ret
コード例 #3
0
ファイル: matrix.py プロジェクト: andydude/hyperops
def Carleman_matrix(expr, x, x0=0, n_row=5, n_col=0, limit=False):
    """
    Carleman_matrix(f(x), x) -- Carleman matrix of f(x)
    Carleman_matrix(f(x), x, x0) -- Carleman matrix about x=x0
    Carleman_matrix(f(x), x, x0, n) -- (n+1)*(n+1) Carleman matrix

    The Carleman matrix,
    from which the other 2 matrices are derived
    """
    if n_col == 0: n_col = n_row

    # initialize data
    ser = 1
    ret = [[1] + [0 for k in xrange(n_col)]]
    for j in xrange(1, n_row + 1):
        
        # find Taylor series about x=x0
    	ser = taylor(ser*expr, x, x0, n_col)
        cof = get_coeff_list(ser, x, x0, n_col)
    	ret.append(cof)

    return matrix(ret)