1
$\begingroup$

I want to reproduce the solution of the following integral, using Mathematica: $$\int_0^1duu(1-u)^2\frac{1}{(1-u)(1-v)}\left(\frac{1-u}{u}(1+\frac{1}{1-v})\theta(u-v)+\frac{1-v}{v}(1+\frac{1}{1-u})\theta(v-u)\right)\left(2u-1\right)^n$$ Basically this is a diagonalization of a kernel function in the interval $(0,1)$ with respect to the polynom $(2v-1)^n$ and weight $u(1-u)^2$. The variables $u$ and $v$ have to be in the $(0,1)$ interval. I know that the solution is this expression: $\frac{1}{2(n+1)(n+2)(n+3)}\sum_{m=0}^n \left((5+2n)(-1)^{n-m}+3+2m \right)\left( 2v-1\right)^m$.

I am writing this code in Mathematica, where I have split the integral into two parts because of the theta-function.

    I1 = Integrate[u*(1 - u)^2*(((1 - u)/u)*(1 + 1/(1 - v)))*
   ((2*u - 1)^n/((1 - u)*(1 - v))), {u, v, 1}, 
   Assumptions -> {n \[Element] Integers && n>0 && 0 < u < 1 && 0 < v < 1}]; 
  I2 = Integrate[u*(1 - u)^2*((1 - v)/v)*(1 + 1/(1 - u))*((2*u -  1)^n/((1 - u)*(1 - v))), 
  {u, 0, v}, Assumptions -> {n \[Element] Integers && n>0 && 0 < u < 1 && 0 < v < 1}]; 

but I am not getting the right solution. I tried to subtract the solution I get from the analytic one and I do not get zero. Am I doing something wrong in the "Assumptions"-part in the code? The n is Natural number. I would deeply appreciate any help or insight.

$\endgroup$
  • $\begingroup$ Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of your code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$ – rhermans Aug 21 '18 at 16:38
1
$\begingroup$
I1 = Integrate[
u*(1 - u)^2*(((1 - u)/u)*(1 + 1/(1 - v)))*((2*u - 1)^
n/((1 - u)*(1 - v))), {u, v, 1}, 
Assumptions -> {n \[Element] Integers && n > 0 && 0 < u < 1 && 0 < v < 1}];

I2 = Integrate[u*(1 - u)^2*((1 - v)/v)*(1 + 
1/(1 - u))*((2*u - 1)^n/((1 - u)*(1 - v))), {u, 0, v}, 
Assumptions -> {n \[Element] Integers && n > 0 && 0 < u < 1 && 0 < v < 1}];

ans1 = FullSimplify[I1 + I2][[1]]

$\frac{5 (-1)^n v^2+(4 v-5) (2 v-1)^{n+2}-10 (-1)^n v+2 n (v-1) \left((2 v-1)^{n+2}+(-1)^n (v-1)\right)+5 (-1)^n-v^2+2 v}{4 (n+1) (n+2) (n+3) (v-1)^2 v}$

In the above I used [[1]] after FullSimplify[I1 + I2] to extract the answer from the conditional expression.

While Integrate will sometimes give answers that include special functions that represent series (e.g., the polylogarithm function), it favors closed-form solutions, as seen above. Thus, to check equivalence, we need to convert your solution to closed form:

ans2 = 1/(2 (n + 1) (n + 2) (n + 3)) Sum[((5 + 2 n) (-1)^(n - m) + 3 + 2 m)*(2 v - 1)^m, {m, 0, n}] // FullSimplify

$\frac{5 (-1)^n v^2+(4 v-5) (2 v-1)^{n+2}-10 (-1)^n v+2 n (v-1) \left((2 v-1)^{n+2}+(-1)^n (v-1)\right)+5 (-1)^n-v^2+2 v}{4 (n+1) (n+2) (n+3) (v-1)^2 v}$

ans1===ans2

$True$

$\endgroup$
0
$\begingroup$

Using Boole you can integrate in one step and get the analytic result without warnings:

lsg = Integrate[(
u*(1 - u)^2)/((1 - u)*(1 -v))*(((1 - u)/u) (1 + 1/(1 - v)) Boole[u >= v] + ((1 - v)/v) (1 + 1/(1 - u)) Boole[u < v])*(2*u - 1)^n, {u, 0, 1}
, Assumptions -> {n \[Element] Integers && n > 0, 0 < v < 1}] //FullSimplify
(*(5 (-1)^n + 2 v - 10 (-1)^n v - v^2 + 5 (-1)^n v^2 + (-1 + 2 v)^(2 + n) (-5 + 4 v) +2 n (-1 + v) ((-1)^n (-1 + v) + (-1 + 2 v)^(2 + n)))/(4 (1 +n) (2 + n) (3 + n) (-1 + v)^2 v)*)

addendum

solution in terms of 2v-1 ? ->substitution/resubstitution evaluates to

Collect[lsg /. v -> (vn + 1)/2, vn^k_] /. vn -> 2 v - 1
(*(3/4 + (5 (-1)^n)/4 + 1/2 (-1)^n n + 1/2 (-1 + 2 v) - 
5/2 (-1)^n (-1 + 2 v) + (-1)^(1 + n) n (-1 + 2 v) - 
1/4 (-1 + 2 v)^2 + 5/4 (-1)^n (-1 + 2 v)^2 + 
1/2 (-1)^n n (-1 + 2 v)^2 - 3 (-1 + 2 v)^(2 + n) - 
n (-1 + 2 v)^(2 + n) + 2 (-1 + 2 v)^(3 + n) + 
n (-1 + 2 v)^(3 + n))/(4 (1 + n) (2 + n) (3 + n) (-1 + v)^2 v)*)
$\endgroup$
  • $\begingroup$ Thank you! Your code produced a neat answer. I do have another question: Is there a way in Mathematica to bring this answer in the same form as the analytic one, which includes series? Or am I asking too much? Eventually I will have to write this answer as a polynomial in (2v-1) and extract the coefficients. This is an eigenvalue problem that's why. $\endgroup$ – MZP_user Aug 22 '18 at 10:39
  • $\begingroup$ The result is an analytic answer (without series)! The Sum you gave as analytical expression evaluates to the result which MMA found. $\endgroup$ – Ulrich Neumann Aug 22 '18 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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