Example #1
0
def test_periodic_argument():
    from sympy import (periodic_argument, unbranched_argument, oo,
                       principal_branch, polar_lift, pi)
    x = Symbol('x')
    p = Symbol('p', positive=True)

    assert unbranched_argument(2 + I) == periodic_argument(2 + I, oo)
    assert unbranched_argument(1 + x) == periodic_argument(1 + x, oo)
    assert N_equals(unbranched_argument((1 + I)**2), pi / 2)
    assert N_equals(unbranched_argument((1 - I)**2), -pi / 2)
    assert N_equals(periodic_argument((1 + I)**2, 3 * pi), pi / 2)
    assert N_equals(periodic_argument((1 - I)**2, 3 * pi), -pi / 2)

    assert unbranched_argument(principal_branch(x, pi)) == \
        periodic_argument(x, pi)

    assert unbranched_argument(polar_lift(2 + I)) == unbranched_argument(2 + I)
    assert periodic_argument(polar_lift(2 + I), 2*pi) == \
        periodic_argument(2 + I, 2*pi)
    assert periodic_argument(polar_lift(2 + I), 3*pi) == \
        periodic_argument(2 + I, 3*pi)
    assert periodic_argument(polar_lift(2 + I), pi) == \
        periodic_argument(polar_lift(2 + I), pi)

    assert unbranched_argument(polar_lift(1 + I)) == pi / 4
    assert periodic_argument(2 * p, p) == periodic_argument(p, p)
    assert periodic_argument(pi * p, p) == periodic_argument(p, p)

    assert Abs(polar_lift(1 + I)) == Abs(1 + I)
Example #2
0
def test_periodic_argument():
    from sympy import (periodic_argument, unbranched_argument, oo,
                       principal_branch, polar_lift, pi)
    x = Symbol('x')
    p = Symbol('p', positive = True)

    def tn(a, b):
        from sympy.utilities.randtest import test_numerically
        from sympy import Dummy
        return test_numerically(a, b, Dummy('x'))

    assert unbranched_argument(2 + I) == periodic_argument(2 + I, oo)
    assert unbranched_argument(1 + x) == periodic_argument(1 + x, oo)
    assert tn(unbranched_argument((1+I)**2), pi/2)
    assert tn(unbranched_argument((1-I)**2), -pi/2)
    assert tn(periodic_argument((1+I)**2, 3*pi), pi/2)
    assert tn(periodic_argument((1-I)**2, 3*pi), -pi/2)

    assert unbranched_argument(principal_branch(x, pi)) \
           == periodic_argument(x, pi)

    assert unbranched_argument(polar_lift(2 + I)) == unbranched_argument(2 + I)
    assert periodic_argument(polar_lift(2 + I), 2*pi) \
           == periodic_argument(2 + I, 2*pi)
    assert periodic_argument(polar_lift(2 + I), 3*pi) \
           == periodic_argument(2 + I, 3*pi)
    assert periodic_argument(polar_lift(2 + I), pi) \
           == periodic_argument(polar_lift(2 + I), pi)

    assert unbranched_argument(polar_lift(1 + I)) == pi/4
    assert periodic_argument(2*p, p) == periodic_argument(p, p)
    assert periodic_argument(pi*p, p) == periodic_argument(p, p)
Example #3
0
def test_periodic_argument():
    from sympy import (periodic_argument, unbranched_argument, oo,
                       principal_branch, polar_lift, pi)
    x = Symbol('x')
    p = Symbol('p', positive=True)

    assert unbranched_argument(2 + I) == periodic_argument(2 + I, oo)
    assert unbranched_argument(1 + x) == periodic_argument(1 + x, oo)
    assert N_equals(unbranched_argument((1 + I)**2), pi/2)
    assert N_equals(unbranched_argument((1 - I)**2), -pi/2)
    assert N_equals(periodic_argument((1 + I)**2, 3*pi), pi/2)
    assert N_equals(periodic_argument((1 - I)**2, 3*pi), -pi/2)

    assert unbranched_argument(principal_branch(x, pi)) == \
        periodic_argument(x, pi)

    assert unbranched_argument(polar_lift(2 + I)) == unbranched_argument(2 + I)
    assert periodic_argument(polar_lift(2 + I), 2*pi) == \
        periodic_argument(2 + I, 2*pi)
    assert periodic_argument(polar_lift(2 + I), 3*pi) == \
        periodic_argument(2 + I, 3*pi)
    assert periodic_argument(polar_lift(2 + I), pi) == \
        periodic_argument(polar_lift(2 + I), pi)

    assert unbranched_argument(polar_lift(1 + I)) == pi/4
    assert periodic_argument(2*p, p) == periodic_argument(p, p)
    assert periodic_argument(pi*p, p) == periodic_argument(p, p)

    assert Abs(polar_lift(1 + I)) == Abs(1 + I)
Example #4
0
def test_periodic_argument():
    from sympy import (periodic_argument, unbranched_argument, oo,
                       principal_branch, polar_lift, pi)
    x = Symbol('x')
    p = Symbol('p', positive=True)

    def tn(a, b):
        from sympy.utilities.randtest import test_numerically
        from sympy import Dummy
        return test_numerically(a, b, Dummy('x'))

    assert unbranched_argument(2 + I) == periodic_argument(2 + I, oo)
    assert unbranched_argument(1 + x) == periodic_argument(1 + x, oo)
    assert tn(unbranched_argument((1 + I)**2), pi / 2)
    assert tn(unbranched_argument((1 - I)**2), -pi / 2)
    assert tn(periodic_argument((1 + I)**2, 3 * pi), pi / 2)
    assert tn(periodic_argument((1 - I)**2, 3 * pi), -pi / 2)

    assert unbranched_argument(principal_branch(x, pi)) \
           == periodic_argument(x, pi)

    assert unbranched_argument(polar_lift(2 + I)) == unbranched_argument(2 + I)
    assert periodic_argument(polar_lift(2 + I), 2*pi) \
           == periodic_argument(2 + I, 2*pi)
    assert periodic_argument(polar_lift(2 + I), 3*pi) \
           == periodic_argument(2 + I, 3*pi)
    assert periodic_argument(polar_lift(2 + I), pi) \
           == periodic_argument(polar_lift(2 + I), pi)

    assert unbranched_argument(polar_lift(1 + I)) == pi / 4
    assert periodic_argument(2 * p, p) == periodic_argument(p, p)
    assert periodic_argument(pi * p, p) == periodic_argument(p, p)
Example #5
0
def unbranched_argument(x):
    return diffify(sympy.unbranched_argument(x))