11from sympy .core .function import (diff , expand_func )
2- from sympy .core .numbers import I
2+ from sympy .core .numbers import I , Rational , pi
3+ from sympy .core .singleton import S
34from sympy .core .symbol import (Dummy , symbols )
5+ from sympy .functions .combinatorial .numbers import catalan
46from sympy .functions .elementary .complexes import conjugate
7+ from sympy .functions .elementary .miscellaneous import sqrt
58from sympy .functions .special .beta_functions import (beta , betainc , betainc_regularized )
6- from sympy .functions .special .gamma_functions import gamma
9+ from sympy .functions .special .gamma_functions import gamma , polygamma
710from sympy .functions .special .hyper import hyper
811from sympy .integrals .integrals import Integral
9- from sympy .functions .special .gamma_functions import polygamma
1012from sympy .core .function import ArgumentIndexError
1113from sympy .core .expr import unchanged
1214from sympy .testing .pytest import raises
@@ -17,6 +19,7 @@ def test_beta():
1719 t = Dummy ('t' )
1820
1921 assert unchanged (beta , x , y )
22+ assert unchanged (beta , x , x )
2023
2124 assert beta (5 , - 3 ).is_real == True
2225 assert beta (3 , y ).is_real is None
@@ -35,6 +38,24 @@ def test_beta():
3538 assert beta (x , y ).rewrite (gamma ) == gamma (x )* gamma (y )/ gamma (x + y )
3639 assert beta (x ).rewrite (gamma ) == gamma (x )** 2 / gamma (2 * x )
3740 assert beta (x , y ).rewrite (Integral ).dummy_eq (Integral (t ** (x - 1 ) * (1 - t )** (y - 1 ), (t , 0 , 1 )))
41+ assert beta (Rational (- 19 , 10 ), Rational (- 1 , 10 )) == S .Zero
42+ assert beta (Rational (- 19 , 10 ), Rational (- 9 , 10 )) == \
43+ 800 * 2 ** (S (4 )/ 5 )* sqrt (pi )* gamma (S .One / 10 )/ (171 * gamma (- S (7 )/ 5 ))
44+ assert beta (Rational (19 , 10 ), Rational (29 , 10 )) == 100 / (551 * catalan (Rational (19 , 10 )))
45+ assert beta (1 , 0 ) == S .ComplexInfinity
46+ assert beta (0 , 1 ) == S .ComplexInfinity
47+ assert beta (2 , 3 ) == S .One / 12
48+ assert unchanged (beta , x , x + 1 )
49+ assert unchanged (beta , x , 1 )
50+ assert unchanged (beta , 1 , y )
51+ assert beta (x , x + 1 ).doit () == 1 / (x * (x + 1 )* catalan (x ))
52+ assert beta (1 , y ).doit () == 1 / y
53+ assert beta (x , 1 ).doit () == 1 / x
54+ assert beta (Rational (- 19 , 10 ), Rational (- 1 , 10 ), evaluate = False ).doit () == S .Zero
55+ assert beta (2 ) == beta (2 , 2 )
56+ assert beta (x , evaluate = False ) != beta (x , x )
57+ assert beta (x , evaluate = False ).doit () == beta (x , x )
58+
3859
3960def test_betainc ():
4061 a , b , x1 , x2 = symbols ('a b x1 x2' )
@@ -51,6 +72,7 @@ def test_betainc():
5172
5273 assert betainc (1 , 2 , 3 , 3 ).evalf () == 0
5374
75+
5476def test_betainc_regularized ():
5577 a , b , x1 , x2 = symbols ('a b x1 x2' )
5678
0 commit comments