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


Python risch.heurisch函数代码示例

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


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

示例1: test_heurisch_function

def test_heurisch_function():
    df = diff(f(x), x)

    assert heurisch(f(x), x)            == None
    assert heurisch(f(x)*df, x)         == f(x)**2/2
    assert heurisch(f(x)**2 * df, x)    == f(x)**3/3
    assert heurisch(df / f(x), x)       == log(f(x))
开发者ID:ALGHeArT,项目名称:sympy,代码行数:7,代码来源:test_risch.py

示例2: test_heurisch_hyperbolic

def test_heurisch_hyperbolic():
    assert heurisch(sinh(x), x) == cosh(x)
    assert heurisch(cosh(x), x) == sinh(x)

    assert heurisch(x*sinh(x), x) == x*cosh(x) - sinh(x)
    assert heurisch(x*cosh(x), x) == x*sinh(x) - cosh(x)

    assert heurisch(x*asinh(x/2), x) == x**2*asinh(x/2)/2 + asinh(x/2) - x*sqrt(4+x**2)/4
开发者ID:ALGHeArT,项目名称:sympy,代码行数:8,代码来源:test_risch.py

示例3: test_heurisch_radicals

def test_heurisch_radicals():
    assert heurisch(x**Rational(-1,2), x) == 2*x**Rational(1,2)
    assert heurisch(x**Rational(-3,2), x) == -2*x**Rational(-1,2)
    assert heurisch(x**Rational(3,2), x) == 2*x**Rational(5,2) / 5

    assert heurisch(sin(x)*sqrt(cos(x)), x) == -2*cos(x)**Rational(3,2) / 3
    assert heurisch(sin(y*sqrt(x)), x) == 2*y**(-2)*sin(y*x**S.Half) - \
                                          2*x**S.Half*cos(y*x**S.Half)/y
开发者ID:Grahack,项目名称:geophar,代码行数:8,代码来源:test_risch.py

示例4: test_heurisch_radicals

def test_heurisch_radicals():
    assert heurisch(1/sqrt(x), x) == 2*sqrt(x)
    assert heurisch(1/sqrt(x)**3, x) == -2/sqrt(x)
    assert heurisch(sqrt(x)**3, x) == 2*sqrt(x)**5/5

    assert heurisch(sin(x)*sqrt(cos(x)), x) == -2*sqrt(cos(x))**3/3
    assert heurisch(sin(y*sqrt(x)), x) == 2/y**2*sin(y*sqrt(x)) - \
                                          2*sqrt(x)*cos(y*sqrt(x))/y
开发者ID:ALGHeArT,项目名称:sympy,代码行数:8,代码来源:test_risch.py

示例5: test_heurisch_trigonometric

def test_heurisch_trigonometric():
    assert heurisch(sin(x), x) == -cos(x)
    assert heurisch(pi*sin(x)+1, x) == x-pi*cos(x)

    assert heurisch(cos(x), x) == sin(x)
    assert heurisch(tan(x), x) == log(1 + tan(x)**2)/2

    assert heurisch(sin(x)*sin(y), x) == -cos(x)*sin(y)
    assert heurisch(sin(x)*sin(y), y) == -cos(y)*sin(x)

    # gives sin(x) in answer when run via setup.py and cos(x) when run via py.test
    assert heurisch(sin(x)*cos(x), x) in [sin(x)**2 / 2, -cos(x)**2 / 2]
    assert heurisch(cos(x)/sin(x), x) == log(sin(x))

    assert heurisch(x*sin(7*x), x) == sin(7*x) / 49 - x*cos(7*x) / 7
    assert heurisch(1/pi/4 * x**2*cos(x), x) == 1/pi/4*(x**2*sin(x) - 2*sin(x) + 2*x*cos(x))
开发者ID:KevinGoodsell,项目名称:sympy,代码行数:16,代码来源:test_risch.py

示例6: test_heurisch_exp

def test_heurisch_exp():
    assert heurisch(exp(x), x) == exp(x)
    assert heurisch(exp(-x), x) == -exp(-x)
    assert heurisch(exp(17*x), x) == exp(17*x) / 17
    assert heurisch(x*exp(x), x) == x*exp(x) - exp(x)
    assert heurisch(x*exp(x**2), x) == exp(x**2) / 2

    assert heurisch(exp(-x**2), x) is None

    assert heurisch(2**x, x) == 2**x/log(2)
    assert heurisch(x*2**x, x) == x*2**x/log(2) - 2**x*log(2)**(-2)
开发者ID:ALGHeArT,项目名称:sympy,代码行数:11,代码来源:test_risch.py

示例7: test_heurisch_fractions

def test_heurisch_fractions():
    assert heurisch(1/x, x) == log(x)
    assert heurisch(1/(2 + x), x) == log(x + 2)
    assert heurisch(1/(x+sin(y)), x) == log(x+sin(y))

    # Up to a constant, where C = 5*pi*I/12, Mathematica gives identical
    # result in the first case. The difference is because sympy changes
    # signs of expressions without any care.
    # XXX ^ ^ ^ is this still correct?
    assert heurisch(5*x**5/(2*x**6 - 5), x) in [5*log(2*x**6 - 5) / 12, 5*log(-2*x**6 + 5) / 12]
    assert heurisch(5*x**5/(2*x**6 + 5), x) == 5*log(2*x**6 + 5) / 12

    assert heurisch(1/x**2, x) == -1/x
    assert heurisch(-1/x**5, x) == 1/(4*x**4)
开发者ID:ALGHeArT,项目名称:sympy,代码行数:14,代码来源:test_risch.py

示例8: test_heurisch_hacking

def test_heurisch_hacking():
    assert heurisch(sqrt(1 + 7*x**2), x, hints=[]) == \
        x*sqrt(1+7*x**2)/2 + sqrt(7)*asinh(sqrt(7)*x)/14
    assert heurisch(sqrt(1 - 7*x**2), x, hints=[]) == \
        x*sqrt(1-7*x**2)/2 + sqrt(7)*asin(sqrt(7)*x)/14

    assert heurisch(1/sqrt(1 + 7*x**2), x, hints=[]) == \
        sqrt(7)*asinh(sqrt(7)*x)/7
    assert heurisch(1/sqrt(1 - 7*x**2), x, hints=[]) == \
        sqrt(7)*asin(sqrt(7)*x)/7

    assert heurisch(exp(-7*x**2),x,hints=[]) == \
        sqrt(7*pi)*erf(sqrt(7)*x)/14

    assert heurisch(1/sqrt(9 - 4*x**2), x, hints=[]) == \
        asin(2*x/3)/2

    assert heurisch(1/sqrt(9 + 4*x**2), x, hints=[]) == \
        asinh(2*x/3)/2
开发者ID:ALGHeArT,项目名称:sympy,代码行数:19,代码来源:test_risch.py

示例9: test_heurisch_polynomials

def test_heurisch_polynomials():
    assert heurisch(1, x) == x
    assert heurisch(x, x) == x**2/2
    assert heurisch(x**17, x) == x**18/18
开发者ID:ALGHeArT,项目名称:sympy,代码行数:4,代码来源:test_risch.py

示例10: test_pmint_erf

def test_pmint_erf():
    f = exp(-x**2)*erf(x)/(erf(x)**3-erf(x)**2-erf(x)+1)
    g = sqrt(pi)/4 * (-1/(erf(x)-1) - log(erf(x)+1)/2 + log(erf(x)-1)/2)

    assert heurisch(f, x) == g
开发者ID:ALGHeArT,项目名称:sympy,代码行数:5,代码来源:test_risch.py

示例11: test_pmint_lambertw

def test_pmint_lambertw():
    g = (x**2 + (LambertW(x)*x)**2 - LambertW(x)*x**2)/(x*LambertW(x))
    assert simplify(heurisch(LambertW(x), x) - g) == 0
开发者ID:ALGHeArT,项目名称:sympy,代码行数:3,代码来源:test_risch.py

示例12: test_atom_bug

def test_atom_bug():
    from sympy import meijerg
    from sympy.integrals.risch import heurisch
    assert heurisch(meijerg([], [], [1], [], x), x) is None
开发者ID:ALGHeArT,项目名称:sympy,代码行数:4,代码来源:test_integrals.py

示例13: test_pmint_logexp

def test_pmint_logexp():
    f = (1+x+x*exp(x))*(x+log(x)+exp(x)-1)/(x+log(x)+exp(x))**2/x
    g = 1/(x+log(x)+exp(x)) + log(x + log(x) + exp(x))

    assert heurisch(f, x) == g
开发者ID:ALGHeArT,项目名称:sympy,代码行数:5,代码来源:test_risch.py

示例14: test_pmint_rat

def test_pmint_rat():
    skip('takes too much time')
    f = (x**7-24*x**4-4*x**2+8*x-8) / (x**8+6*x**6+12*x**4+8*x**2)
    g = (4 + 8*x**2 + 6*x + 3*x**3) / (x*(x**4 + 4*x**2 + 4))  +  log(x)

    assert heurisch(f, x) == g
开发者ID:Grahack,项目名称:geophar,代码行数:6,代码来源:test_risch.py

示例15: test_heurisch_symbolic_coeffs_1130

def test_heurisch_symbolic_coeffs_1130():
    assert heurisch(1/(x**2+y), x) in [I*y**(-S.Half)*log(x + (-y)**S.Half)/2 - \
    I*y**(-S.Half)*log(x - (-y)**S.Half)/2, I*log(x + I*y**Rational(1,2)) / \
    (2*y**Rational(1,2)) - I*log(x - I*y**Rational(1,2))/(2*y**Rational(1,2))]
开发者ID:Grahack,项目名称:geophar,代码行数:4,代码来源:test_risch.py


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