コード例 #1
0
ファイル: test_residues.py プロジェクト: AALEKH/sympy
def test_expressions_failing():
    assert residue(1/(x**4 + 1), x, exp(I*pi/4)) == -(S(1)/4 + I/4)/sqrt(2)

    n = Symbol('n', integer=True, positive=True)
    assert residue(exp(z)/(z - pi*I/4*a)**n, z, I*pi*a) == \
        exp(I*pi*a/4)/factorial(n - 1)
    assert residue(1/(x**2 + a**2)**2, x, a*I) == -I/4/a**3
コード例 #2
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_basic2():
    assert residue(1 / x, x, 1) == 0
    assert residue(-2 / x, x, 1) == 0
    assert residue(81 / x, x, -1) == 0
    assert residue(1 / x ** 2, x, 1) == 0
    assert residue(0, x, 1) == 0
    assert residue(5, x, 1) == 0
    assert residue(x, x, 1) == 0
    assert residue(x ** 2, x, 5) == 0
コード例 #3
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_basic1():
    assert residue(1 / x, x, 0) == 1
    assert residue(-2 / x, x, 0) == -2
    assert residue(81 / x, x, 0) == 81
    assert residue(1 / x ** 2, x, 0) == 0
    assert residue(0, x, 0) == 0
    assert residue(5, x, 0) == 0
    assert residue(x, x, 0) == 0
    assert residue(x ** 2, x, 0) == 0
コード例 #4
0
ファイル: test_residues.py プロジェクト: ALGHeArT/sympy
def test_basic2():
    x = Symbol("x")
    assert residue(1/x, x, 1) == 0
    assert residue(-2/x, x, 1) == 0
    assert residue(81/x, x, -1) == 0
    assert residue(1/x**2, x, 1) == 0
    assert residue(0, x, 1) == 0
    assert residue(5, x, 1) == 0
    assert residue(x, x, 1) == 0
    assert residue(x**2, x, 5) == 0
コード例 #5
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_expressions():
    assert residue(1 / (x + 1), x, 0) == 0
    assert residue(1 / (x + 1), x, -1) == 1
    assert residue(1 / (x ** 2 + 1), x, -1) == 0
    assert residue(1 / (x ** 2 + 1), x, I) == -I / 2
    assert residue(1 / (x ** 2 + 1), x, -I) == I / 2
    assert residue(1 / (x ** 4 + 1), x, 0) == 0
コード例 #6
0
ファイル: test_residues.py プロジェクト: vperic/sympy
def test_bug():
    from sympy.abc import s, z
    assert residue(2**(z)*(s+z)*(1-s-z)/z**2, z, 0) == \
           1 + s*log(2) - s**2*log(2) - 2*s
コード例 #7
0
ファイル: test_residues.py プロジェクト: vchekan/sympy
def _test_f():
    # FIXME: we get infinite recursion here:
    x = Symbol("x")
    f = Function("f")
    assert residue(f(x)/x**5, x, 0) == f.diff(x, 4)/24
コード例 #8
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 11:27:02 2021

@author: shrohanmohapatra
"""

from sympy import Symbol, residue, E, I, pi
z = Symbol('z')
print(residue(E**(I*pi*z)/(2*z+1)**2,z,-1/2))
from sympy import symbols, integrate
from sympy.functions import exp
R, t = symbols('R t')
print(integrate((exp(-I*pi*R*exp(I*t)))/(2*R* \
        exp(I*t)+1)**2,(t,0,pi)))
from random import randint
maxm = 135
A = []
G = 0
G1 = 0.01
while True:
    n = randint(0,maxm)
    if n not in A:
        A.append(n)
        G = G + (-1)**n/(2*n+1)**2
    if G1!=G and abs(G-G1)/abs(G1)<10**(-4)/2:
        break
    G1 = G
    print(n, len(A), G)
print('Sum =',G)    
コード例 #9
0
def test_issue_14037():
    assert residue(sin(x**50) / x**51, x, 0) == 1
コード例 #10
0
ファイル: test_residues.py プロジェクト: AALEKH/sympy
def _test_f():
    # FIXME: we get infinite recursion here:
    f = Function("f")
    assert residue(f(x)/x**5, x, 0) == f.diff(x, 4)/24
コード例 #11
0
ファイル: test_residues.py プロジェクト: hugovk/sympy
def test_issue_6499():
    assert residue(1 / (exp(z) - 1), z, 0) == 1
コード例 #12
0
ファイル: test_residues.py プロジェクト: hugovk/sympy
def test_expressions_failing():
    n = Symbol('n', integer=True, positive=True)
    assert residue(exp(z)/(z - pi*I/4*a)**n, z, I*pi*a) == \
        exp(I*pi*a/4)/factorial(n - 1)
コード例 #13
0
ファイル: test_residues.py プロジェクト: hugovk/sympy
def test_functions():
    assert residue(1 / sin(x), x, 0) == 1
    assert residue(2 / sin(x), x, 0) == 2
    assert residue(1 / sin(x)**2, x, 0) == 0
    assert residue(1 / sin(x)**5, x, 0) == Rational(3, 8)
コード例 #14
0
ファイル: test_residues.py プロジェクト: hugovk/sympy
def test_f():
    f = Function("f")
    assert residue(f(x) / x**5, x, 0) == f(x).diff(x, 4).subs(x, 0) / 24
コード例 #15
0
ファイル: test_residues.py プロジェクト: 101man/sympy
def test_functions():
    x = Symbol("x")
    assert residue(1/sin(x), x, 0) == 1
    assert residue(2/sin(x), x, 0) == 2
    assert residue(1/sin(x)**2, x, 0) == 0
コード例 #16
0
def test_issue_21176():
    f = x**2 * cot(pi * x) / (x**4 + 1)
    assert residue(f, x, -sqrt(2)/2 - sqrt(2)*I/2).cancel().together(deep=True)\
        == sqrt(2)*(1 - I)/(8*tan(sqrt(2)*pi*(1 + I)/2))
コード例 #17
0
ファイル: test_residues.py プロジェクト: Acebulf/sympy
def test_NotImplemented():
    z = Symbol('z')
    raises(NotImplementedError, lambda: residue(exp(1/z), z, 0))
コード例 #18
0
def test_issue_3400():
    assert residue(1/(exp(z) - 1), z, 0) == 1
コード例 #19
0
ファイル: test_residues.py プロジェクト: wuxi20/Pythonista
def test_NotImplemented():
    raises(NotImplementedError, lambda: residue(exp(1 / z), z, 0))
コード例 #20
0
ファイル: test_residues.py プロジェクト: ALGHeArT/sympy
def test_bug():
    from sympy.abc import s, z
    assert residue(2**(z)*(s+z)*(1-s-z)/z**2, z, 0) == \
           1 + s*log(2) - s**2*log(2) - 2*s
コード例 #21
0
ファイル: test_residues.py プロジェクト: AALEKH/sympy
def test_issue_3400():
    assert residue(1/(exp(z) - 1), z, 0) == 1

    # github issue 2519:
    assert residue((z**3 + 5)/((z**4 - 1)*(z + 1)), z, -1) == -S(9)/4
コード例 #22
0
ファイル: test_residues.py プロジェクト: wuxi20/Pythonista
def test_bug():
    assert residue(2**(z)*(s + z)*(1 - s - z)/z**2, z, 0) == \
        1 + s*log(2) - s**2*log(2) - 2*s
コード例 #23
0
ファイル: test_residues.py プロジェクト: tuhina/sympy
def test_expressions_failing():
    x = Symbol('x')
    assert residue(1/(x**4+1), x, exp(I*pi/4)) == -(S(1)/4+I/4)/sqrt(2)
コード例 #24
0
ファイル: test_residues.py プロジェクト: wuxi20/Pythonista
def test_issue_2555():
    assert residue(1 / (x**2 + a**2)**2, x, a * I) == -I / (4 * a**3)
コード例 #25
0
ファイル: test_residues.py プロジェクト: wuxi20/Pythonista
def test_issue_3400():
    assert residue(1 / (exp(z) - 1), z, 0) == 1
コード例 #26
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_functions():
    assert residue(1 / sin(x), x, 0) == 1
    assert residue(2 / sin(x), x, 0) == 2
    assert residue(1 / sin(x) ** 2, x, 0) == 0
    assert residue(1 / sin(x) ** 5, x, 0) == S(3) / 8
コード例 #27
0
ファイル: test_residues.py プロジェクト: vchekan/sympy
def test_functions():
    x = Symbol("x")
    assert residue(1/sin(x), x, 0) == 1
    assert residue(2/sin(x), x, 0) == 2
    assert residue(1/sin(x)**2, x, 0) == 0
    assert residue(1/sin(x)**5, x, 0) == S(3)/8
コード例 #28
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_issue_6499():
    assert residue(1 / (exp(z) - 1), z, 0) == 1
コード例 #29
0
ファイル: test_residues.py プロジェクト: vperic/sympy
def test_NotImplemented():
    z = Symbol('z')
    raises(NotImplementedError, lambda: residue(exp(1 / z), z, 0))
コード例 #30
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_issue_5654():
    assert residue(1 / (x ** 2 + a ** 2) ** 2, x, a * I) == -I / (4 * a ** 3)
コード例 #31
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_NotImplemented():
    raises(NotImplementedError, lambda: residue(exp(1 / z), z, 0))
コード例 #32
0
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def test_bug():
    assert residue(2 ** (z) * (s + z) * (1 - s - z) / z ** 2, z, 0) == 1 + s * log(2) - s ** 2 * log(2) - 2 * s
コード例 #33
-1
ファイル: test_residues.py プロジェクト: vipulroxx/sympy
def _test_f():
    f = Function("f")
    assert residue(f(x) / x ** 5, x, 0) == f(x).diff(x, 4).subs(x, 0) / 24