本文整理汇总了Python中sympy.acsc函数的典型用法代码示例。如果您正苦于以下问题:Python acsc函数的具体用法?Python acsc怎么用?Python acsc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acsc函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: 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
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: test_asec
def test_asec():
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:AdrianPotter,项目名称:sympy,代码行数:17,代码来源:test_trigonometric.py
示例8: 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
示例9: test_csc
def test_csc():
x = symbols('x', real=True)
z = symbols('z')
# https://github.com/sympy/sympy/issues/6707
cosecant = csc('x')
alternate = 1/sin('x')
assert cosecant.equals(alternate) == True
assert alternate.equals(cosecant) == True
assert csc.nargs == FiniteSet(1)
assert csc(0) == zoo
assert csc(pi) == zoo
assert csc(pi/2) == 1
assert csc(-pi/2) == -1
assert csc(pi/6) == 2
assert csc(pi/3) == 2*sqrt(3)/3
assert csc(5*pi/2) == 1
assert csc(9*pi/7) == -csc(2*pi/7)
assert csc(3*pi/4) == sqrt(2) # issue 8421
assert csc(I) == -I/sinh(1)
assert csc(x*I) == -I/sinh(x)
assert csc(-x) == -csc(x)
assert csc(acsc(x)) == x
assert csc(x).rewrite(exp) == 2*I/(exp(I*x) - exp(-I*x))
assert csc(x).rewrite(sin) == 1/sin(x)
assert csc(x).rewrite(cos) == csc(x)
assert csc(x).rewrite(tan) == (tan(x/2)**2 + 1)/(2*tan(x/2))
assert csc(x).rewrite(cot) == (cot(x/2)**2 + 1)/(2*cot(x/2))
assert csc(z).conjugate() == csc(conjugate(z))
assert (csc(z).as_real_imag() ==
(sin(re(z))*cosh(im(z))/(sin(re(z))**2*cosh(im(z))**2 +
cos(re(z))**2*sinh(im(z))**2),
-cos(re(z))*sinh(im(z))/(sin(re(z))**2*cosh(im(z))**2 +
cos(re(z))**2*sinh(im(z))**2)))
assert csc(x).expand(trig=True) == 1/sin(x)
assert csc(2*x).expand(trig=True) == 1/(2*sin(x)*cos(x))
assert csc(x).is_real == True
assert csc(z).is_real == None
assert csc(a).is_algebraic is None
assert csc(na).is_algebraic is False
assert csc(x).as_leading_term() == csc(x)
assert csc(0).is_finite == False
assert csc(x).is_finite == None
assert csc(pi/2).is_finite == True
assert series(csc(x), x, x0=pi/2, n=6) == \
1 + (x - pi/2)**2/2 + 5*(x - pi/2)**4/24 + O((x - pi/2)**6, (x, pi/2))
assert series(csc(x), x, x0=0, n=6) == \
1/x + x/6 + 7*x**3/360 + 31*x**5/15120 + O(x**6)
assert csc(x).diff(x) == -cot(x)*csc(x)
assert csc(x).taylor_term(2, x) == 0
assert csc(x).taylor_term(3, x) == 7*x**3/360
assert csc(x).taylor_term(5, x) == 31*x**5/15120
开发者ID:AdrianPotter,项目名称:sympy,代码行数:67,代码来源:test_trigonometric.py
注:本文中的sympy.acsc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论