5
$\begingroup$

Upon evaluating the integral

Integrate[Exp[-x^(2 n)] x^(2 k), {x, -\[Infinity], \[Infinity]}, 
    Assumptions -> {n > 0, k > 0, (n | k) \[Element] Integers}]

I get the result ($Version="11.1.0 for Mac OS X x86 (64-bit) (March 16, 2017)")

ConditionalExpression[
    (((-1)^(2 n))^(-((1 + 2 k)/(2 n))) ((-1)^(2 k) + ((-1)^(2 n))^((1 + 2 k)/(2 n))) 
    Gamma[(1 + 2 k)/(2 n)])/(2 n), 
    C[1] \[Element] Integers && 
    n < 1/4 + C[1] && C[1] >= 1 && C[1] < 1/4 + n]

My question is: what is C[1] doing there? It's a definite integral, so there should be no constant of integration. Moreover, it doesn't show up in the "value" part of the ConditionalExpression. Putting the inequalities with n together just gives n < 1/2 + n, which is always true, so I think the only thing that it enforces is that (saturating the bound on C[1]), 1 ≤ 1/4 + n so that n must be at least 1 (if it's going to be an integer). But I already told Mma that it's a positive integer, so in the end those conditionals should all be satisfied. So: what's the point of C[1] in this result?

As an added (but not super-important) follow-up, if I tell Mma that n and k are integers, why doesn't it simplify (-1)^(2 k) or the other squares of -1?

$\endgroup$
  • $\begingroup$ the C[1] is not an integration constant, it is part of the conditional on n $\endgroup$ – george2079 May 30 '17 at 17:12
  • $\begingroup$ Why is there an arbitrary constant introduced in order to formulate a conditional on n that's redundant with what I already specified? $\endgroup$ – evanb May 30 '17 at 17:15
  • $\begingroup$ IDK. It is redundant, it says n must be +/- 1/4 of an integer >=1 , ie true for all integers > 0. FWIW v10.1 just gives the (unsimplified) expression, not conditional. $\endgroup$ – george2079 May 30 '17 at 17:29
  • $\begingroup$ So, what's the point of C[1] in the result? Also it doesn't say n must be ±1/4 of an integer, since C[1] need not be an integer. $\endgroup$ – evanb May 30 '17 at 18:41
  • $\begingroup$ If it's changed since v10.1, that's also a mystery! $\endgroup$ – evanb May 30 '17 at 18:42
7
$\begingroup$

In:

Assuming[{n > 0 && k > 0 && {n, k} \[Element] Integers}, 
 Integrate[Exp[-x^(2 n)] x^(2 k), {x, -\[Infinity], \[Infinity]}]]

Out:

Mathematica graphics

If anyone is interested in it, you can check the implemention.

Needs["GeneralUtilities`"]
PrintDefinitions[Integrate]
PrintDefinitions[Assuming]
$\endgroup$
  • $\begingroup$ I get the same result, using Assuming rather than Assumptions->. Why the difference? $\endgroup$ – evanb May 30 '17 at 17:16
  • $\begingroup$ Assuming seems to apply an extra simplify step. $\endgroup$ – george2079 May 30 '17 at 17:25
  • $\begingroup$ I alway prefer Assuming. I guess Assumptions failed me many times. Integrate always ask Assumptions to shut it up. i.stack.imgur.com/22OdB.png $\endgroup$ – UnchartedWorks May 30 '17 at 17:48
  • 2
    $\begingroup$ What Integrate does with Assumptions is, in my opinion, far the safer handling in general. $\endgroup$ – Daniel Lichtblau May 30 '17 at 18:31
4
$\begingroup$

I believe the C[1] comes from this:

Reduce[k > 0 && n > 0 && Re[(-1)^(1 + 2 n)] < 0, Complexes]
Simplify[%, (k | n) ∈ Integers && k >= 1 && n >= 1]
(*
  C[1] ∈ Integers && 
    k > 0 && (0 < n < 1/4 || (C[1] >= 1 && 1/4 (-1 + 4 C[1]) < n < 1/4 (1 + 4 C[1])))
  C[1] ∈ Integers && C[1] >= 1 && C[1] < 1/4 + n && n < 1/4 + C[1]
*)

One can get the Reduce commands used in Integrate[] with this:

Trace[
 Integrate[Exp[-x^(2 n)] x^(2 k), {x, -∞, ∞}, 
  Assumptions -> {n > 0, k > 0, (n | k) ∈ Integers}],
 _Reduce,
 TraceInternal -> True]

It's hard to say exactly what Reduce is being used for beyond the easy guess that it has something to do with convergence.

The follow-up question about simplifying (-1)^(2 k) is a key to another workaround:

Integrate[Exp[-x^(2 n)] x^(2 k), {x, -∞, ∞}, 
 Assumptions -> {n > 0, k > 0, (n | k) ∈ Integers, (-1)^(2 k) == 1, (-1)^(2 n) == 1}]
(*  Gamma[(1 + 2 k)/(2 n)]/(2 n)  *)

And Mathematica can simplify (-1)^(2k):

Simplify[{(1)^(2 k), (-1)^(1 + 2 k)}, k ∈ Integers]
(*  {1, -1}  *)

Simplify uses the assumptions from $Assumptions, which are added to by Assuming; it is probably why @UnchartedWorks's workaround works, and perhaps why @Daniel warns against it.

Some related Q&A:

Usage of Assuming for Integration

Solution to a specific problem caused by generic simplification

Simplify is excluding indeterminate expression from output

What is a "generic case"?

$\endgroup$

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.