4
$\begingroup$

I am trying to find the result of $$\int x^{-d/2}(1-x)^{(d-3)/2}dx$$ where $0<x<1$ and $d\ge2$ is an integer.

Mathematica gives the following:

Clear[d];
Integrate[x^(-d/2) (1 - x)^((d - 3)/2), x, Assumptions -> 0 < x < 1]
-((2 x^(1 - d/2)Hypergeometric2F1[(3 - d)/2, 1 - d/2, 2 - d/2, x])/(-2 + d))

This seems to be fine except for even values of $d\ge4$ because in this case the hypergeometric series is not defined. I've also tried the following:

Clear[d];
d = 2 k;
$Assumptions = k > 0 && k \[Element] Integers;
Integrate[x^(-d/2) (1 - x)^((d - 3)/2), x, Assumptions -> 0 < x < 1]

but Mathematica still gives the same expression:

(x^(1 - k) Hypergeometric2F1[1 - k, 3/2 - k, 2 - k, x])/(1 - k)

If I try to evaluate this expression for any integer value of $k\ge1$ it gives

ComplexInfinity

as expected.

However, the integral clearly exists as if I tell Mathematica to integrate $\int x^{-d/2}(1-x)^{(d-3)/2}dx$ for a specific value of $d$ it always gives an answer; for example, for $d=4$:

d = 4;
Integrate[x^(-d/2) (1 - x)^((d - 3)/2), x, Assumptions -> 0 < x < 1]
-(Sqrt[1 - x]/x) + ArcTanh[Sqrt[1 - x]]

I need an expression for general $d$, however. Any idea how I can get Mathematica to do this integral in general?

$\endgroup$
5
  • 1
    $\begingroup$ Welcome to Mathematica StackExchange! I am slightly confused. You are integrating over $x$, yet you are putting the $x$ range to assumptions. Clearly you want a definite integral, $\int_0^1 x^{-d/2}(1-x)^{(d-3)/2}\, \mathrm{d}x$, right? Then you should use Integrate[(1 - x)^(1/2 (-3 + d)) x^(-d/2), {x, 0, 1}]. This gives $\Gamma \left(1-d/2\right) \Gamma \left((d-1)/2\right)/\sqrt{\pi }$ for $1< d < 2$. $\endgroup$
    – Domen
    Commented May 26, 2023 at 13:10
  • $\begingroup$ No, I do not want a definite integral, I want the indefinite integral. In the context in which I am trying to solve this integral my $x$ is between $0$ and $1$, but I don't need the definite integral. $\endgroup$
    – Radu Moga
    Commented May 26, 2023 at 13:18
  • 7
    $\begingroup$ You can do a math trick: shift your $d$ by $3$ and integrate $\int x^{-(d+3)/2}(1-x)^{d/2}dx$. $\endgroup$
    – user58955
    Commented May 26, 2023 at 14:17
  • $\begingroup$ You say you don't need the definite integral, but beware. $\endgroup$
    – march
    Commented May 26, 2023 at 16:37
  • $\begingroup$ @user58955 Thanks! This is interesting, and I'm curious, why does this trick work? $\endgroup$
    – Radu Moga
    Commented May 29, 2023 at 12:03

2 Answers 2

8
$\begingroup$

This is an incomplete Euler beta function: Beta[z0, z1, a, b] is

$$ B_{z_0,z_1}(a,b)=\int_{z_0}^{z_1}t^{a-1}(1-t)^{b-1}dt. $$

Define

f[d_, x_] = Beta[1, x, 1 - d/2, (d - 1)/2];

and check that its $x$-derivative matches your expression:

D[f[d, x], x] // FullSimplify
(*    (1 - x)^(1/2 (-3 + d)) x^(-d/2)    *)

where I've quite arbitrarily picked $z_0=1$; any value $z_0\in(0,1]$ will work (but not $z_0=0$!); even some complex values would work, as in the hypergeometric solutions coming from user58955's comment.

Plot some values:

Plot[Evaluate@Table[f[d, x], {d, 1, 10}], {x, 0, 1}]

enter image description here

$\endgroup$
0
4
$\begingroup$

An extension of @user58955's trick:

ans = Integrate[
    int = x^(-d/2) (1 - x)^((d - 3)/2) /. d -> d + 3, {x, 1/4, x}, 
    Assumptions -> 0 < x < 1] /. d -> d - 3 // Normal
(*
4 I^(3 - d) Hypergeometric2F1[1/2, (3 - d)/2, 3/2, 4] - 
 (2 I^(3 - d) Hypergeometric2F1[1/2, (3 - d)/2, 3/2, 1/x])/Sqrt[x]
*)

psol = ParametricNDSolveValue[{y'[x] == int /. d -> d - 3, 
   y[1/4] == 0}, y, {x, 0, 1}, {d}]

Clear[d];
Manipulate[
 Quiet[
  Plot[{ans, psol[d][x]} /. d -> d0 // Evaluate, {x, 0, 1}, 
   PlotStyle -> {AbsoluteThickness[6], AbsoluteThickness[3]}],
  ParametricNDSolveValue::ndsz],
 {d0, 4, 10, 1, Appearance -> "Labeled"}
 ]
$\endgroup$
2
  • 1
    $\begingroup$ As a warning to others, in 12.3 or 13.0, a different (wrong?) result is obtained. $\endgroup$
    – Domen
    Commented May 26, 2023 at 19:59
  • 1
    $\begingroup$ @Domen Just to be clear, the error comes from the Integrate[] result for even values of d. Apparently Integrate[] changes its behavior now and then. :) $\endgroup$
    – Michael E2
    Commented May 26, 2023 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.