I had Mathematica Version 12.3.1 Student Edition and Integrate and RUBI's Int functions produced the same answers for my purposes with good results. I updated my version to 13.3.0 Student Edition and now Integrate is giving me incorrect results that give me imaginary and negative numbers in a system where these should not happen, while Int gives me the same results as before on 12.3.1.

Assuming[A > 0 && B > 0 && F > 0 && A - B x^2 > 0, Int[Sqrt[A - B x^2] - F x, x]]


-((F x^2)/2) + 1/2 x Sqrt[A - B x^2] + (A ArcTan[(Sqrt[B] x)/Sqrt[A - B x^2]])/(2 Sqrt[B])


Assuming[A > 0 && B > 0 && F > 0 && A - B x^2 > 0, Integrate[Sqrt[A - B x^2] - F x, x]]


-((F x^2)/2) + 1/2 x Sqrt[A - B x^2] + (A ArcTan[(Sqrt[B] x)/(-Sqrt[A] + Sqrt[A - B x^2])])/Sqrt[B]

with an extra -Sqrt[A] in the ArcTan. The differential of both expressions gives my original integrand but this extra term leads to nonsense results.

Am I doing something wrong? If not is this fixed in 13.3.1?

Edit below

I am trying to evaluate the areas of binary quadratic forms for positive x and y up to some large value X. This equation represents the curve as a function of y taking the positive square root. Taking the indefinite integral with Integrate or Int then sending x to my upper and lower points worked fine in version 12.3.1. With the same code I get something different for Integrate in 13.3.0 which is not useful to me. I have an example with dummy values which make sense geometrically for the area I want:

(Int[Sqrt[A - B x^2] - F x, x] /. x -> X) -
 (Int[Sqrt[A - B x^2] - F x, x] /. x -> 0)


-((F X^2)/2) + 1/2 X Sqrt[A - B X^2] + (
 A ArcTan[(Sqrt[B] X)/Sqrt[A - B X^2]])/(2 Sqrt[B])

which for A=42.0641, B=0.408163, F=0.142857 gives 44.4691 which is correct from looking at the graph on Desmos. For Integrate I get

 A > 0 && B > 0 && F > 0 && Sqrt[A/B] < X && X >= 1, 
 Integrate[Sqrt[A - B x^2] -F x, {x, 0, X}]]

which gives

 1/2 (-F X^2 + (
   A \[Pi] + I X Sqrt[B (-A + B X^2)] - 
    2 I A ArcTanh[(Sqrt[B] X)/(I Sqrt[A] + Sqrt[-A + B X^2])])/Sqrt[B]

and with the same values for A, B and F equals 31.0683 + 37.6883 I which is clearly wrong as I want an area of a shape.

I know that indefinite integrals have an arbitrary constant and my function is a well behaved conic section so will not have discontinuities. So my question is, is there a way to make Mathematica give me the "correct" arbitrary constant as it did in the prior version and RUBI still does?

  • 3
    $\begingroup$ Rubi does not use assumptions. $\endgroup$
    – Nasser
    Nov 9, 2023 at 15:32
  • 5
    $\begingroup$ All what you need to do is differentiate the anti derivative and if it gives back the integrand, then the result is correct. (you might have to Simplify the result to get True). Both Rubi's and Mathematica result are correct based on this test. I am using V 13.3.1 screen shot !Mathematica graphics $\endgroup$
    – Nasser
    Nov 9, 2023 at 15:37
  • 6
    $\begingroup$ I don't know how you use this, but since you mention "nonsense results", I am suspecting you might be trying to incorrectly calculate the definite integral from the indefinite by the fundamental law of calculus. This can lead to wrong results, as explaind in this blog post. $\endgroup$
    – Domen
    Nov 9, 2023 at 15:45
  • 7
    $\begingroup$ This same mistake pops up all the time: an indefinite integral is only defied up to a constant. If you take the derivatives, the constant gives zero. $\endgroup$ Nov 9, 2023 at 16:01


Your Answer

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