当前位置: 首页>>代码示例>>Python>>正文


Python sympy.imageset函数代码示例

本文整理汇总了Python中sympy.imageset函数的典型用法代码示例。如果您正苦于以下问题:Python imageset函数的具体用法?Python imageset怎么用?Python imageset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imageset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_solveset_complex_exp

def test_solveset_complex_exp():
    from sympy.abc import x, n

    assert solveset_complex(exp(x) - 1, x) == imageset(Lambda(n, I * 2 * n * pi), S.Integers)
    assert solveset_complex(exp(x) - I, x) == imageset(Lambda(n, I * (2 * n * pi + pi / 2)), S.Integers)
    assert solveset_complex(1 / exp(x), x) == S.EmptySet
    assert solveset_complex(sinh(x).rewrite(exp), x) == imageset(Lambda(n, n * pi * I), S.Integers)
开发者ID:pabloferz,项目名称:sympy,代码行数:7,代码来源:test_solveset.py

示例2: test_solve_trig

def test_solve_trig():
    from sympy.abc import n
    assert solveset_real(sin(x), x) == \
        Union(imageset(Lambda(n, 2*pi*n), S.Integers),
              imageset(Lambda(n, 2*pi*n + pi), S.Integers))

    assert solveset_real(sin(x) - 1, x) == \
        imageset(Lambda(n, 2*pi*n + pi/2), S.Integers)

    assert solveset_real(cos(x), x) == \
        Union(imageset(Lambda(n, 2*pi*n - pi/2), S.Integers),
              imageset(Lambda(n, 2*pi*n + pi/2), S.Integers))

    assert solveset_real(sin(x) + cos(x), x) == \
        Union(imageset(Lambda(n, 2*n*pi - pi/4), S.Integers),
              imageset(Lambda(n, 2*n*pi + 3*pi/4), S.Integers))

    assert solveset_real(sin(x)**2 + cos(x)**2, x) == S.EmptySet

    assert solveset_complex(cos(x) - S.Half, x) == \
        Union(imageset(Lambda(n, 2*n*pi + pi/3), S.Integers),
              imageset(Lambda(n, 2*n*pi - pi/3), S.Integers))

    y, a = symbols('y,a')
    assert solveset(sin(y + a) - sin(y), a, domain=S.Reals) == \
        imageset(Lambda(n, 2*n*pi), S.Integers)
开发者ID:Kogorushi,项目名称:sympy,代码行数:26,代码来源:test_solveset.py

示例3: test_solve_trig_simplified

def test_solve_trig_simplified():
    from sympy.abc import n

    assert solveset_real(sin(x), x) == imageset(Lambda(n, n * pi), S.Integers)

    assert solveset_real(cos(x), x) == imageset(Lambda(n, n * pi + pi / 2), S.Integers)

    assert solveset_real(cos(x) + sin(x), x) == imageset(Lambda(n, n * pi - pi / 4), S.Integers)
开发者ID:LuckyStrikes1090,项目名称:sympy,代码行数:8,代码来源:test_solveset.py

示例4: test_invert_real

def test_invert_real():
    x = Symbol('x', real=True)
    x = Dummy(real=True)
    n = Symbol('n')
    d = Dummy()
    assert solveset(abs(x) - n, x) == solveset(abs(x) - d, x) == EmptySet()

    n = Symbol('n', real=True)
    assert invert_real(x + 3, y, x) == (x, FiniteSet(y - 3))
    assert invert_real(x*3, y, x) == (x, FiniteSet(y / 3))

    assert invert_real(exp(x), y, x) == (x, FiniteSet(log(y)))
    assert invert_real(exp(3*x), y, x) == (x, FiniteSet(log(y) / 3))
    assert invert_real(exp(x + 3), y, x) == (x, FiniteSet(log(y) - 3))

    assert invert_real(exp(x) + 3, y, x) == (x, FiniteSet(log(y - 3)))
    assert invert_real(exp(x)*3, y, x) == (x, FiniteSet(log(y / 3)))

    assert invert_real(log(x), y, x) == (x, FiniteSet(exp(y)))
    assert invert_real(log(3*x), y, x) == (x, FiniteSet(exp(y) / 3))
    assert invert_real(log(x + 3), y, x) == (x, FiniteSet(exp(y) - 3))

    assert invert_real(Abs(x), y, x) == (x, FiniteSet(-y, y))

    assert invert_real(2**x, y, x) == (x, FiniteSet(log(y)/log(2)))
    assert invert_real(2**exp(x), y, x) == (x, FiniteSet(log(log(y)/log(2))))

    assert invert_real(x**2, y, x) == (x, FiniteSet(sqrt(y), -sqrt(y)))
    assert invert_real(x**Rational(1, 2), y, x) == (x, FiniteSet(y**2))

    raises(ValueError, lambda: invert_real(x, x, x))
    raises(ValueError, lambda: invert_real(x**pi, y, x))
    raises(ValueError, lambda: invert_real(S.One, y, x))

    assert invert_real(x**31 + x, y, x) == (x**31 + x, FiniteSet(y))

    assert invert_real(Abs(x**31 + x + 1), y, x) == (x**31 + x,
                                                     FiniteSet(-y - 1, y - 1))

    assert invert_real(tan(x), y, x) == \
        (x, imageset(Lambda(n, n*pi + atan(y)), S.Integers))

    assert invert_real(tan(exp(x)), y, x) == \
        (x, imageset(Lambda(n, log(n*pi + atan(y))), S.Integers))

    assert invert_real(cot(x), y, x) == \
        (x, imageset(Lambda(n, n*pi + acot(y)), S.Integers))
    assert invert_real(cot(exp(x)), y, x) == \
        (x, imageset(Lambda(n, log(n*pi + acot(y))), S.Integers))

    assert invert_real(tan(tan(x)), y, x) == \
        (tan(x), imageset(Lambda(n, n*pi + atan(y)), S.Integers))

    x = Symbol('x', positive=True)
    assert invert_real(x**pi, y, x) == (x, FiniteSet(y**(1/pi)))
开发者ID:ChaliZhg,项目名称:sympy,代码行数:55,代码来源:test_solveset.py

示例5: test_solveset

def test_solveset():
    x = Symbol("x")
    raises(ValueError, lambda: solveset(x + y))

    assert solveset(exp(x) - 1, domain=S.Reals) == FiniteSet(0)
    assert solveset(exp(x) - 1, x, S.Reals) == FiniteSet(0)
    assert solveset(Eq(exp(x), 1), x, S.Reals) == FiniteSet(0)

    assert solveset(x - 1 >= 0, x, S.Reals) == Interval(1, oo)
    assert solveset(exp(x) - 1 >= 0, x, S.Reals) == Interval(0, oo)

    assert solveset(exp(x) - 1, x) == imageset(Lambda(n, 2 * I * pi * n), S.Integers)
    assert solveset(Eq(exp(x), 1), x) == imageset(Lambda(n, 2 * I * pi * n), S.Integers)
开发者ID:JackWangCUMT,项目名称:sympy,代码行数:13,代码来源:test_solveset.py

示例6: test_solveset

def test_solveset():
    x = Symbol('x', real=True)
    raises(ValueError, lambda: solveset(x + y))

    assert solveset(exp(x) - 1) == FiniteSet(0)
    assert solveset(exp(x) - 1, x) == FiniteSet(0)
    assert solveset(Eq(exp(x), 1), x) == FiniteSet(0)

    assert solveset(x - 1 >= 0, x) == Interval(1, oo)
    assert solveset(exp(x) - 1 >= 0, x) == Interval(0, oo)

    x = Symbol('x')
    assert solveset(exp(x) - 1, x) == imageset(Lambda(n, 2*I*pi*n), S.Integers)
    assert solveset(Eq(exp(x), 1), x) == imageset(Lambda(n, 2*I*pi*n),
                                                  S.Integers)
开发者ID:ChaliZhg,项目名称:sympy,代码行数:15,代码来源:test_solveset.py

示例7: test_imageset

def test_imageset():
    ints = S.Integers
    raises(TypeError, lambda: imageset(x, ints))
    raises(ValueError, lambda: imageset(x, y, z, ints))
    raises(ValueError, lambda: imageset(Lambda(x, cos(x)), y))
    assert imageset(cos, ints) == ImageSet(Lambda(x, cos(x)), ints)
    def f(x):
        return cos(x)
    raises(TypeError, lambda: imageset(f, ints))
    f = lambda x: cos(x)
    assert imageset(f, ints) == ImageSet(Lambda(x, cos(x)), ints)
    assert imageset(x, 1, ints) == FiniteSet(1)
    assert imageset(x, y, ints) == FiniteSet(y)
    assert (str(imageset(lambda y: x + y, Interval(-2, 1)).lamda.expr)
        in ('_x + x', 'x + _x'))
    x1, x2 = symbols("x1, x2")
    assert imageset(lambda x,y: Add(x,y), Interval(1,2), Interval(2, 3)) == \
        ImageSet(Lambda((x1, x2), x1+x2), Interval(1,2), Interval(2,3))
开发者ID:gamechanger98,项目名称:sympy,代码行数:18,代码来源:test_sets.py

示例8: test_invert_complex

def test_invert_complex():
    assert invert_complex(x + 3, y, x) == (x, FiniteSet(y - 3))
    assert invert_complex(x * 3, y, x) == (x, FiniteSet(y / 3))

    assert invert_complex(exp(x), y, x) == (x, imageset(Lambda(n, I * (2 * pi * n + arg(y)) + log(Abs(y))), S.Integers))

    assert invert_complex(log(x), y, x) == (x, FiniteSet(exp(y)))

    raises(ValueError, lambda: invert_real(S.One, y, x))
    raises(ValueError, lambda: invert_complex(x, x, x))
开发者ID:LuckyStrikes1090,项目名称:sympy,代码行数:10,代码来源:test_solveset.py

示例9: test_imageset

def test_imageset():
    ints = S.Integers
    raises(TypeError, lambda: imageset(x, ints))
    raises(ValueError, lambda: imageset(x, y, z, ints))
    raises(ValueError, lambda: imageset(Lambda(x, cos(x)), y))
    assert imageset(cos, ints) == ImageSet(Lambda(x, cos(x)), ints)

    def f(x):
        return cos(x)

    raises(TypeError, lambda: imageset(f, ints))
    f = lambda x: cos(x)
    assert imageset(f, ints) == ImageSet(Lambda(x, cos(x)), ints)
    assert imageset(x, 1, ints) == FiniteSet(1)
    assert imageset(x, y, ints) == FiniteSet(y)
    assert str(imageset(lambda y: x + y, Interval(-2, 1)).lamda.expr) in ("_x + x", "x + _x")
开发者ID:Carreau,项目名称:sympy,代码行数:16,代码来源:test_sets.py

示例10: test_solveset

def test_solveset():
    x = Symbol('x')
    raises(ValueError, lambda: solveset(x + y))
    raises(ValueError, lambda: solveset(x, 1))

    assert solveset(0, domain=S.Reals) == S.Reals
    assert solveset(1) == S.EmptySet
    assert solveset(True, domain=S.Reals) == S.Reals  # issue 10197
    assert solveset(False, domain=S.Reals) == S.EmptySet

    assert solveset(exp(x) - 1, domain=S.Reals) == FiniteSet(0)
    assert solveset(exp(x) - 1, x, S.Reals) == FiniteSet(0)
    assert solveset(Eq(exp(x), 1), x, S.Reals) == FiniteSet(0)

    assert solveset(x - 1 >= 0, x, S.Reals) == Interval(1, oo)
    assert solveset(exp(x) - 1 >= 0, x, S.Reals) == Interval(0, oo)

    assert solveset(exp(x) - 1, x) == imageset(Lambda(n, 2*I*pi*n), S.Integers)
    assert solveset(Eq(exp(x), 1), x) == imageset(Lambda(n, 2*I*pi*n),
                                                  S.Integers)
开发者ID:nickle8424,项目名称:sympy,代码行数:20,代码来源:test_solveset.py

示例11: test_image_interval

def test_image_interval():
    x = Symbol("x", real=True)
    assert imageset(x, 2 * x, Interval(-2, 1)) == Interval(-4, 2)
    assert imageset(x, 2 * x, Interval(-2, 1, True, False)) == Interval(-4, 2, True, False)
    assert imageset(x, x ** 2, Interval(-2, 1, True, False)) == Interval(0, 4, False, True)
    assert imageset(x, x ** 2, Interval(-2, 1)) == Interval(0, 4)
    assert imageset(x, x ** 2, Interval(-2, 1, True, False)) == Interval(0, 4, False, True)
    assert imageset(x, x ** 2, Interval(-2, 1, True, True)) == Interval(0, 4, False, True)
开发者ID:just-kir,项目名称:sympy,代码行数:8,代码来源:test_sets.py

示例12: test_conditonset

def test_conditonset():
    assert solveset(Eq(sin(x)**2 + cos(x)**2, 1), x, domain=S.Reals) == \
        ConditionSet(x, True, S.Reals)

    assert solveset(Eq(x**2 + x*sin(x), 1), x, domain=S.Reals) == \
        ConditionSet(x, Eq(x*(x + sin(x)) - 1, 0), S.Reals)

    assert solveset(Eq(sin(Abs(x)), x), x, domain=S.Reals) == \
        ConditionSet(x, Eq(-x + sin(Abs(x)), 0), Interval(-oo, oo))

    assert solveset(Eq(-I*(exp(I*x) - exp(-I*x))/2, 1), x) == \
        imageset(Lambda(n, 2*n*pi + pi/2), S.Integers)

    assert solveset(x + sin(x) > 1, x, domain=S.Reals) == \
        ConditionSet(x, x + sin(x) > 1, S.Reals)
开发者ID:nickle8424,项目名称:sympy,代码行数:15,代码来源:test_solveset.py

示例13: test_solve_trig

def test_solve_trig():
    from sympy.abc import n
    assert solveset_real(sin(x), x) == \
        Union(imageset(Lambda(n, 2*pi*n), S.Integers),
              imageset(Lambda(n, 2*pi*n + pi), S.Integers))

    assert solveset_real(sin(x) - 1, x) == \
        imageset(Lambda(n, 2*pi*n + pi/2), S.Integers)

    assert solveset_real(cos(x), x) == \
        Union(imageset(Lambda(n, 2*pi*n - pi/2), S.Integers),
              imageset(Lambda(n, 2*pi*n + pi/2), S.Integers))

    assert solveset_real(sin(x) + cos(x), x) == \
        Union(imageset(Lambda(n, 2*n*pi - pi/4), S.Integers),
              imageset(Lambda(n, 2*n*pi + 3*pi/4), S.Integers))

    assert solveset_real(sin(x)**2 + cos(x)**2, x) == S.EmptySet
开发者ID:nickle8424,项目名称:sympy,代码行数:18,代码来源:test_solveset.py

示例14: test_image_Union

def test_image_Union():
    x = Symbol('x', real=True)
    assert imageset(x, x**2, Interval(-2, 0) + FiniteSet(1, 2, 3)) == \
            (Interval(0, 4) + FiniteSet(9))
开发者ID:baruchel,项目名称:sympy,代码行数:4,代码来源:test_sets.py

示例15: test_image_FiniteSet

def test_image_FiniteSet():
    x = Symbol('x', real=True)
    assert imageset(x, 2*x, FiniteSet(1, 2, 3)) == FiniteSet(2, 4, 6)
开发者ID:baruchel,项目名称:sympy,代码行数:3,代码来源:test_sets.py


注:本文中的sympy.imageset函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。