# Ticket #9130: trac_9130-beta_function.patch

File trac_9130-beta_function.patch, 5.0 KB (added by burcin, 9 years ago)

combined Karen's patches

• ## doc/en/reference/functions.rst

# HG changeset patch
# User Karen T. Kohl <ktkohl96@gmail.com>
# Date 1326400728 21600
# Node ID aa729a73616e28c3bdf89950090597856a2e61c3
# Parent  92c93226b64f933e0af00bbcbd1a8a79c444f43f
Trac 9130: symbolic beta function

diff --git a/doc/en/reference/functions.rst b/doc/en/reference/functions.rst
 a sage/functions/transcendental sage/functions/piecewise sage/functions/orthogonal_polys sage/functions/other sage/functions/special sage/functions/wigner sage/functions/generalized sage/functions/prime_pi No newline at end of file sage/functions/prime_pi
• ## sage/functions/all.py

diff --git a/sage/functions/all.py b/sage/functions/all.py
 a from other import ( ceil, floor, gamma, psi, factorial, from other import ( ceil, floor, gamma, psi, factorial, beta, abs_symbolic, erf, sqrt, gamma_inc, incomplete_gamma, real_part, real,
• ## sage/functions/other.py

diff --git a/sage/functions/other.py b/sage/functions/other.py
 a binomial = Function_binomial() class Function_beta(GinacFunction): def __init__(self): r""" Return the beta function.  This is defined by .. math:: B(p,q) = \int_0^1 t^{p-1}(1-t)^{1-q} dt for complex or symbolic input p and q. Note that the order of inputs does not matter:  B(p,q)=B(q,p). GiNaC is used to compute B(p,q).  However, complex inputs are not yet handled in general.  When GiNaC raises an error on such inputs, we raise a NotImplementedError. If either input is 1, GiNaC returns the reciprocal of the other.  In other cases, GiNaC uses one of the following formulas: .. math:: B(p,q) = \Gamma(p)\Gamma(q)/\Gamma(p+q) or .. math:: B(p,q) = (-1)^q B(1-p-q, q). For numerical inputs, GiNaC uses the formula .. math:: B(p,q) =  \exp[\log\Gamma(p)+\log\Gamma(q)-\log\Gamma(p+q)] INPUT: -  p - number or symbolic expression -  q - number or symbolic expression OUTPUT: number or symbolic expression (if input is symbolic) EXAMPLES:: sage: beta(3,2) 1/12 sage: beta(3,1) 1/3 sage: beta(1/2,1/2) beta(1/2, 1/2) sage: beta(-1,1) -1 sage: beta(-1/2,-1/2) 0 sage: beta(x/2,3) beta(1/2*x, 3) sage: beta(.5,.5) 3.14159265358979 sage: beta(1,2.0+I) 0.400000000000000 - 0.200000000000000*I sage: beta(3,x+I) beta(x + I, 3) Note that the order of arguments does not matter:: sage: beta(1/2,3*x) beta(3*x, 1/2) The following must be fixed to remain symbolic:: sage: beta(2,1+5*I) -0.0305039787798408 - 0.0198938992042440*I """ GinacFunction.__init__(self, "beta", nargs=2, conversions=dict(maxima='beta', mathematica='Beta')) beta = Function_beta() def _do_sqrt(x, prec=None, extend=True, all=False): r""" Used internally to compute the square root of x.
• ## sage/symbolic/random_tests.py

diff --git a/sage/symbolic/random_tests.py b/sage/symbolic/random_tests.py
 a sage: [f for (one,f,arity) in _mk_full_functions()] [Ei, abs, arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctan2, arctanh, binomial, ceil, conjugate, cos, cosh, cot, coth, csc, csch, beta, binomial, ceil, conjugate, cos, cosh, cot, coth, csc, csch, dickman_rho, dilog, dirac_delta, elliptic_e, elliptic_ec, elliptic_eu, elliptic_f, elliptic_kc, elliptic_pi, erf, exp, factorial, floor, heaviside, imag_part, integrate, (euler_gamma - v3^(-e) + (v2 - factorial(-e/v2))^(((2.85879036573 - 1.18163393202*I)*v2 + (2.85879036573 - 1.18163393202*I)*v3)*pi - 0.247786879678 + 0.931826724898*I)*arccsc((0.891138386848 - 0.0936820840629*I)/v1) - (0.553423153995 - 0.5481180572*I)*v3 + 0.149683576515 - 0.155746451854*I)*v1 + arccsch(pi + e)*elliptic_f(khinchin*v2, 1.4656989704 + 0.863754357069*I) sage: random_expr(5, verbose=True) About to apply dirac_delta to [1] About to apply arccsch to [0] About to apply to [0, arccsch(0)] arccsch(0) About to apply arcsec to [0] About to apply to [0, arcsec(0)] arcsec(0) """ vars = [(1.0, sage.calculus.calculus.var('v%d' % (n+1))) for n in range(nvars)] if ncoeffs is None: