本文整理汇总了Python中sympy.acosh函数的典型用法代码示例。如果您正苦于以下问题:Python acosh函数的具体用法?Python acosh怎么用?Python acosh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acosh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_acosh_series
def test_acosh_series():
x = Symbol('x')
assert acosh(x).series(x, 0, 8) == \
-I*x + pi*I/2 - I*x**3/6 - 3*I*x**5/40 - 5*I*x**7/112 + O(x**8)
t5 = acosh(x).taylor_term(5, x)
assert t5 == - 3*I*x**5/40
assert acosh(x).taylor_term(7, x, t5, 0) == - 5*I*x**7/112
开发者ID:Aang,项目名称:sympy,代码行数:7,代码来源:test_hyperbolic.py
示例2: test_acosh
def test_acosh():
# TODO please write more tests -- see #652
# From http://functions.wolfram.com/ElementaryFunctions/ArcCosh/03/01/
# at specific points
assert acosh(1) == 0
assert acosh(-1) == pi*I
assert acosh(0) == I*pi/2
assert acosh(Rational(1,2)) == I*pi/3
assert acosh(Rational(-1,2)) == 2*pi*I/3
开发者ID:Aang,项目名称:sympy,代码行数:9,代码来源:test_hyperbolic.py
示例3: test_asech
def test_asech():
x = Symbol('x')
assert asech(-x) == asech(-x)
# values at fixed points
assert asech(1) == 0
assert asech(-1) == pi*I
assert asech(0) == oo
assert asech(2) == I*pi/3
assert asech(-2) == 2*I*pi / 3
# at infinites
assert asech(oo) == I*pi/2
assert asech(-oo) == I*pi/2
assert asech(zoo) == nan
assert asech(I) == log(1 + sqrt(2)) - I*pi/2
assert asech(-I) == log(1 + sqrt(2)) + I*pi/2
assert asech(sqrt(2) - sqrt(6)) == 11*I*pi / 12
assert asech(sqrt(2 - 2/sqrt(5))) == I*pi / 10
assert asech(-sqrt(2 - 2/sqrt(5))) == 9*I*pi / 10
assert asech(2 / sqrt(2 + sqrt(2))) == I*pi / 8
assert asech(-2 / sqrt(2 + sqrt(2))) == 7*I*pi / 8
assert asech(sqrt(5) - 1) == I*pi / 5
assert asech(1 - sqrt(5)) == 4*I*pi / 5
assert asech(-sqrt(2*(2 + sqrt(2)))) == 5*I*pi / 8
# properties
# asech(x) == acosh(1/x)
assert asech(sqrt(2)) == acosh(1/sqrt(2))
assert asech(2/sqrt(3)) == acosh(sqrt(3)/2)
assert asech(2/sqrt(2 + sqrt(2))) == acosh(sqrt(2 + sqrt(2))/2)
assert asech(S(2)) == acosh(1/S(2))
# asech(x) == I*acos(1/x)
# (Note: the exact formula is asech(x) == +/- I*acos(1/x))
assert asech(-sqrt(2)) == I*acos(-1/sqrt(2))
assert asech(-2/sqrt(3)) == I*acos(-sqrt(3)/2)
assert asech(-S(2)) == I*acos(-S.Half)
assert asech(-2/sqrt(2)) == I*acos(-sqrt(2)/2)
# sech(asech(x)) / x == 1
assert expand_mul(sech(asech(sqrt(6) - sqrt(2))) / (sqrt(6) - sqrt(2))) == 1
assert expand_mul(sech(asech(sqrt(6) + sqrt(2))) / (sqrt(6) + sqrt(2))) == 1
assert (sech(asech(sqrt(2 + 2/sqrt(5)))) / (sqrt(2 + 2/sqrt(5)))).simplify() == 1
assert (sech(asech(-sqrt(2 + 2/sqrt(5)))) / (-sqrt(2 + 2/sqrt(5)))).simplify() == 1
assert (sech(asech(sqrt(2*(2 + sqrt(2))))) / (sqrt(2*(2 + sqrt(2))))).simplify() == 1
assert expand_mul(sech(asech((1 + sqrt(5)))) / ((1 + sqrt(5)))) == 1
assert expand_mul(sech(asech((-1 - sqrt(5)))) / ((-1 - sqrt(5)))) == 1
assert expand_mul(sech(asech((-sqrt(6) - sqrt(2)))) / ((-sqrt(6) - sqrt(2)))) == 1
# numerical evaluation
assert str(asech(5*I).n(6)) == '0.19869 - 1.5708*I'
assert str(asech(-5*I).n(6)) == '0.19869 + 1.5708*I'
开发者ID:certik,项目名称:sympy,代码行数:55,代码来源:test_hyperbolic.py
示例4: test_manualintegrate_inversetrig
def test_manualintegrate_inversetrig():
# atan
assert manualintegrate(exp(x) / (1 + exp(2*x)), x) == atan(exp(x))
assert manualintegrate(1 / (4 + 9 * x**2), x) == atan(3 * x/2) / 6
assert manualintegrate(1 / (16 + 16 * x**2), x) == atan(x) / 16
assert manualintegrate(1 / (4 + x**2), x) == atan(x / 2) / 2
assert manualintegrate(1 / (1 + 4 * x**2), x) == atan(2*x) / 2
assert manualintegrate(1/(a + b*x**2), x) == \
Piecewise(((sqrt(a/b)*atan(x*sqrt(b/a))/a), And(a > 0, b > 0)))
assert manualintegrate(1/(4 + b*x**2), x) == \
Piecewise((sqrt(1/b)*atan(sqrt(b)*x/2)/2, b > 0))
assert manualintegrate(1/(a + 4*x**2), x) == \
Piecewise((atan(2*x*sqrt(1/a))/(2*sqrt(a)), a > 0))
assert manualintegrate(1/(4 + 4*x**2), x) == atan(x) / 4
# asin
assert manualintegrate(1/sqrt(1-x**2), x) == asin(x)
assert manualintegrate(1/sqrt(4-4*x**2), x) == asin(x)/2
assert manualintegrate(3/sqrt(1-9*x**2), x) == asin(3*x)
assert manualintegrate(1/sqrt(4-9*x**2), x) == asin(3*x/2)/3
# asinh
assert manualintegrate(1/sqrt(x**2 + 1), x) == \
asinh(x)
assert manualintegrate(1/sqrt(x**2 + 4), x) == \
asinh(x/2)
assert manualintegrate(1/sqrt(4*x**2 + 4), x) == \
asinh(x)/2
assert manualintegrate(1/sqrt(4*x**2 + 1), x) == \
asinh(2*x)/2
assert manualintegrate(1/sqrt(a*x**2 + 1), x) == \
Piecewise((sqrt(-1/a)*asin(x*sqrt(-a)), a < 0), (sqrt(1/a)*asinh(sqrt(a)*x), a > 0))
assert manualintegrate(1/sqrt(a + x**2), x) == \
Piecewise((asinh(x*sqrt(1/a)), a > 0), (acosh(x*sqrt(-1/a)), a < 0))
# acosh
assert manualintegrate(1/sqrt(x**2 - 1), x) == \
acosh(x)
assert manualintegrate(1/sqrt(x**2 - 4), x) == \
acosh(x/2)
assert manualintegrate(1/sqrt(4*x**2 - 4), x) == \
acosh(x)/2
assert manualintegrate(1/sqrt(9*x**2 - 1), x) == \
acosh(3*x)/3
assert manualintegrate(1/sqrt(a*x**2 - 4), x) == \
Piecewise((sqrt(1/a)*acosh(sqrt(a)*x/2), a > 0))
assert manualintegrate(1/sqrt(-a + 4*x**2), x) == \
Piecewise((asinh(2*x*sqrt(-1/a))/2, -a > 0), (acosh(2*x*sqrt(1/a))/2, -a < 0))
# piecewise
assert manualintegrate(1/sqrt(a-b*x**2), x) == \
Piecewise((sqrt(a/b)*asin(x*sqrt(b/a))/sqrt(a), And(-b < 0, a > 0)),
(sqrt(-a/b)*asinh(x*sqrt(-b/a))/sqrt(a), And(-b > 0, a > 0)),
(sqrt(a/b)*acosh(x*sqrt(b/a))/sqrt(-a), And(-b > 0, a < 0)))
assert manualintegrate(1/sqrt(a + b*x**2), x) == \
Piecewise((sqrt(-a/b)*asin(x*sqrt(-b/a))/sqrt(a), And(a > 0, b < 0)),
(sqrt(a/b)*asinh(x*sqrt(b/a))/sqrt(a), And(a > 0, b > 0)),
(sqrt(-a/b)*acosh(x*sqrt(-b/a))/sqrt(-a), And(a < 0, b > 0)))
开发者ID:A-turing-machine,项目名称:sympy,代码行数:58,代码来源:test_manual.py
示例5: test_simplifications
def test_simplifications():
x = Symbol("x")
assert sinh(asinh(x)) == x
assert sinh(acosh(x)) == sqrt(x - 1) * sqrt(x + 1)
assert sinh(atanh(x)) == x / sqrt(1 - x ** 2)
assert cosh(asinh(x)) == sqrt(1 + x ** 2)
assert cosh(acosh(x)) == x
assert cosh(atanh(x)) == 1 / sqrt(1 - x ** 2)
assert tanh(asinh(x)) == x / sqrt(1 + x ** 2)
assert tanh(acosh(x)) == sqrt(x - 1) * sqrt(x + 1) / x
assert tanh(atanh(x)) == x
开发者ID:rkern,项目名称:sympy-rkern,代码行数:13,代码来源:test_hyperbolic.py
示例6: test_messy
def test_messy():
from sympy import (laplace_transform, Si, Shi, Chi, atan, Piecewise,
acoth, E1, besselj, acosh, asin, And, re,
fourier_transform, sqrt)
assert laplace_transform(Si(x), x, s) == ((-atan(s) + pi/2)/s, 0, True)
assert laplace_transform(Shi(x), x, s) == (acoth(s)/s, 1, True)
# where should the logs be simplified?
assert laplace_transform(Chi(x), x, s) == \
((log(s**(-2)) - log((s**2 - 1)/s**2))/(2*s), 1, True)
# TODO maybe simplify the inequalities?
assert laplace_transform(besselj(a, x), x, s)[1:] == \
(0, And(S(0) < re(a/2) + S(1)/2, S(0) < re(a/2) + 1))
# NOTE s < 0 can be done, but argument reduction is not good enough yet
assert fourier_transform(besselj(1, x)/x, x, s, noconds=False) == \
(Piecewise((0, 4*abs(pi**2*s**2) > 1),
(2*sqrt(-4*pi**2*s**2 + 1), True)), s > 0)
# TODO FT(besselj(0,x)) - conditions are messy (but for acceptable reasons)
# - folding could be better
assert integrate(E1(x)*besselj(0, x), (x, 0, oo), meijerg=True) == \
log(1 + sqrt(2))
assert integrate(E1(x)*besselj(1, x), (x, 0, oo), meijerg=True) == \
log(S(1)/2 + sqrt(2)/2)
assert integrate(1/x/sqrt(1 - x**2), x, meijerg=True) == \
Piecewise((-acosh(1/x), 1 < abs(x**(-2))), (I*asin(1/x), True))
开发者ID:chaffra,项目名称:sympy,代码行数:30,代码来源:test_meijerint.py
示例7: test_issue_1304
def test_issue_1304():
z = Symbol("z", positive=True)
assert integrate(sqrt(x ** 2 + z ** 2), x) == z ** 2 * asinh(x / z) / 2 + x * (x ** 2 + z ** 2) ** (S(1) / 2) / 2
assert integrate(sqrt(x ** 2 - z ** 2), x) == -z ** 2 * acosh(x / z) / 2 + x * (x ** 2 - z ** 2) ** (S(1) / 2) / 2
assert (
integrate(sqrt(-x ** 2 - 4), x)
== -2 * atan(x / (-4 - x ** 2) ** (S(1) / 2)) + x * (-4 - x ** 2) ** (S(1) / 2) / 2
)
开发者ID:vks,项目名称:sympy,代码行数:8,代码来源:test_integrals.py
示例8: test_inverses
def test_inverses():
x = Symbol('x')
assert sinh(x).inverse() == asinh
raises(AttributeError, lambda: cosh(x).inverse())
assert tanh(x).inverse() == atanh
assert coth(x).inverse() == acoth
assert asinh(x).inverse() == sinh
assert acosh(x).inverse() == cosh
assert atanh(x).inverse() == tanh
assert acoth(x).inverse() == coth
开发者ID:Bercio,项目名称:sympy,代码行数:10,代码来源:test_hyperbolic.py
示例9: test_hyperbolic
def test_hyperbolic():
x = Symbol("x")
assert sinh(x).nseries(x, 0, 6) == x + x**3/6 + x**5/120 + O(x**6)
assert cosh(x).nseries(x, 0, 5) == 1 + x**2/2 + x**4/24 + O(x**5)
assert tanh(x).nseries(x, 0, 6) == x - x**3/3 + 2*x**5/15 + O(x**6)
assert coth(x).nseries(x, 0, 6) == 1/x - x**3/45 + x/3 + 2*x**5/945 + O(x**6)
assert asinh(x).nseries(x, 0, 6) == x - x**3/6 + 3*x**5/40 + O(x**6)
assert acosh(x).nseries(x, 0, 6) == pi*I/2 - I*x - 3*I*x**5/40 - I*x**3/6 + O(x**6)
assert atanh(x).nseries(x, 0, 6) == x + x**3/3 + x**5/5 + O(x**6)
assert acoth(x).nseries(x, 0, 6) == x + x**3/3 + x**5/5 + pi*I/2 + O(x**6)
开发者ID:jcockayne,项目名称:sympy-rkern,代码行数:10,代码来源:test_nseries.py
示例10: test_derivs
def test_derivs():
x = Symbol('x')
assert coth(x).diff(x) == -sinh(x)**(-2)
assert sinh(x).diff(x) == cosh(x)
assert cosh(x).diff(x) == sinh(x)
assert tanh(x).diff(x) == -tanh(x)**2 + 1
assert acoth(x).diff(x) == 1/(-x**2 + 1)
assert asinh(x).diff(x) == 1/sqrt(x**2 + 1)
assert acosh(x).diff(x) == 1/sqrt(x**2 - 1)
assert atanh(x).diff(x) == 1/(-x**2 + 1)
开发者ID:Bercio,项目名称:sympy,代码行数:10,代码来源:test_hyperbolic.py
示例11: test_conv12b
def test_conv12b():
x = sympy.Symbol("x")
y = sympy.Symbol("y")
assert sympify(sympy.sinh(x/3)) == sinh(Symbol("x") / 3)
assert sympify(sympy.cosh(x/3)) == cosh(Symbol("x") / 3)
assert sympify(sympy.tanh(x/3)) == tanh(Symbol("x") / 3)
assert sympify(sympy.coth(x/3)) == coth(Symbol("x") / 3)
assert sympify(sympy.asinh(x/3)) == asinh(Symbol("x") / 3)
assert sympify(sympy.acosh(x/3)) == acosh(Symbol("x") / 3)
assert sympify(sympy.atanh(x/3)) == atanh(Symbol("x") / 3)
assert sympify(sympy.acoth(x/3)) == acoth(Symbol("x") / 3)
开发者ID:cbehan,项目名称:symengine.py,代码行数:11,代码来源:test_sympy_conv.py
示例12: test_leading_term
def test_leading_term():
x = Symbol('x')
assert cosh(x).as_leading_term(x) == 1
assert coth(x).as_leading_term(x) == 1/x
assert acosh(x).as_leading_term(x) == I*pi/2
assert acoth(x).as_leading_term(x) == I*pi/2
for func in [sinh, tanh, asinh, atanh]:
assert func(x).as_leading_term(x) == x
for func in [sinh, cosh, tanh, coth, asinh, acosh, atanh, acoth]:
for arg in (1/x, S.Half):
eq = func(arg)
assert eq.as_leading_term(x) == eq
开发者ID:Devendra0910,项目名称:sympy,代码行数:12,代码来源:test_hyperbolic.py
示例13: test_numpy_numexpr
def test_numpy_numexpr():
if not numpy:
skip("numpy not installed.")
if not numexpr:
skip("numexpr not installed.")
a, b, c = numpy.random.randn(3, 128, 128)
# ensure that numpy and numexpr return same value for complicated expression
expr = sin(x) + cos(y) + tan(z)**2 + Abs(z-y)*acos(sin(y*z)) + \
Abs(y-z)*acosh(2+exp(y-x))- sqrt(x**2+I*y**2)
npfunc = lambdify((x, y, z), expr, modules='numpy')
nefunc = lambdify((x, y, z), expr, modules='numexpr')
assert numpy.allclose(npfunc(a, b, c), nefunc(a, b, c))
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:12,代码来源:test_lambdify.py
示例14: test_simplifications
def test_simplifications():
x = Symbol('x')
assert sinh(asinh(x)) == x
assert sinh(acosh(x)) == sqrt(x - 1) * sqrt(x + 1)
assert sinh(atanh(x)) == x/sqrt(1 - x**2)
assert sinh(acoth(x)) == 1/(sqrt(x - 1) * sqrt(x + 1))
assert cosh(asinh(x)) == sqrt(1 + x**2)
assert cosh(acosh(x)) == x
assert cosh(atanh(x)) == 1/sqrt(1 - x**2)
assert cosh(acoth(x)) == x/(sqrt(x - 1) * sqrt(x + 1))
assert tanh(asinh(x)) == x/sqrt(1 + x**2)
assert tanh(acosh(x)) == sqrt(x - 1) * sqrt(x + 1) / x
assert tanh(atanh(x)) == x
assert tanh(acoth(x)) == 1/x
assert coth(asinh(x)) == sqrt(1 + x**2)/x
assert coth(acosh(x)) == x/(sqrt(x - 1) * sqrt(x + 1))
assert coth(atanh(x)) == 1/x
assert coth(acoth(x)) == x
assert csch(asinh(x)) == 1/x
assert csch(acosh(x)) == 1/(sqrt(x - 1) * sqrt(x + 1))
assert csch(atanh(x)) == sqrt(1 - x**2)/x
assert csch(acoth(x)) == sqrt(x - 1) * sqrt(x + 1)
assert sech(asinh(x)) == 1/sqrt(1 + x**2)
assert sech(acosh(x)) == 1/x
assert sech(atanh(x)) == sqrt(1 - x**2)
assert sech(acoth(x)) == sqrt(x - 1) * sqrt(x + 1)/x
开发者ID:certik,项目名称:sympy,代码行数:31,代码来源:test_hyperbolic.py
示例15: test_issue_4403
def test_issue_4403():
x = Symbol('x')
y = Symbol('y')
z = Symbol('z', positive=True)
assert integrate(sqrt(x**2 + z**2), x) == \
z**2*asinh(x/z)/2 + x*sqrt(x**2 + z**2)/2
assert integrate(sqrt(x**2 - z**2), x) == \
-z**2*acosh(x/z)/2 + x*sqrt(x**2 - z**2)/2
x = Symbol('x', real=True)
y = Symbol('y', positive=True)
assert integrate(1/(x**2 + y**2)**S('3/2'), x) == \
x/(y**2*sqrt(x**2 + y**2))
开发者ID:baoqchau,项目名称:sympy,代码行数:13,代码来源:test_integrals.py
示例16: test_fps__hyper
def test_fps__hyper():
f = sin(x)
assert fps(f, x).truncate() == x - x ** 3 / 6 + x ** 5 / 120 + O(x ** 6)
f = cos(x)
assert fps(f, x).truncate() == 1 - x ** 2 / 2 + x ** 4 / 24 + O(x ** 6)
f = exp(x)
assert fps(f, x).truncate() == 1 + x + x ** 2 / 2 + x ** 3 / 6 + x ** 4 / 24 + x ** 5 / 120 + O(x ** 6)
f = atan(x)
assert fps(f, x).truncate() == x - x ** 3 / 3 + x ** 5 / 5 + O(x ** 6)
f = exp(acos(x))
assert fps(f, x).truncate() == (
exp(pi / 2)
- x * exp(pi / 2)
+ x ** 2 * exp(pi / 2) / 2
- x ** 3 * exp(pi / 2) / 3
+ 5 * x ** 4 * exp(pi / 2) / 24
- x ** 5 * exp(pi / 2) / 6
+ O(x ** 6)
)
f = exp(acosh(x))
assert fps(f, x).truncate() == I + x - I * x ** 2 / 2 - I * x ** 4 / 8 + O(x ** 6)
f = atan(1 / x)
assert fps(f, x).truncate() == pi / 2 - x + x ** 3 / 3 - x ** 5 / 5 + O(x ** 6)
f = x * atan(x) - log(1 + x ** 2) / 2
assert fps(f, x, rational=False).truncate() == x ** 2 / 2 - x ** 4 / 12 + O(x ** 6)
f = log(1 + x)
assert fps(f, x, rational=False).truncate() == x - x ** 2 / 2 + x ** 3 / 3 - x ** 4 / 4 + x ** 5 / 5 + O(x ** 6)
f = airyai(x ** 2)
assert fps(f, x).truncate() == (
3 ** Rational(5, 6) * gamma(Rational(1, 3)) / (6 * pi)
- 3 ** Rational(2, 3) * x ** 2 / (3 * gamma(Rational(1, 3)))
+ O(x ** 6)
)
f = exp(x) * sin(x)
assert fps(f, x).truncate() == x + x ** 2 + x ** 3 / 3 - x ** 5 / 30 + O(x ** 6)
f = exp(x) * sin(x) / x
assert fps(f, x).truncate() == 1 + x + x ** 2 / 3 - x ** 4 / 30 - x ** 5 / 90 + O(x ** 6)
f = sin(x) * cos(x)
assert fps(f, x).truncate() == x - 2 * x ** 3 / 3 + 2 * x ** 5 / 15 + O(x ** 6)
开发者ID:Carreau,项目名称:sympy,代码行数:51,代码来源:test_formal.py
示例17: test_derivs
def test_derivs():
x = Symbol('x')
assert coth(x).diff(x) == -sinh(x)**(-2)
assert sinh(x).diff(x) == cosh(x)
assert cosh(x).diff(x) == sinh(x)
assert tanh(x).diff(x) == -tanh(x)**2 + 1
assert csch(x).diff(x) == -coth(x)*csch(x)
assert sech(x).diff(x) == -tanh(x)*sech(x)
assert acoth(x).diff(x) == 1/(-x**2 + 1)
assert asinh(x).diff(x) == 1/sqrt(x**2 + 1)
assert acosh(x).diff(x) == 1/sqrt(x**2 - 1)
assert atanh(x).diff(x) == 1/(-x**2 + 1)
assert asech(x).diff(x) == -1/(x*sqrt(1 - x**2))
assert acsch(x).diff(x) == -1/(x**2*sqrt(1 + x**(-2)))
开发者ID:certik,项目名称:sympy,代码行数:14,代码来源:test_hyperbolic.py
示例18: test_conv12
def test_conv12():
x = Symbol("x")
y = Symbol("y")
assert sinh(x/3) == sinh(sympy.Symbol("x") / 3)
assert cosh(x/3) == cosh(sympy.Symbol("x") / 3)
assert tanh(x/3) == tanh(sympy.Symbol("x") / 3)
assert coth(x/3) == coth(sympy.Symbol("x") / 3)
assert asinh(x/3) == asinh(sympy.Symbol("x") / 3)
assert acosh(x/3) == acosh(sympy.Symbol("x") / 3)
assert atanh(x/3) == atanh(sympy.Symbol("x") / 3)
assert acoth(x/3) == acoth(sympy.Symbol("x") / 3)
assert sinh(x/3)._sympy_() == sympy.sinh(sympy.Symbol("x") / 3)
assert cosh(x/3)._sympy_() == sympy.cosh(sympy.Symbol("x") / 3)
assert tanh(x/3)._sympy_() == sympy.tanh(sympy.Symbol("x") / 3)
assert coth(x/3)._sympy_() == sympy.coth(sympy.Symbol("x") / 3)
assert asinh(x/3)._sympy_() == sympy.asinh(sympy.Symbol("x") / 3)
assert acosh(x/3)._sympy_() == sympy.acosh(sympy.Symbol("x") / 3)
assert atanh(x/3)._sympy_() == sympy.atanh(sympy.Symbol("x") / 3)
assert acoth(x/3)._sympy_() == sympy.acoth(sympy.Symbol("x") / 3)
开发者ID:cbehan,项目名称:symengine.py,代码行数:20,代码来源:test_sympy_conv.py
示例19: test_bng_printer
def test_bng_printer():
# Constants
assert _bng_print(sympy.pi) == '_pi'
assert _bng_print(sympy.E) == '_e'
x, y = sympy.symbols('x y')
# Binary functions
assert _bng_print(sympy.sympify('x & y')) == 'x && y'
assert _bng_print(sympy.sympify('x | y')) == 'x || y'
# Trig functions
assert _bng_print(sympy.sin(x)) == 'sin(x)'
assert _bng_print(sympy.cos(x)) == 'cos(x)'
assert _bng_print(sympy.tan(x)) == 'tan(x)'
assert _bng_print(sympy.asin(x)) == 'asin(x)'
assert _bng_print(sympy.acos(x)) == 'acos(x)'
assert _bng_print(sympy.atan(x)) == 'atan(x)'
assert _bng_print(sympy.sinh(x)) == 'sinh(x)'
assert _bng_print(sympy.cosh(x)) == 'cosh(x)'
assert _bng_print(sympy.tanh(x)) == 'tanh(x)'
assert _bng_print(sympy.asinh(x)) == 'asinh(x)'
assert _bng_print(sympy.acosh(x)) == 'acosh(x)'
assert _bng_print(sympy.atanh(x)) == 'atanh(x)'
# Logs and powers
assert _bng_print(sympy.log(x)) == 'ln(x)'
assert _bng_print(sympy.exp(x)) == 'exp(x)'
assert _bng_print(sympy.sqrt(x)) == 'sqrt(x)'
# Rounding
assert _bng_print(sympy.Abs(x)) == 'abs(x)'
assert _bng_print(sympy.floor(x)) == 'rint(x - 0.5)'
assert _bng_print(sympy.ceiling(x)) == '(rint(x + 1) - 1)'
# Min/max
assert _bng_print(sympy.Min(x, y)) == 'min(x, y)'
assert _bng_print(sympy.Max(x, y)) == 'max(x, y)'
开发者ID:LoLab-VU,项目名称:pysb,代码行数:38,代码来源:test_bng.py
示例20: test_mathml_trig
def test_mathml_trig():
mml = mp._print(sin(x))
assert mml.childNodes[0].nodeName == 'sin'
mml = mp._print(cos(x))
assert mml.childNodes[0].nodeName == 'cos'
mml = mp._print(tan(x))
assert mml.childNodes[0].nodeName == 'tan'
mml = mp._print(asin(x))
assert mml.childNodes[0].nodeName == 'arcsin'
mml = mp._print(acos(x))
assert mml.childNodes[0].nodeName == 'arccos'
mml = mp._print(atan(x))
assert mml.childNodes[0].nodeName == 'arctan'
mml = mp._print(sinh(x))
assert mml.childNodes[0].nodeName == 'sinh'
mml = mp._print(cosh(x))
assert mml.childNodes[0].nodeName == 'cosh'
mml = mp._print(tanh(x))
assert mml.childNodes[0].nodeName == 'tanh'
mml = mp._print(asinh(x))
assert mml.childNodes[0].nodeName == 'arcsinh'
mml = mp._print(atanh(x))
assert mml.childNodes[0].nodeName == 'arctanh'
mml = mp._print(acosh(x))
assert mml.childNodes[0].nodeName == 'arccosh'
开发者ID:A-turing-machine,项目名称:sympy,代码行数:36,代码来源:test_mathml.py
注:本文中的sympy.acosh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论