Documentation Center

  • Trial Software
  • Product Updates

beta

Beta function

Syntax

beta(x,y)

Description

beta(x,y) returns the beta function of x and y.

Input Arguments

x

Symbolic number, variable, expression, function, or a vector or matrix of symbolic numbers, variables, expressions, or functions. If x is a vector or matrix, beta returns the beta function for each element of x.

y

Symbolic number, variable, expression, function, or a vector or matrix of symbolic numbers, variables, expressions, or functions. If y is a vector or matrix, beta returns the beta function for each element of y.

Examples

Compute the beta function for these numbers. Because these numbers are not symbolic objects, you get floating-point results:

[beta(1, 5), beta(3, sqrt(2)), beta(pi, exp(1)), beta(0, 1)]
ans =
    0.2000    0.1716    0.0379       Inf
 

Compute the beta function for the numbers converted to symbolic objects:

[beta(sym(1), 5), beta(3, sym(2)), beta(sym(4), sym(4))]
ans =
[ 1/5, 1/12, 1/140]

If one or both parameters are complex numbers, convert these numbers to symbolic objects:

[beta(sym(i), 3/2), beta(sym(i), i), beta(sym(i + 2), 1 - i)]
ans =
[ (pi^(1/2)*gamma(i))/(2*gamma(3/2 + i)), gamma(i)^2/gamma(2*i), (pi*(1/2 + i/2))/sinh(pi)]
 

Compute the beta function for negative parameters. If one or both arguments are negative numbers, convert these numbers to symbolic objects:

[beta(sym(-3), 2), beta(sym(-1/3), 2), beta(sym(-3), 4),  beta(sym(-3), -2)]
ans =
[ 1/6, -9/2, Inf, Inf]
 

Call beta for the matrix A and the value 1. The result is a matrix of the beta functions beta(A(i,j),1):

A = sym([1 2; 3 4]);
beta(A,1)
ans =
[   1, 1/2]
[ 1/3, 1/4]
 

Differentiate the beta function, then substitute the variable t with the value 2/3 and approximate the result using vpa:

syms t
u = diff(beta(t^2 + 1, t))
vpa(subs(u, t, 2/3), 10)
u =
beta(t, t^2 + 1)*(psi(t) + 2*t*psi(t^2 + 1) -...
psi(t^2 + t + 1)*(2*t + 1))

ans =
-2.836889094
 

Expand these beta functions:

syms x y
expand(beta(x, y))
expand(beta(x + 1, y - 1))
ans =
(gamma(x)*gamma(y))/gamma(x + y)

ans =
-(x*gamma(x)*gamma(y))/(gamma(x + y) - y*gamma(x + y))

More About

expand all

Beta Function

This integral defines the beta function:

Tips

  • The beta function is uniquely defined for positive numbers and complex numbers with positive real parts. It is approximated for other numbers.

  • Calling beta for numbers that are not symbolic objects invokes the MATLAB® beta function. This function accepts real arguments only. If you want to compute the beta function for complex numbers, use sym to convert the numbers to symbolic objects, and then call beta for those symbolic objects.

  • If one or both parameters are negative numbers, convert these numbers to symbolic objects using sym, and then call beta for those symbolic objects.

  • If the beta function has a singularity, beta returns the positive infinity Inf.

  • beta(0, 0) returns NaN.

  • beta(x,y) = beta(y,x) and beta(x,A) = beta(A,x).

  • At least one input argument must be a scalar or both arguments must be vectors or matrices of the same size. If one input argument is a scalar and the other one is a vector or a matrix, beta(x,y) expands the scalar into a vector or matrix of the same size as the other argument with all elements equal to that scalar.

References

Zelen, M. and N. C. Severo. "Probability Functions." Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.

See Also

| | | | |

Was this topic helpful?