# How to simplify the result of this indefinite integral

There is an indefinite integral:

$$\int \frac{x}{\sqrt{x^4+10 x^2-96 x-71}} \, dx$$

Mathematica 13 can handle it and evaluate this integral analytically if we enter:

Integrate[x/Sqrt[x^4 + 10*x^2 - 96*x - 71], x] // ToRadicals

But the result is too large and I don't know how to simplify it (I tried Simplify and FullSimplify, but didn't help).

In Maple 2021 it's much easier. You just need to write:

simplify(int(x/sqrt(x^4 + 10*x^2 - 96*x - 71), x, method = Trager))

and you will get:

$$\frac{1}{8}\ln \! \left(\left(x^{6}+15 x^{4}-80 x^{3}+27 x^{2}-528 x +781\right) \sqrt{x^{4}+10 x^{2}-96 x -71}+x^{8}+20 x^{6}-128 x^{5}+54 x^{4}-1408 x^{3}+3124 x^{2}+10001\right)$$

• You are not showing the large result, but from the description I would think you are using version 12 rather than 13 for this integral. Commented Apr 19, 2022 at 17:47
• @DanielLichtblau, Screenshot
– user86117
Commented Apr 19, 2022 at 17:56
• @DanielLichtblau, $Version "13.0.0 for Microsoft Windows (64-bit) (December 3, 2021)" – user86117 Commented Apr 19, 2022 at 17:56 • That's definitely a version 12 and prior type of result. If you have 13 try this: SetSystemOptions[ "IntegrateOptions" -> {"IntegrateAlgebraicTimeConstraint" -> 100}] and see if that improves things. Commented Apr 19, 2022 at 17:58 • @DanielLichtblau, yes, now it is working! thanks ![](i.postimg.cc/j2MTVC39/S.png) – user86117 Commented Apr 19, 2022 at 18:06 ## 4 Answers There is code for handling indefinte algebraic integrals that is new to version 13. It is based on code IntegrateAlgebraic in the Wolfram Function Repository and was written by the same person (Sam Blake). We use a time constraint to keep it from grinding its gears and in some cases this might be too small to get a result. In particular there will be examploes, such as from this post, where some processors will complete the computation in this code but others will not. As a workaround when encountering this issue, this time constraint is configurable as a system option. In[669]:= "IntegrateOptions" /. SystemOptions[] Out[669]= {"IntegrateAlgebraicTimeConstraint" -> 10, "RubiTimeConstraint" -> 5, "UseIntegrateAlgebraic" -> True, "UseRubiIntegrate" -> True}  If you want to increase the value above 10 you might do for example: SetSystemOptions[ "IntegrateOptions" -> {"IntegrateAlgebraicTimeConstraint" -> 100}];  • "Some CPUs" not quite: in fact you need 20 seconds to integrate this another Chebyshev-Zolotarev integral in elementary functions: Integrate[x/Sqrt[x^4-2x^3+3x^2+4x+1], x] Commented Jun 3, 2022 at 14:49 $Version

(* "13.0.1 for Mac OS X x86 (64-bit) (January 28, 2022)" *)

Clear["Global*"]

int = Integrate[x/Sqrt[x^4 + 10*x^2 - 96*x - 71], x]

(* -(1/8) Log[-10001 - 3124 x^2 + 1408 x^3 - 54 x^4 + 128 x^5 - 20 x^6 - x^8 +
Sqrt[-71 - 96 x + 10 x^2 +
x^4] (781 - 528 x + 27 x^2 - 80 x^3 + 15 x^4 + x^6)] *)

intR = Integrate[x/Sqrt[x^4 + 10*x^2 - 96*x - 71], x,
Assumptions -> x ∈ Reals];


The results are identical with or without the Assumptions

int === intR

(* True *)


The result that you report from Maple

intMaple = 1/8*
Log[(x^6 + 15 x^4 - 80 x^3 + 27 x^2 - 528 x + 781)*
Sqrt[x^4 + 10 x^2 - 96 x - 71] +
x^8 + 20 x^6 - 128 x^5 + 54 x^4 - 1408 x^3 + 3124 x^2 + 10001];


There is little difference in their complexity

LeafCount /@ {int, intMaple}

(* {78, 76} *)


They are equivalent anti-derivatives

D[int, x] == D[intMaple, x] // Simplify

(* True *)


Since you are taking the indefinite integral (anti-derivative), results are equivalent if they differ by only a constant (which can be complex).

The two results differ by a piecewise complex constant

ReImPlot[int - intMaple, {x, -10, 10},
PlotLegends -> Placed["ReIm", {.8, .4}]]


int - intMaple /. x -> 5/2 // FullSimplify

(* (I π)/8 + Log[1/(4 3^(7/8))] *)

% // N

(* -2.34758 + 0.392699 I *)

int - intMaple /. x -> 5 // FullSimplify

(* -((I π)/8) + Log[1/(4 3^(7/8))] *)

% // N

(* -2.34758 - 0.392699 I *)

• Screenshot.png
– user86117
Commented Apr 19, 2022 at 17:14
• With v13.0.0 for Mac OS X x86 (64-bit) (December 3, 2021) I get the same results as shown for v13.0.1. Have you tried starting with a fresh kernel or restarting Mathematica. Commented Apr 19, 2022 at 17:18
• Yes, I've tried everything, it doesn't help.
– user86117
Commented Apr 19, 2022 at 17:20
• Try using RootReduce on your result. FullSimplify may time out before getting to RootReduce Commented Apr 19, 2022 at 17:23
• Perhaps, Mathematica for Mac OS is better than Mathematica for Windows
– user86117
Commented Apr 19, 2022 at 17:24

Your result is only correct for a real variable.

In MMA variables are assumed to be complex. If you want to restrict the variable to be real, you need to specify this, like:

Integrate[x/Sqrt[x^4 + 10*x^2 - 96*x - 71], x,
Assumptions -> x \[Element] Reals]


• It doesn't help, I get the same large output
– user86117
Commented Apr 19, 2022 at 16:12
• You will see a spot on the Sun, executing Plot[{Im[x/Sqrt[x^4 + 10*x^2 - 96*x - 71]], Im[1/8 Log[-10001 - 3124 x^2 + 1408 x^3 - 54 x^4 + 128 x^5 - 20 x^6 - x^8 + Sqrt[-71 - 96 x + 10 x^2 + x^4] *(781 - 528 x + 27 x^2 - 80 x^3 + 15 x^4 + x^6)]]}, {x, -1/2, 4}]. Commented Apr 19, 2022 at 16:16
• @Daniel Huber, I don't get the same result as in your image if I enter Integrate[x/Sqrt[x^4 + 10*x^2 - 96*x - 71], x, Assumptions -> x \[Element] Reals]. Did you just copy-paste the Maple's answer and take a screenshot?
– user86117
Commented Apr 19, 2022 at 16:26
• This is the output I get from MMA version 13.0.1. Could it be a version problem? Commented Apr 19, 2022 at 16:46
• For whatever it's worth, I get the same long result for "12.3.1 for Microsoft Windows (64-bit) (June 24, 2021)" even with Assumptions -> x \[Element] Reals` but the nicer short version for 13.0.1.0. So it sounds like it's time to upgrade.
– JimB
Commented Apr 19, 2022 at 18:07

Below is the solution I obtained.