Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Integral of the beta function

Asked by Martin on 3 Jun 2013

Hi!

I'm trying to compute the integral of the beta function, which is, up to a constant multiplier,

x^(1-alpha) * (1-x)^(1 - beta)

between 0 and 1. This function grows up to infinity in 0 (or 1) when alpha (or beta) < 1, and matlab has headache with the integral. If someone had an advise to help me, I'd be interested!

An approached value would suit me well with a not too large error. I thought about decomposing the function and simplify it near 0 and 1.

Thanks in advance :)

1 Comment

Walter Roberson on 3 Jun 2013

I am not clear on what you are doing. Are you saying that x^(1-alpha) * (1-x)^(1 - beta) is (to within a constant multiplier) the integral of the beta function? With the beta function itself being defined with an integral? Or are you saying that you are trying to calculate

integral from 0 to 1 of x^(1-alpha) * (1-x)^(1 - beta) dx

and that this overall expression is what forms the beta function?

Is there a connection between the "beta" of your formula and the "beta" of the "beta function" name ? For example, is your formula

integral over some range of x^(1-alpha) * (1-x)^(1 - beta(p,q)) dx

for some argument p, q (which might be related to x)?

MATLAB has a beta function which is defined as

 beta(z,w) = integral from 0 to 1 of t.^(z-1) .* (1-t).^(w-1)

When I try to match this against the formula you give, at first it appears that t should map to your x -- bit then the signs of your "1-alpha" and "1-beta" do not map to the "z-1" and "w-1" so I cannot map your expression as being beta(alpha,your beta). I would instead have to map your expression to beta(2 - alpha, 2 - your beta), which is sufficiently different as to cause me to question whether you are trying to write out the beta function formula or not.

Martin

Products

No products are associated with this question.

2 Answers

Answer by Roger Stafford on 3 Jun 2013

Martin, I think you have written your parameters for the beta function backwards. It should be the integral of

 x^(alpha-1)*(1-x)^(beta-1)

with respect to x from x = 0 to x = 1. Check the definition in Wikipedia:

 https://en.wikipedia.org/wiki/Beta_function

As you say, if alpha or beta lie between 0 and 1, this integrand is singular at one or both end points. Matlab's 'integral' function claims to be able to handle singularities in the integrand at its lower limit which should take care of the alpha < 1 case. From their documentation it isn't clear whether singularities at the upper limit are accepted. If not, you could always break the integration range into two halves and reverse the direction for the upper part so that the singularity is moved to the lower limit. (I seriously doubt if this is necessary, however.) If there are singularities, it is probably advisable to set a stringent error tolerance to be assured of accurate results.

If the 'integral' function doesn't perform properly with such singularities or if your version of matlab doesn't have this function, you can always use the well-known trick in calculus of making a change of variable. Suppose 0<alpha<1, creating a singularity at x = 0. Define a new variable

 y = x^alpha

Then the integral becomes the integral of 1/alpha*(1-y^(1/alpha)) with respect to y from y = 0 to y = 1, and the singularity at the lower limit is avoided. A similar trick can deal with a singularity stemming from 0<beta<1.

0 Comments

Roger Stafford
Answer by Martin on 3 Jun 2013

Ok that's great it works! I used a simple integration by parts and it killed dramatically the difficulties on the edge of the integration domain! Back to the school days I didn't think this was so useful and powerful :)

0 Comments

Martin

Contact us