示例#1
0
def test_Max():
    x = Symbol("x")
    y = Symbol("y")
    z = Symbol("z")
    assert Max(Integer(6)/3, 1) == 2
    assert Max(-2, 2) == 2
    assert Max(2, 2) == 2
    assert Max(0.2, 0.3) == 0.3
    assert Max(x, x) == x
    assert Max(x, y) == Max(y, x)
    assert Max(x, y, z) == Max(z, y, x)
    assert Max(x, Max(y, z)) == Max(z, y, x)
    assert Max(1000, 100, -100, x, y, z) == Max(x, y, z, 1000)
    assert Max(cos(x), sin(x)) == Max(sin(x), cos(x))
示例#2
0
def test_Min():
    x = Symbol("x")
    y = Symbol("y")
    z = Symbol("z")
    assert Min(Integer(6)/3, 1) == 1
    assert Min(-2, 2) == -2
    assert Min(2, 2) == 2
    assert Min(0.2, 0.3) == 0.2
    assert Min(x, x) == x
    assert Min(x, y) == Min(y, x)
    assert Min(x, y, z) == Min(z, y, x)
    assert Min(x, Min(y, z)) == Min(z, y, x)
    assert Min(1000, 100, -100, x, y, z) == Min(x, y, z, -100)
    assert Min(cos(x), sin(x)) == Min(cos(x), sin(x))
示例#3
0
        def __new__(cls, name, *args, **kwargs):
            if not isinstance(name, six.string_types):
                raise TypeError("name should be a string, not %s" % repr(type(name)))

            return symengine_Symbol.__new__(cls, name)
示例#4
0
 def __new__(cls, name, *args, **kwargs):
     return symengine_Symbol.__new__(cls, name)
示例#5
0
 def __new__(cls, name, extra_attribute):
     return Symbol.__new__(cls, name)
示例#6
0
        def __new__(cls, name, *args, **kwargs):
            if not isinstance(name, six.string_types):
                raise TypeError("name should be a string, not %s" % repr(type(name)))

            return symengine_Symbol.__new__(cls, name)