5
$\begingroup$

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)$

$\endgroup$
6
  • $\begingroup$ 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. $\endgroup$ Apr 19 at 17:47
  • $\begingroup$ @DanielLichtblau, Screenshot $\endgroup$
    – EuropeX
    Apr 19 at 17:56
  • $\begingroup$ @DanielLichtblau, $Version "13.0.0 for Microsoft Windows (64-bit) (December 3, 2021)" $\endgroup$
    – EuropeX
    Apr 19 at 17:56
  • 1
    $\begingroup$ 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. $\endgroup$ Apr 19 at 17:58
  • $\begingroup$ @DanielLichtblau, yes, now it is working! thanks ![](i.postimg.cc/j2MTVC39/S.png) $\endgroup$
    – EuropeX
    Apr 19 at 18:06

4 Answers 4

12
$\begingroup$

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}];
$\endgroup$
1
  • $\begingroup$ "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] $\endgroup$ Jun 3 at 14:49
6
$\begingroup$
$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}]]

enter image description here

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 *)
$\endgroup$
7
  • $\begingroup$ Screenshot.png $\endgroup$
    – EuropeX
    Apr 19 at 17:14
  • $\begingroup$ 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. $\endgroup$
    – Bob Hanlon
    Apr 19 at 17:18
  • $\begingroup$ Yes, I've tried everything, it doesn't help. $\endgroup$
    – EuropeX
    Apr 19 at 17:20
  • $\begingroup$ Try using RootReduce on your result. FullSimplify may time out before getting to RootReduce $\endgroup$
    – Bob Hanlon
    Apr 19 at 17:23
  • $\begingroup$ Perhaps, Mathematica for Mac OS is better than Mathematica for Windows $\endgroup$
    – EuropeX
    Apr 19 at 17:24
0
$\begingroup$

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]

enter image description here

$\endgroup$
7
  • 1
    $\begingroup$ It doesn't help, I get the same large output $\endgroup$
    – EuropeX
    Apr 19 at 16:12
  • $\begingroup$ 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}]. $\endgroup$
    – user64494
    Apr 19 at 16:16
  • $\begingroup$ @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? $\endgroup$
    – EuropeX
    Apr 19 at 16:26
  • $\begingroup$ This is the output I get from MMA version 13.0.1. Could it be a version problem? $\endgroup$ Apr 19 at 16:46
  • 1
    $\begingroup$ 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. $\endgroup$
    – JimB
    Apr 19 at 18:07
-1
$\begingroup$

Below is the solution I obtained.

enter image description here

$\endgroup$
2
  • $\begingroup$ Please look at the other answers to see how to improve your answer. Use code as much as possible, using pictures only when these add value. $\endgroup$
    – Syed
    Apr 19 at 18:14
  • $\begingroup$ This is precisly what we were trying to avoid, i.e. non elementary antiderivative. $\endgroup$ Jun 3 at 14:46

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.