예제 #1
0
def test_next_track(precision='d'):
    """
    Tunes the parameters and runs the step-by-step tracker.
    The precision is either double ('d'), double double ('dd'),
    or quad double ('qd').
    """
    tune_homotopy_continuation_parameters()
    from phcpy.families import katsura
    k3 = katsura(3)
    from phcpy.solver import total_degree_start_system as tdss
    (k3q, k3qsols) = tdss(k3)
    print('tracking', len(k3qsols), 'paths ...')
    if (precision == 'd'):
        k3sols = standard_next_track(k3, k3q, k3qsols, True)
    elif (precision == 'dd'):
        k3sols = dobldobl_next_track(k3, k3q, k3qsols, True)
    elif (precision == 'qd'):
        k3sols = quaddobl_next_track(k3, k3q, k3qsols, True)
    else:
        print('wrong precision')
    for sol in k3sols:
        print(sol)
예제 #2
0
def track(pol):
    """
    Applies the series-Pade tracker to solve the polynomial,
    either in a step-by-step manner or without this interaction.
    """
    from phcpy.solver import total_degree_start_system as tdss
    from phcpy.curves import tune_homotopy_continuation_parameters
    from phcpy.curves import standard_next_track, standard_track
    (startpol, startsols) = tdss([pol])
    print 'the start polynomial :'
    print startpol
    print 'the start solutions :'
    for sol in startsols:
        print sol
    tune_homotopy_continuation_parameters()
    ans = raw_input("Interactive, step-by-step track ? (y/n) ")
    if (ans == 'y'):
        sols = standard_next_track([pol], startpol, startsols, True)
    else:
        sols = standard_track([pol], startpol, startsols, \
                              filename="/tmp/outoftrack", verbose=True)
    print 'the computed solutions :'
    for sol in sols:
        print sol
예제 #3
0
def test_simple_track(precision='d'):
    """
    Tunes the parameters and runs a simple test on the trackers.
    The precision is either double ('d'), double double ('dd'),
    or quad double ('qd').
    """
    pars = [get_homotopy_continuation_parameter(k) for k in range(1, 13)]
    print(pars)
    print('gamma constant :', get_gamma_constant())
    print('degree of numerator :', get_degree_of_numerator())
    print('degree of denominator :', get_degree_of_denominator())
    print('maximum step size :', get_maximum_step_size())
    print('minimum step size :', get_minimum_step_size())
    print('series beta factor :', get_series_beta_factor())
    print('pole radius beta factor :', get_pole_radius_beta_factor())
    print('predictor residual alpha :', get_predictor_residual_alpha())
    print('corrector residual tolerance :', get_corrector_residual_tolerance())
    print('coefficient tolerance :', get_zero_series_coefficient_tolerance())
    print('maximum #corrector steps :', get_maximum_corrector_steps())
    print('maximum #steps on path :', get_maximum_steps_on_path())
    tune_homotopy_continuation_parameters()
    from phcpy.families import katsura
    k3 = katsura(3)
    from phcpy.solver import total_degree_start_system as tdss
    (k3q, k3qsols) = tdss(k3)
    print('tracking', len(k3qsols), 'paths ...')
    if (precision == 'd'):
        k3sols = standard_track(k3, k3q, k3qsols, "", True)
    elif (precision == 'dd'):
        k3sols = dobldobl_track(k3, k3q, k3qsols, "", True)
    elif (precision == 'qd'):
        k3sols = quaddobl_track(k3, k3q, k3qsols, "", True)
    else:
        print('wrong precision')
    for sol in k3sols:
        print(sol)
예제 #4
0
def track(pol):
    """
    Applies the series-Pade tracker to solve the polynomial,
    either in a step-by-step manner or without this interaction.
    """
    from phcpy.solver import total_degree_start_system as tdss
    from phcpy.curves import tune_homotopy_continuation_parameters
    from phcpy.curves import standard_next_track, standard_track
    (startpol, startsols) = tdss([pol])
    print 'the start polynomial :'
    print startpol
    print 'the start solutions :'
    for sol in startsols:
        print sol
    tune_homotopy_continuation_parameters()
    ans = raw_input("Interactive, step-by-step track ? (y/n) ");
    if(ans == 'y'):
        sols = standard_next_track([pol], startpol, startsols, True)
    else:
        sols = standard_track([pol], startpol, startsols, \
                              filename="/tmp/outoftrack", verbose=True)
    print 'the computed solutions :'
    for sol in sols:
        print sol