Exemple #1
0
def complex_sweep_test(precision='d'):
    """
    Runs a complex sweep on two points on the unit circle.
    Although we start at two points with real coordinates
    and we end at two points that have nonzero imaginary parts,
    the sweep does not encounter a singularity because of
    the random complex gamma constant.
    """
    from solutions import make_solution as makesol
    circle = ['x^2 + y^2 - 1;']
    first = makesol(['x', 'y'], [0, 1])
    second = makesol(['x', 'y'], [0, -1])
    startsols = [first, second]
    xpar = ['x']
    if (precision == 'd'):
        ststart = [0, 0]  # real and imaginary parts of the start value
        sttarget = [2, 0]
        newsols = standard_complex_sweep(circle, startsols, 2, xpar, \
                                         ststart, sttarget)
    elif (precision == 'dd'):
        ddstart = [0, 0, 0, 0]  # double doubles
        ddtarget = [2, 0, 0, 0]
        newsols = dobldobl_complex_sweep(circle, startsols, 2, xpar, \
                                         ddstart, ddtarget)
    elif (precision == 'qd'):
        qdstart = [0, 0, 0, 0, 0, 0, 0, 0]  # quad doubles
        qdtarget = [2, 0, 0, 0, 0, 0, 0, 0]
        newsols = quaddobl_complex_sweep(circle, startsols, 2, xpar, \
                                         qdstart, qdtarget)
    else:
        print 'wrong precision given as input parameter to test'
    for sol in newsols:
        print sol
Exemple #2
0
def complex_sweep_test(precision='d'):
    """
    Runs a complex sweep on two points on the unit circle.
    Although we start at two points with real coordinates
    and we end at two points that have nonzero imaginary parts,
    the sweep does not encounter a singularity because of
    the random complex gamma constant.
    """
    from solutions import make_solution as makesol
    circle = ['x^2 + y^2 - 1;']
    first = makesol(['x', 'y'], [0, 1])
    second = makesol(['x', 'y'], [0, -1])
    startsols = [first, second]
    xpar = ['x']
    if(precision == 'd'):
        ststart = [0, 0]  # real and imaginary parts of the start value
        sttarget = [2, 0]
        newsols = standard_complex_sweep(circle, startsols, 2, xpar, \
                                         ststart, sttarget)
    elif(precision == 'dd'):
        ddstart = [0, 0, 0, 0]  # double doubles
        ddtarget = [2, 0, 0, 0]
        newsols = dobldobl_complex_sweep(circle, startsols, 2, xpar, \
                                         ddstart, ddtarget)
    elif(precision == 'qd'):
        qdstart = [0, 0, 0, 0, 0, 0, 0, 0]  # quad doubles
        qdtarget = [2, 0, 0, 0, 0, 0, 0, 0]
        newsols = quaddobl_complex_sweep(circle, startsols, 2, xpar, \
                                         qdstart, qdtarget)
    else:
        print 'wrong precision given as input parameter to test'
    for sol in newsols:
        print sol
Exemple #3
0
def real_sweep_test(precision='d'):
    """
    Runs a real sweep on two points on the unit circle: (1,0), (-1,0),
    moving the second coordinate from 0 to 2.
    The sweep will stop at the quadratic turning point: (0,1).
    We can also run the sweep starting at two complex points:
    (2*j, sqrt(5)) and (-2*j, sqrt(5)), moving the second coordinate
    from sqrt(5) to 0.  This sweep will also stop at (0,1).
    """
    from solutions import make_solution as makesol
    rcircle = ['x^2 + y^2 - 1;', 'y*(1-s) + (y-2)*s;']
    rfirst = makesol(['x', 'y', 's'], [1, 0, 0])
    rsecond = makesol(['x', 'y', 's'], [-1, 0, 0])
    rstartsols = [rfirst, rsecond]
    if (precision == 'd'):
        rnewsols = standard_real_sweep(rcircle, rstartsols)
    elif (precision == 'dd'):
        rnewsols = dobldobl_real_sweep(rcircle, rstartsols)
    elif (precision == 'qd'):
        rnewsols = quaddobl_real_sweep(rcircle, rstartsols)
    else:
        print 'wrong precision given as input parameter to test'
    print 'after the sweep that started at real solutions :'
    for sol in rnewsols:
        print sol
    from math import sqrt
    sqrt5 = sqrt(5)
    sweepline = '(y - %.15e)*(1-s) + y*s;' % sqrt5
    ccircle = ['x^2 + y^2 - 1;', sweepline]
    cfirst = makesol(['x', 'y', 's'], [complex(0, 2), sqrt5, 0])
    csecond = makesol(['x', 'y', 's'], [complex(0, -2), sqrt5, 0])
    cstartsols = [cfirst, csecond]
    if (precision == 'd'):
        cnewsols = standard_real_sweep(ccircle, cstartsols)
    elif (precision == 'dd'):
        cnewsols = dobldobl_real_sweep(ccircle, cstartsols)
    elif (precision == 'qd'):
        cnewsols = quaddobl_real_sweep(ccircle, cstartsols)
    else:
        print 'wrong precision given as input parameter to test'
    print 'after the sweep that started at complex solutions :'
    for sol in cnewsols:
        print sol
Exemple #4
0
def real_sweep_test(precision='d'):
    """
    Runs a real sweep on two points on the unit circle: (1,0), (-1,0),
    moving the second coordinate from 0 to 2.
    The sweep will stop at the quadratic turning point: (0,1).
    We can also run the sweep starting at two complex points:
    (2*j, sqrt(5)) and (-2*j, sqrt(5)), moving the second coordinate
    from sqrt(5) to 0.  This sweep will also stop at (0,1).
    """
    from solutions import make_solution as makesol
    rcircle = ['x^2 + y^2 - 1;', 'y*(1-s) + (y-2)*s;']
    rfirst = makesol(['x', 'y', 's'], [1, 0, 0])
    rsecond = makesol(['x', 'y', 's'], [-1, 0, 0])
    rstartsols = [rfirst, rsecond]
    if(precision == 'd'):
       rnewsols = standard_real_sweep(rcircle, rstartsols)
    elif(precision == 'dd'):
       rnewsols = dobldobl_real_sweep(rcircle, rstartsols)
    elif(precision == 'qd'):
       rnewsols = quaddobl_real_sweep(rcircle, rstartsols)
    else:
       print 'wrong precision given as input parameter to test'
    print 'after the sweep that started at real solutions :'
    for sol in rnewsols:
        print sol
    from math import sqrt
    sqrt5 = sqrt(5)
    sweepline = '(y - %.15e)*(1-s) + y*s;' % sqrt5
    ccircle = ['x^2 + y^2 - 1;', sweepline]
    cfirst = makesol(['x', 'y', 's'], [complex(0,2), sqrt5, 0])
    csecond = makesol(['x', 'y', 's'], [complex(0,-2), sqrt5, 0])
    cstartsols = [cfirst, csecond]
    if(precision == 'd'):
        cnewsols = standard_real_sweep(ccircle, cstartsols)
    elif(precision == 'dd'):
        cnewsols = dobldobl_real_sweep(ccircle, cstartsols)
    elif(precision == 'qd'):
        cnewsols = quaddobl_real_sweep(ccircle, cstartsols)
    else:
        print 'wrong precision given as input parameter to test'
    print 'after the sweep that started at complex solutions :'
    for sol in cnewsols:
        print sol