2
$\begingroup$

Bug introduced in 13.1, and fixed in 13.2.


I'm trying the following locally (13.1.0 for Mac) and getting incorrect result

Quit[];
Integrate[1/(x + 1)^2 Exp[-t 1/(x + 1)^2], {x, 0, \[Infinity]}] /. 
 t -> 3.  (* 0.0575796 *)

This answer is wrong. I get the correct answer 0.504344 when running same expression on Wolfram Cloud (13.2.0).

Is this a bug in 13.1, corrupted local state, or something else?

Because of this, I can't rerun the notebook from this post anymore, any workarounds appreciated.

$\endgroup$
11
  • 1
    $\begingroup$ v11.3 and v13.2.1 get 0.504344, and v13.1 get 0.0575796. $\endgroup$
    – cvgmt
    Commented Mar 2, 2023 at 0:18
  • $\begingroup$ In 13.2.1 (Windows) I get 1/2 Sqrt[\[Pi]/3] Erf[Sqrt[3]] which evaluates to 0.504344. $\endgroup$
    – ulvi
    Commented Mar 2, 2023 at 0:54
  • 1
    $\begingroup$ The tag numerical-integration suggests you should be using NIntegrate instead of Integrate....Perhaps this should be tagged [tag[calculus-and-analysis]? And if so, perhaps the question should be about the general result, not the numerical value at the floating-point number 3.? $\endgroup$
    – Michael E2
    Commented Mar 2, 2023 at 1:51
  • $\begingroup$ Why 3. ??? That is float, and will switch to NIntegrate and not produce nice symbolic answer. @MichaelE2 NIntegrate outright gives a warning. 13.2.1 is all good. Fixed bug. $\endgroup$ Commented Mar 2, 2023 at 2:04
  • 1
    $\begingroup$ The symbolic result of Integrate is incorrect, 3. is there to show how far off it is $\endgroup$ Commented Mar 2, 2023 at 2:32

2 Answers 2

6
$\begingroup$
$Version

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)

Clear["Global`*"]

g[x_] = 1/(x + 1)^2;

The incorrect result is

Integrate[1/(x + 1)^2 Exp[-t 1/(x + 1)^2], {x, 0, ∞}]

(* E^(2 - t)/(-1 + E^2) *)

To get the correct result, do a change of variables

IntegrateChangeVariables[
  Inactive[Integrate][1/(x + 1)^2 Exp[-t 1/(x + 1)^2], {x, 0, ∞}], 
  u, u == x + 1]

enter image description here

% // Activate

(* (Sqrt[π] Erf[Sqrt[t]])/(2 Sqrt[t]) *)

Compare with,

WolframAlpha["Integrate[1/(x+1)^2 Exp[-t 1/(x+1)^2], {x, 0, ∞}]", \
{{"Input", 1}, "Content"}]

enter image description here

$\endgroup$
2
  • $\begingroup$ It is simpler to just update to 13.2.1. $\endgroup$ Commented Mar 2, 2023 at 3:32
  • 2
    $\begingroup$ @ВалерийЗаподовников while this is one way to think about the situation, finding work-arounds is good practice. Also, Bob gave a nice and very simple answer, so this comment is largely immaterial $\endgroup$
    – bmf
    Commented Mar 2, 2023 at 4:29
3
$\begingroup$

Another way of doing the integral.

g[x_] = 1/(x + 1)^2;

Integrate`InverseIntegrate[
  1/(x + 1)^2 Exp[-t 1/(x + 1)^2], {x, 0, ∞}] /. t -> 3.

0.504344

which means that the above gives the correct symbolic result

Integrate`InverseIntegrate[
 1/(x + 1)^2 Exp[-t 1/(x + 1)^2], {x, 0, ∞}]

int

$\endgroup$

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.