本文整理汇总了Python中sympy.acot函数的典型用法代码示例。如果您正苦于以下问题:Python acot函数的具体用法?Python acot怎么用?Python acot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acot函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: test_acot
def test_acot():
x = Symbol('x')
r = Symbol('r', real=True)
assert acot(oo) == 0
assert acot(1) == pi/4
assert acot(0) == pi/2
assert acot(x).diff(x) == -1/(1+x**2)
assert acot(r).is_real == True
开发者ID:KevinGoodsell,项目名称:sympy,代码行数:11,代码来源:test_trigonometric.py
示例3: test_asin_rewrite
def test_asin_rewrite():
assert asin(x).rewrite(log) == -I*log(I*x + sqrt(1 - x**2))
assert asin(x).rewrite(atan) == 2*atan(x/(1 + sqrt(1 - x**2)))
assert asin(x).rewrite(acos) == S.Pi/2 - acos(x)
assert asin(x).rewrite(acot) == 2*acot((sqrt(-x**2 + 1) + 1)/x)
assert asin(x).rewrite(asec) == -asec(1/x) + pi/2
assert asin(x).rewrite(acsc) == acsc(1/x)
开发者ID:AdrianPotter,项目名称:sympy,代码行数:7,代码来源:test_trigonometric.py
示例4: test_atan_rewrite
def test_atan_rewrite():
assert atan(x).rewrite(log) == I*log((1 - I*x)/(1 + I*x))/2
assert atan(x).rewrite(asin) == (-asin(1/sqrt(x**2 + 1)) + pi/2)*sqrt(x**2)/x
assert atan(x).rewrite(acos) == sqrt(x**2)*acos(1/sqrt(x**2 + 1))/x
assert atan(x).rewrite(acot) == acot(1/x)
assert atan(x).rewrite(asec) == sqrt(x**2)*asec(sqrt(x**2 + 1))/x
assert atan(x).rewrite(acsc) == (-acsc(sqrt(x**2 + 1)) + pi/2)*sqrt(x**2)/x
开发者ID:AdrianPotter,项目名称:sympy,代码行数:7,代码来源:test_trigonometric.py
示例5: eval
def eval(cls, arg):
from sympy import acot
arg = sympify(arg)
if arg.is_Number:
if arg is S.NaN:
return S.NaN
elif arg is S.Infinity:
return S.Zero
elif arg is S.NegativeInfinity:
return S.Zero
elif arg is S.Zero:
return S.Pi*S.ImaginaryUnit / 2
elif arg is S.One:
return S.Infinity
elif arg is S.NegativeOne:
return S.NegativeInfinity
elif arg.is_negative:
return -cls(-arg)
else:
if arg is S.ComplexInfinity:
return S.Zero
i_coeff = arg.as_coefficient(S.ImaginaryUnit)
if i_coeff is not None:
return -S.ImaginaryUnit * acot(i_coeff)
else:
if _coeff_isneg(arg):
return -cls(-arg)
开发者ID:moorepants,项目名称:sympy,代码行数:30,代码来源:hyperbolic.py
示例6: test_conv7
def test_conv7():
x = Symbol("x")
y = Symbol("y")
assert sin(x/3) == sin(sympy.Symbol("x") / 3)
assert cos(x/3) == cos(sympy.Symbol("x") / 3)
assert tan(x/3) == tan(sympy.Symbol("x") / 3)
assert cot(x/3) == cot(sympy.Symbol("x") / 3)
assert csc(x/3) == csc(sympy.Symbol("x") / 3)
assert sec(x/3) == sec(sympy.Symbol("x") / 3)
assert asin(x/3) == asin(sympy.Symbol("x") / 3)
assert acos(x/3) == acos(sympy.Symbol("x") / 3)
assert atan(x/3) == atan(sympy.Symbol("x") / 3)
assert acot(x/3) == acot(sympy.Symbol("x") / 3)
assert acsc(x/3) == acsc(sympy.Symbol("x") / 3)
assert asec(x/3) == asec(sympy.Symbol("x") / 3)
assert sin(x/3)._sympy_() == sympy.sin(sympy.Symbol("x") / 3)
assert sin(x/3)._sympy_() != sympy.cos(sympy.Symbol("x") / 3)
assert cos(x/3)._sympy_() == sympy.cos(sympy.Symbol("x") / 3)
assert tan(x/3)._sympy_() == sympy.tan(sympy.Symbol("x") / 3)
assert cot(x/3)._sympy_() == sympy.cot(sympy.Symbol("x") / 3)
assert csc(x/3)._sympy_() == sympy.csc(sympy.Symbol("x") / 3)
assert sec(x/3)._sympy_() == sympy.sec(sympy.Symbol("x") / 3)
assert asin(x/3)._sympy_() == sympy.asin(sympy.Symbol("x") / 3)
assert acos(x/3)._sympy_() == sympy.acos(sympy.Symbol("x") / 3)
assert atan(x/3)._sympy_() == sympy.atan(sympy.Symbol("x") / 3)
assert acot(x/3)._sympy_() == sympy.acot(sympy.Symbol("x") / 3)
assert acsc(x/3)._sympy_() == sympy.acsc(sympy.Symbol("x") / 3)
assert asec(x/3)._sympy_() == sympy.asec(sympy.Symbol("x") / 3)
开发者ID:cbehan,项目名称:symengine.py,代码行数:29,代码来源:test_sympy_conv.py
示例7: test_cot
def test_cot():
assert cot(nan) == nan
assert cot.nargs == FiniteSet(1)
assert cot(oo*I) == -I
assert cot(-oo*I) == I
assert cot(0) == zoo
assert cot(2*pi) == zoo
assert cot(acot(x)) == x
assert cot(atan(x)) == 1 / x
assert cot(asin(x)) == sqrt(1 - x**2) / x
assert cot(acos(x)) == x / sqrt(1 - x**2)
assert cot(atan2(y, x)) == x/y
assert cot(pi*I) == -coth(pi)*I
assert cot(-pi*I) == coth(pi)*I
assert cot(-2*I) == coth(2)*I
assert cot(pi) == cot(2*pi) == cot(3*pi)
assert cot(-pi) == cot(-2*pi) == cot(-3*pi)
assert cot(pi/2) == 0
assert cot(-pi/2) == 0
assert cot(5*pi/2) == 0
assert cot(7*pi/2) == 0
assert cot(pi/3) == 1/sqrt(3)
assert cot(-2*pi/3) == 1/sqrt(3)
assert cot(pi/4) == S.One
assert cot(-pi/4) == -S.One
assert cot(17*pi/4) == S.One
assert cot(-3*pi/4) == S.One
assert cot(pi/6) == sqrt(3)
assert cot(-pi/6) == -sqrt(3)
assert cot(7*pi/6) == sqrt(3)
assert cot(-5*pi/6) == sqrt(3)
assert cot(x*I) == -coth(x)*I
assert cot(k*pi*I) == -coth(k*pi)*I
assert cot(r).is_real is True
assert cot(a).is_algebraic is None
assert cot(na).is_algebraic is False
assert cot(10*pi/7) == cot(3*pi/7)
assert cot(11*pi/7) == -cot(3*pi/7)
assert cot(-11*pi/7) == cot(3*pi/7)
assert cot(x).is_finite is None
assert cot(r).is_finite is None
i = Symbol('i', imaginary=True)
assert cot(i).is_finite is True
assert cot(x).subs(x, 3*pi) == zoo
开发者ID:AdrianPotter,项目名称:sympy,代码行数:59,代码来源:test_trigonometric.py
示例8: test_tan
def test_tan():
x, y = symbols('x,y')
r = Symbol('r', real=True)
k = Symbol('k', integer=True)
assert tan(nan) == nan
assert tan(oo*I) == I
assert tan(-oo*I) == -I
assert tan(0) == 0
assert tan(atan(x)) == x
assert tan(asin(x)) == x / sqrt(1 - x**2)
assert tan(acos(x)) == sqrt(1 - x**2) / x
assert tan(acot(x)) == 1 / x
assert tan(atan2(y, x)) == y/x
assert tan(pi*I) == tanh(pi)*I
assert tan(-pi*I) == -tanh(pi)*I
assert tan(-2*I) == -tanh(2)*I
assert tan(pi) == 0
assert tan(-pi) == 0
assert tan(2*pi) == 0
assert tan(-2*pi) == 0
assert tan(-3*10**73*pi) == 0
assert tan(pi/2) == zoo
assert tan(3*pi/2) == zoo
assert tan(pi/3) == sqrt(3)
assert tan(-2*pi/3) == sqrt(3)
assert tan(pi/4) == S.One
assert tan(-pi/4) == -S.One
assert tan(17*pi/4) == S.One
assert tan(-3*pi/4) == S.One
assert tan(pi/6) == 1/sqrt(3)
assert tan(-pi/6) == -1/sqrt(3)
assert tan(7*pi/6) == 1/sqrt(3)
assert tan(-5*pi/6) == 1/sqrt(3)
assert tan(x*I) == tanh(x)*I
assert tan(k*pi) == 0
assert tan(17*k*pi) == 0
assert tan(k*pi*I) == tanh(k*pi)*I
assert tan(r).is_real is True
assert tan(10*pi/7) == tan(3*pi/7)
assert tan(11*pi/7) == -tan(3*pi/7)
assert tan(-11*pi/7) == tan(3*pi/7)
开发者ID:malikdiarra,项目名称:sympy,代码行数:58,代码来源:test_trigonometric.py
示例9: test_as_leading_term_issue2173
def test_as_leading_term_issue2173():
assert sin(x).as_leading_term(x) == x
assert cos(x).as_leading_term(x) == 1
assert tan(x).as_leading_term(x) == x
assert cot(x).as_leading_term(x) == 1/x
assert asin(x).as_leading_term(x) == x
assert acos(x).as_leading_term(x) == x
assert atan(x).as_leading_term(x) == x
assert acot(x).as_leading_term(x) == x
开发者ID:mattpap,项目名称:sympy,代码行数:9,代码来源:test_trigonometric.py
示例10: test_tan
def test_tan():
assert tan(nan) == nan
assert tan.nargs == FiniteSet(1)
assert tan(oo*I) == I
assert tan(-oo*I) == -I
assert tan(0) == 0
assert tan(atan(x)) == x
assert tan(asin(x)) == x / sqrt(1 - x**2)
assert tan(acos(x)) == sqrt(1 - x**2) / x
assert tan(acot(x)) == 1 / x
assert tan(atan2(y, x)) == y/x
assert tan(pi*I) == tanh(pi)*I
assert tan(-pi*I) == -tanh(pi)*I
assert tan(-2*I) == -tanh(2)*I
assert tan(pi) == 0
assert tan(-pi) == 0
assert tan(2*pi) == 0
assert tan(-2*pi) == 0
assert tan(-3*10**73*pi) == 0
assert tan(pi/2) == zoo
assert tan(3*pi/2) == zoo
assert tan(pi/3) == sqrt(3)
assert tan(-2*pi/3) == sqrt(3)
assert tan(pi/4) == S.One
assert tan(-pi/4) == -S.One
assert tan(17*pi/4) == S.One
assert tan(-3*pi/4) == S.One
assert tan(pi/6) == 1/sqrt(3)
assert tan(-pi/6) == -1/sqrt(3)
assert tan(7*pi/6) == 1/sqrt(3)
assert tan(-5*pi/6) == 1/sqrt(3)
assert tan(x*I) == tanh(x)*I
assert tan(k*pi) == 0
assert tan(17*k*pi) == 0
assert tan(k*pi*I) == tanh(k*pi)*I
assert tan(r).is_real is True
assert tan(0, evaluate=False).is_algebraic
assert tan(a).is_algebraic is None
assert tan(na).is_algebraic is False
assert tan(10*pi/7) == tan(3*pi/7)
assert tan(11*pi/7) == -tan(3*pi/7)
assert tan(-11*pi/7) == tan(3*pi/7)
开发者ID:AdrianPotter,项目名称:sympy,代码行数:57,代码来源:test_trigonometric.py
示例11: test_acos_rewrite
def test_acos_rewrite():
assert acos(x).rewrite(log) == pi/2 + I*log(I*x + sqrt(1 - x**2))
assert acos(x).rewrite(atan) == \
atan(sqrt(1 - x**2)/x) + (pi/2)*(1 - x*sqrt(1/x**2))
assert acos(0).rewrite(atan) == S.Pi/2
assert acos(0.5).rewrite(atan) == acos(0.5).rewrite(log)
assert acos(x).rewrite(asin) == S.Pi/2 - asin(x)
assert acos(x).rewrite(acot) == -2*acot((sqrt(-x**2 + 1) + 1)/x) + pi/2
assert acos(x).rewrite(asec) == asec(1/x)
assert acos(x).rewrite(acsc) == -acsc(1/x) + pi/2
开发者ID:AdrianPotter,项目名称:sympy,代码行数:10,代码来源:test_trigonometric.py
示例12: test_cot
def test_cot():
x, y = symbols('x,y')
r = Symbol('r', real=True)
k = Symbol('k', integer=True)
assert cot(nan) == nan
assert cot(oo*I) == -I
assert cot(-oo*I) == I
assert cot(0) == zoo
assert cot(2*pi) == zoo
assert cot(acot(x)) == x
assert cot(atan(x)) == 1 / x
assert cot(asin(x)) == sqrt(1 - x**2) / x
assert cot(acos(x)) == x / sqrt(1 - x**2)
assert cot(atan2(y, x)) == x/y
assert cot(pi*I) == -coth(pi)*I
assert cot(-pi*I) == coth(pi)*I
assert cot(-2*I) == coth(2)*I
assert cot(pi) == cot(2*pi) == cot(3*pi)
assert cot(-pi) == cot(-2*pi) == cot(-3*pi)
assert cot(pi/2) == 0
assert cot(-pi/2) == 0
assert cot(5*pi/2) == 0
assert cot(7*pi/2) == 0
assert cot(pi/3) == 1/sqrt(3)
assert cot(-2*pi/3) == 1/sqrt(3)
assert cot(pi/4) == S.One
assert cot(-pi/4) == -S.One
assert cot(17*pi/4) == S.One
assert cot(-3*pi/4) == S.One
assert cot(pi/6) == sqrt(3)
assert cot(-pi/6) == -sqrt(3)
assert cot(7*pi/6) == sqrt(3)
assert cot(-5*pi/6) == sqrt(3)
assert cot(x*I) == -coth(x)*I
assert cot(k*pi*I) == -coth(k*pi)*I
assert cot(r).is_real is True
assert cot(10*pi/7) == cot(3*pi/7)
assert cot(11*pi/7) == -cot(3*pi/7)
assert cot(-11*pi/7) == cot(3*pi/7)
开发者ID:malikdiarra,项目名称:sympy,代码行数:54,代码来源:test_trigonometric.py
示例13: test_inverses
def test_inverses():
raises(AttributeError, lambda: sin(x).inverse())
raises(AttributeError, lambda: cos(x).inverse())
assert tan(x).inverse() == atan
assert cot(x).inverse() == acot
raises(AttributeError, lambda: csc(x).inverse())
raises(AttributeError, lambda: sec(x).inverse())
assert asin(x).inverse() == sin
assert acos(x).inverse() == cos
assert atan(x).inverse() == tan
assert acot(x).inverse() == cot
开发者ID:mattpap,项目名称:sympy,代码行数:11,代码来源:test_trigonometric.py
示例14: test_acot_rewrite
def test_acot_rewrite():
assert acot(x).rewrite(log) == I*log((x - I)/(x + I))/2
assert acot(x).rewrite(asin) == x*(-asin(sqrt(-x**2)/sqrt(-x**2 - 1)) + pi/2)*sqrt(x**(-2))
assert acot(x).rewrite(acos) == x*sqrt(x**(-2))*acos(sqrt(-x**2)/sqrt(-x**2 - 1))
assert acot(x).rewrite(atan) == atan(1/x)
assert acot(x).rewrite(asec) == x*sqrt(x**(-2))*asec(sqrt((x**2 + 1)/x**2))
assert acot(x).rewrite(acsc) == x*(-acsc(sqrt((x**2 + 1)/x**2)) + pi/2)*sqrt(x**(-2))
开发者ID:AdrianPotter,项目名称:sympy,代码行数:7,代码来源:test_trigonometric.py
示例15: test_cot
def test_cot():
assert cot(nan) == nan
assert cot.nargs == FiniteSet(1)
assert cot(oo*I) == -I
assert cot(-oo*I) == I
assert cot(0) == zoo
assert cot(2*pi) == zoo
assert cot(acot(x)) == x
assert cot(atan(x)) == 1 / x
assert cot(asin(x)) == sqrt(1 - x**2) / x
assert cot(acos(x)) == x / sqrt(1 - x**2)
assert cot(atan2(y, x)) == x/y
assert cot(pi*I) == -coth(pi)*I
assert cot(-pi*I) == coth(pi)*I
assert cot(-2*I) == coth(2)*I
assert cot(pi) == cot(2*pi) == cot(3*pi)
assert cot(-pi) == cot(-2*pi) == cot(-3*pi)
assert cot(pi/2) == 0
assert cot(-pi/2) == 0
assert cot(5*pi/2) == 0
assert cot(7*pi/2) == 0
assert cot(pi/3) == 1/sqrt(3)
assert cot(-2*pi/3) == 1/sqrt(3)
assert cot(pi/4) == S.One
assert cot(-pi/4) == -S.One
assert cot(17*pi/4) == S.One
assert cot(-3*pi/4) == S.One
assert cot(pi/6) == sqrt(3)
assert cot(-pi/6) == -sqrt(3)
assert cot(7*pi/6) == sqrt(3)
assert cot(-5*pi/6) == sqrt(3)
assert cot(x*I) == -coth(x)*I
assert cot(k*pi*I) == -coth(k*pi)*I
assert cot(r).is_real is True
assert cot(10*pi/7) == cot(3*pi/7)
assert cot(11*pi/7) == -cot(3*pi/7)
assert cot(-11*pi/7) == cot(3*pi/7)
开发者ID:waytai,项目名称:sympy,代码行数:49,代码来源:test_trigonometric.py
示例16: test_conv7b
def test_conv7b():
x = sympy.Symbol("x")
y = sympy.Symbol("y")
assert sympify(sympy.sin(x/3)) == sin(Symbol("x") / 3)
assert sympify(sympy.sin(x/3)) != cos(Symbol("x") / 3)
assert sympify(sympy.cos(x/3)) == cos(Symbol("x") / 3)
assert sympify(sympy.tan(x/3)) == tan(Symbol("x") / 3)
assert sympify(sympy.cot(x/3)) == cot(Symbol("x") / 3)
assert sympify(sympy.csc(x/3)) == csc(Symbol("x") / 3)
assert sympify(sympy.sec(x/3)) == sec(Symbol("x") / 3)
assert sympify(sympy.asin(x/3)) == asin(Symbol("x") / 3)
assert sympify(sympy.acos(x/3)) == acos(Symbol("x") / 3)
assert sympify(sympy.atan(x/3)) == atan(Symbol("x") / 3)
assert sympify(sympy.acot(x/3)) == acot(Symbol("x") / 3)
assert sympify(sympy.acsc(x/3)) == acsc(Symbol("x") / 3)
assert sympify(sympy.asec(x/3)) == asec(Symbol("x") / 3)
开发者ID:cbehan,项目名称:symengine.py,代码行数:16,代码来源:test_sympy_conv.py
示例17: test_acsc
def test_acsc():
assert acsc(nan) == nan
assert acsc(1) == pi/2
assert acsc(-1) == -pi/2
assert acsc(oo) == 0
assert acsc(-oo) == 0
assert acsc(zoo) == 0
assert acsc(x).diff(x) == -1/(x**2*sqrt(1 - 1/x**2))
assert acsc(x).as_leading_term(x) == log(x)
assert acsc(x).rewrite(log) == -I*log(sqrt(1 - 1/x**2) + I/x)
assert acsc(x).rewrite(asin) == asin(1/x)
assert acsc(x).rewrite(acos) == -acos(1/x) + pi/2
assert acsc(x).rewrite(atan) == (-atan(sqrt(x**2 - 1)) + pi/2)*sqrt(x**2)/x
assert acsc(x).rewrite(acot) == (-acot(1/sqrt(x**2 - 1)) + pi/2)*sqrt(x**2)/x
assert acsc(x).rewrite(asec) == -asec(x) + pi/2
开发者ID:AdrianPotter,项目名称:sympy,代码行数:17,代码来源:test_trigonometric.py
示例18: test_asec
def test_asec():
z = Symbol('z', zero=True)
assert asec(z) == nan
assert asec(nan) == nan
assert asec(1) == 0
assert asec(-1) == pi
assert asec(oo) == pi/2
assert asec(-oo) == pi/2
assert asec(zoo) == pi/2
assert asec(x).diff(x) == 1/(x**2*sqrt(1 - 1/x**2))
assert asec(x).as_leading_term(x) == log(x)
assert asec(x).rewrite(log) == I*log(sqrt(1 - 1/x**2) + I/x) + pi/2
assert asec(x).rewrite(asin) == -asin(1/x) + pi/2
assert asec(x).rewrite(acos) == acos(1/x)
assert asec(x).rewrite(atan) == (2*atan(x + sqrt(x**2 - 1)) - pi/2)*sqrt(x**2)/x
assert asec(x).rewrite(acot) == (2*acot(x - sqrt(x**2 - 1)) - pi/2)*sqrt(x**2)/x
assert asec(x).rewrite(acsc) == -acsc(x) + pi/2
开发者ID:fanminshi,项目名称:sympy,代码行数:19,代码来源:test_trigonometric.py
示例19: test_invert_real
def test_invert_real():
x = Dummy(real=True)
n = Symbol('n')
minus_n = Intersection(Interval(-oo, 0), FiniteSet(-n))
plus_n = Intersection(Interval(0, oo), FiniteSet(n))
assert solveset(abs(x) - n, x, S.Reals) == Union(minus_n, plus_n)
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))
minus_y = Intersection(Interval(-oo, 0), FiniteSet(-y))
plus_y = Intersection(Interval(0, oo), FiniteSet(y))
assert invert_real(Abs(x), y, x) == (x, Union(minus_y, plus_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))
y_1 = Intersection(Interval(-1, oo), FiniteSet(y - 1))
y_2 = Intersection(Interval(-oo, -1), FiniteSet(-y - 1))
assert invert_real(Abs(x**31 + x + 1), y, x) == (x**31 + x,
Union(y_1, y_2))
assert invert_real(sin(x), y, x) == \
(x, imageset(Lambda(n, n*pi + (-1)**n*asin(y)), S.Integers))
assert invert_real(sin(exp(x)), y, x) == \
(x, imageset(Lambda(n, log((-1)**n*asin(y) + n*pi)), S.Integers))
assert invert_real(csc(x), y, x) == \
(x, imageset(Lambda(n, n*pi + (-1)**n*acsc(y)), S.Integers))
assert invert_real(csc(exp(x)), y, x) == \
(x, imageset(Lambda(n, log((-1)**n*acsc(y) + n*pi)), S.Integers))
assert invert_real(cos(x), y, x) == \
(x, Union(imageset(Lambda(n, 2*n*pi + acos(y)), S.Integers), \
imageset(Lambda(n, 2*n*pi - acos(y)), S.Integers)))
assert invert_real(cos(exp(x)), y, x) == \
(x, Union(imageset(Lambda(n, log(2*n*pi + acos(y))), S.Integers), \
imageset(Lambda(n, log(2*n*pi - acos(y))), S.Integers)))
assert invert_real(sec(x), y, x) == \
(x, Union(imageset(Lambda(n, 2*n*pi + asec(y)), S.Integers), \
imageset(Lambda(n, 2*n*pi - asec(y)), S.Integers)))
assert invert_real(sec(exp(x)), y, x) == \
(x, Union(imageset(Lambda(n, log(2*n*pi + asec(y))), S.Integers), \
imageset(Lambda(n, log(2*n*pi - asec(y))), S.Integers)))
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)))
# Test for ``set_h`` containing information about the domain
n = Dummy('n')
x = Symbol('x')
h1 = Intersection(Interval(-3, oo), FiniteSet(a + b - 3),
imageset(Lambda(n, -n + a - 3), Interval(-oo, 0)))
h2 = Intersection(Interval(-oo, -3), FiniteSet(-a + b - 3),
imageset(Lambda(n, n - a - 3), Interval(0, oo)))
#.........这里部分代码省略.........
开发者ID:nickle8424,项目名称:sympy,代码行数:101,代码来源:test_solveset.py
示例20: test_aseries_trig
def test_aseries_trig():
assert cancel(gruntz(1/log(atan(x)), x, oo)
- 1/(log(pi) + log(S(1)/2))) == 0
assert gruntz(1/acot(x), x, -oo) == -oo
开发者ID:agamdua,项目名称:sympy,代码行数:4,代码来源:test_gruntz.py
注:本文中的sympy.acot函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论