예제 #1
0
def test(precision="d"):
    """
    Tests the numerical computation of a tropism.
    """
    pols = ["x + x*y + y^3;", "x;"]
    from phcpy.solver import solve

    start = [
        "x + (-5.89219623474258E-02 - 9.98262591883082E-01*i)*y^2"
        + " + ( 5.15275165825429E-01 + 8.57024797472965E-01*i)*x*y;",
        "x+(-9.56176913648087E-01 - 2.92789531586119E-01*i);",
    ]
    startsols = solve(start, silent=True)
    print "computed", len(startsols), "start solutions"
    from phcpy.tuning import order_endgame_extrapolator_set as set

    set(4)
    if precision == "d":
        from phcpy.trackers import standard_double_track as track
    elif precision == "dd":
        from phcpy.trackers import double_double_track as track
    elif precision == "qd":
        from phcpy.trackers import quad_double_track as track
    else:
        print "wrong level of precision"
        return
    sols = track(pols, start, startsols)
    print "the solutions at the end :"
    for sol in sols:
        print sol
    if precision == "d":
        print "size of the tropisms container :", standard_size()
        (wnd, dirs, errs) = standard_retrieve(len(sols), len(pols))
    elif precision == "dd":
        print "size of the tropisms container :", dobldobl_size()
        (wnd, dirs, errs) = dobldobl_retrieve(len(sols), len(pols))
    else:
        print "size of the tropisms container :", quaddobl_size()
        (wnd, dirs, errs) = quaddobl_retrieve(len(sols), len(pols))
    print "the winding numbers :", wnd
    print "the directions :"
    for dir in dirs:
        print dir
    print "the errors :", errs
예제 #2
0
def test(precision='d'):
    """
    Tests the numerical computation of a tropism.
    """
    pols = ['x + x*y + y^3;', 'x;']
    from phcpy.solver import solve
    start = ['x + (-5.89219623474258E-02 - 9.98262591883082E-01*i)*y^2' \
         + ' + ( 5.15275165825429E-01 + 8.57024797472965E-01*i)*x*y;', \
        'x+(-9.56176913648087E-01 - 2.92789531586119E-01*i);']
    startsols = solve(start, verbose=False)
    print('computed', len(startsols), 'start solutions')
    from phcpy.tuning import order_endgame_extrapolator_set as set
    set(4)
    if precision == 'd':
        from phcpy.trackers import standard_double_track as track
    elif precision == 'dd':
        from phcpy.trackers import double_double_track as track
    elif precision == 'qd':
        from phcpy.trackers import quad_double_track as track
    else:
        print('wrong level of precision')
        return
    sols = track(pols, start, startsols)
    print('the solutions at the end :')
    for sol in sols:
        print(sol)
    if precision == 'd':
        print('size of the tropisms container :', standard_size())
        (wnd, dirs, errs) = standard_retrieve(len(sols), len(pols))
    elif precision == 'dd':
        print('size of the tropisms container :', dobldobl_size())
        (wnd, dirs, errs) = dobldobl_retrieve(len(sols), len(pols))
    else:
        print('size of the tropisms container :', quaddobl_size())
        (wnd, dirs, errs) = quaddobl_retrieve(len(sols), len(pols))
    print('the winding numbers :', wnd)
    print('the directions :')
    for dir in dirs:
        print(dir)
    print('the errors :', errs)