13
$\begingroup$

Many integrals fail to verify their results in V 13.3 compared to V 13.2.1.

So I am asking for help to determine why. It is possible that my function which verifies the antiderivative is not doing a good job and that the result is correct or may be something changed in V 13.3 Integrate to cause this? Or could this possibly be a bug?

Is there a workaround to make V 13.3. verify the result? Feel free to change the code below as needed which does the verification check.

This is just small sample of 5 integrals. First screen shot of the notebook. You see in V 13.3 all 5 integrals failed to verify and same 5 integrals passed the check.

enter image description here

Here is the source code:

(*basic function to verify result of Mathematica Integrate command*)
(*possible it can give false negative*)
(*version July 5, 2023*)

verify[anti_,integrand_,x_]:=Module[{tmp},
If[PossibleZeroQ[RootReduce[Cancel[Together[D[anti,x]-integrand]]]],Return[True,Module]];

tmp=D[anti,x]-integrand;
If[FreeQ[Simplify[tmp],x],Return[True,Module]];

tmp=D[Simplify[anti],x]-integrand;
If[FreeQ[Simplify[tmp],x],Return[True,Module]];

tmp=Simplify[D[anti,x]]-integrand;
If[FreeQ[Simplify[tmp],x],Return[True,Module]];

tmp=Assuming[Element[x,Reals],Simplify[D[anti,x]]-integrand];
If[FreeQ[Simplify[tmp],x],Return[True,Module]];

tmp=Assuming[x>0,Simplify[D[anti,x]]-integrand];
If[FreeQ[Simplify[tmp],x],Return[True,Module]];

tmp=Assuming[x<0,Simplify[D[anti,x]]-integrand];
If[FreeQ[Simplify[tmp],x],Return[True,Module]];

tmp=FullSimplify[D[anti,x]]-integrand;
If[FreeQ[Simplify[tmp],x],Return[True,Module]];

False
];

lst = {Sqrt[1 + x]/(1 - x)^(3/2), (1 + a*x)^(3/2)/
    Sqrt[1 - a*x], (1 - x)^(7/2)/Sqrt[1 + x], (1 - x)^(5/2)/
    Sqrt[1 + x], (1 - x)^(3/2)/Sqrt[1 + x]};
(verify[Integrate[#, x], #, x] &) /@ lst
$\endgroup$

2 Answers 2

7
$\begingroup$

If you "FullSimplify" your result for "tmp", everything works:

verify[anti_, integrand_, x_] := 
  Module[{tmp}, 
   If[PossibleZeroQ[
     RootReduce[Cancel[Together[D[anti, x] - integrand]]]], 
    Return[True, Module]];
   tmp = D[anti, x] - integrand // FullSimplify;
   If[FreeQ[Simplify[tmp], x], Return[True, Module]];
   tmp = D[Simplify[anti], x] - integrand;
   If[FreeQ[Simplify[tmp], x], Return[True, Module]];
   tmp = Simplify[D[anti, x]] - integrand;
   If[FreeQ[Simplify[tmp], x], Return[True, Module]];
   tmp = Assuming[Element[x, Reals], Simplify[D[anti, x]] - integrand];
   If[FreeQ[Simplify[tmp], x], Return[True, Module]];
   tmp = Assuming[x > 0, Simplify[D[anti, x]] - integrand];
   If[FreeQ[Simplify[tmp], x], Return[True, Module]];
   tmp = Assuming[x < 0, Simplify[D[anti, x]] - integrand];
   If[FreeQ[Simplify[tmp], x], Return[True, Module]];
   tmp = FullSimplify[D[anti, x]] - integrand;
   If[FreeQ[Simplify[tmp], x], Return[True, Module]];
   False];

lst = {Sqrt[1 + x]/(1 - x)^(3/2), (1 + a*x)^(3/2)/
    Sqrt[1 - a*x], (1 - x)^(7/2)/Sqrt[1 + x], (1 - x)^(5/2)/
    Sqrt[1 + x], (1 - x)^(3/2)/Sqrt[1 + x]};
(verify[Integrate[#, x], #, x] &) /@ lst

{True, True, True, True, True}
$\endgroup$
5
  • $\begingroup$ Thanks. That fixed my verification. It is very hard to get all possible cases for verifications. I overlooked this case you found. I am sure in the future something else like this could show up again. $\endgroup$
    – Nasser
    Commented Jul 6, 2023 at 8:34
  • $\begingroup$ It may have to do with the fact that it is impossible to verify in any case if two expressions are equal. $\endgroup$ Commented Jul 6, 2023 at 8:44
  • $\begingroup$ Yes I know that. This is well known zero equivalence problem in CAS. One can get close by covering all possible cases as I was trying to do, but there will always be chance it can give false negative in some rare cases. $\endgroup$
    – Nasser
    Commented Jul 6, 2023 at 9:02
  • 4
    $\begingroup$ @Nasser I don't have any knowledge in this field, correct me if I'm wrong, Aren't you implementing AssessmentFunction[expr1, "CalculusResult"][expr2]["AnswerCorrect"] introduced in 13.3? $\endgroup$
    – Ben Izd
    Commented Jul 6, 2023 at 12:48
  • $\begingroup$ @BenIzd I do not know anything about this function you mentioned it I am afraid. If you could give examples showing how to use it for what I have above, that will help. If it works, may be you can even add it as answer? My goal is to verify the antiderivative is correct given the integrand. If this command can do better job at it than what I have, I will use it ofcourse. But I never saw this command before. Thanks. $\endgroup$
    – Nasser
    Commented Jul 6, 2023 at 21:36
11
$\begingroup$
$Version

(* "13.3.0 for Mac OS X ARM (64-bit) (June 3, 2023)" *)

Clear["Global`*"]

Using Ben Izd's recommendation to use (EXPERIMENTAL) AssessmentFunction introduced in version 12.2

verifyIntegrate[integrand_, var_Symbol : x] := Module[
  {int = Integrate[integrand, var]},
  AssessmentFunction[integrand, "CalculusResult"][D[int, var]][
   "AnswerCorrect"]]

lst = {Sqrt[1 + x]/(1 - x)^(3/2), (1 + a*x)^(3/2)/
    Sqrt[1 - a*x], (1 - x)^(7/2)/Sqrt[1 + x], (1 - x)^(5/2)/
    Sqrt[1 + x], (1 - x)^(3/2)/Sqrt[1 + x]};

verifyIntegrate /@ lst

(* {True, True, True, True, True} *)
$\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.