示例#1
0
def test_cascade():
    """
    Does one cascade step on simple example.
    In the top embedding we first find the 2-dimensional
    solution set x = 1.  In the cascade step we compute
    the three witness points on the twisted cubic.
    """
    from phcpy.solver import solve
    from phcpy.sets import embed
    from phcpy.sets import drop_variable_from_standard_polynomials
    from phcpy.sets import drop_coordinate_from_standard_solutions
    pols = ['(x - 1)*(y-x^2);', \
            '(x - 1)*(z-x^3);', \
            '(x^2 - 1)*(y-x^2);' ]
    print pols
    (embpols, sols0, sols1) = top_cascade(3, 2, pols, 1.0e-8)
    print 'the embedded system :'
    print embpols
    print 'the generic points :'
    for sol in sols0:
        print sol
    raw_input('hit enter to continue...')
    print 'solutions with nonzero slack variables :'
    for sol in sols1:
        print sol
    raw_input('hit enter to continue...')
    print '... running cascade step ...'
    (wp1, ws0, ws1) = cascade_filter(2, embpols, sols1, 1.0e-8)
    print 'the 1-dimensional embedding :'
    for pol in wp1:
        print pol
    print 'the candidate generic points :'
    for sol in ws0:
        print sol
示例#2
0
def test_cascade():
    """
    Does one cascade step on simple example.
    In the top embedding we first find the 2-dimensional
    solution set x = 1.  In the cascade step we compute
    the three witness points on the twisted cubic.
    """
    from phcpy.solver import solve
    from phcpy.sets import embed
    from phcpy.sets import drop_variable_from_standard_polynomials
    from phcpy.sets import drop_coordinate_from_standard_solutions
    pols = ['(x - 1)*(y-x^2);', \
            '(x - 1)*(z-x^3);', \
            '(x^2 - 1)*(y-x^2);' ]
    print pols
    (embpols, sols0, sols1) = top_cascade(3, 2, pols, 1.0e-8)
    print 'the embedded system :'
    print embpols
    print 'the generic points :'
    for sol in sols0:
        print sol
    raw_input('hit enter to continue...')
    print 'solutions with nonzero slack variables :'
    for sol in sols1:
        print sol
    raw_input('hit enter to continue...')
    print '... running cascade step ...'
    (wp1, ws0, ws1) = cascade_filter(2, embpols, sols1, 1.0e-8)
    print 'the 1-dimensional embedding :'
    for pol in wp1:
        print pol
    print 'the candidate generic points :'
    for sol in ws0:
        print sol
示例#3
0
"""
Illustrative example for a numerical irreducible decomposition.
This python3 script illustrates a two-stage cascade to compute candidate
generic points on all components, on all dimensions of the solution set.
"""
pols = ['(x^2 + y^2 + z^2 - 1)*(y - x^2)*(x - 0.5);', \
        '(x^2 + y^2 + z^2 - 1)*(z - x^3)*(y - 0.5);', \
        '(x^2 + y^2 + z^2 - 1)*(z - x*y)*(z - 0.5);']
from phcpy.cascades import top_cascade, cascade_filter
(topemb, topsols0, topsols1) = top_cascade(3, 2, pols, 1.0e-8)
print('generic points on the two dimensional surface :')
for sol in topsols0:
    print(sol)
input('hit enter to continue')
(lvl1emb, lvl1sols0, lvl1sols1) = cascade_filter(2, topemb, topsols1, 1.0e-8)
print('candidate generic points at level 1 :')
for sol in lvl1sols0:
    print(sol)
from phcpy.sets import ismember_filter
fil1sols0 = ismember_filter(topemb, topsols0, 2, lvl1sols0)
print('number of points before filtering :', len(lvl1sols0))
print('number of points after filtering :', len(fil1sols0))
input('hit enter to continue')
print('the filtered witness points at dimension 1 :')
for sol in fil1sols0:
    print(sol)
input('hit enter to continue')
(lvl0emb, lvl2sols) = cascade_filter(1, lvl1emb, lvl1sols1, 1.0e-8)
(lvl0emb, lvl2sols) = cascade_filter(1, lvl1emb, lvl1sols1, 1.0e-8)
fil0sols = ismember_filter(topemb, topsols0, 2, lvl2sols)
print('number of points before filtering :', len(lvl2sols))