The evaluation with Maple suggests the triple integral is around $1$, but Mathematica tells
it's $0.0958758$. When using the code

N[Integrate[FractionalPart[x/y] FractionalPart[y/z] FractionalPart[z/x], {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]]

it returns:

"NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >> NIntegrate::eincr: The global error of the strategy GlobalAdaptive has increased more than 2000 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one of the following: the working precision is insufficient for the specified precision goal; the integrand is highly oscillatory or it is not a (piecewise) smooth function; or the true value of the integral is 0. Increasing the value of the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical integration. NIntegrate obtained 0.09587582633950331and 0.004696948831748114 for the integral and error estimates. >>"

I'd like to know if Mathematica's approximation is correct, and if there is a possible closed form.

  • $\begingroup$ @Nasser this is what I received from someone (I don't have Maple) - i.sstatic.net/NzS8u.png $\endgroup$ Jan 1, 2014 at 14:01
  • $\begingroup$ It's obvious that the integral is significantly smaller than $1$ therfore your Maple result is wrong if you've calculated it correctly. $\endgroup$
    – Artes
    Jan 1, 2014 at 14:17
  • $\begingroup$ @Artes that's true. I was very surprised with that result since, as you said, the integral is expected to be far smaller. $\endgroup$ Jan 1, 2014 at 14:24
  • $\begingroup$ I believe there is a closed form, but the calculation is too tedious... Basic idea would be integral over every continuity regions respectively, and calculate the infinite summation. $\endgroup$
    – Silvia
    Jan 2, 2014 at 11:34
  • $\begingroup$ @Silvia I know, but I wanted Mathematica confirms that. $\endgroup$ Jan 2, 2014 at 13:47

2 Answers 2


The analytic answer is $$ %\sum_{n=1}^\infty \frac{1}{2n(n+1)^2}\sum_{n=1}^\infty \frac{1+3n}{6n^2(n+1)^3}+\sum_{n=1}^\infty \frac{3n^2-1}{6n^2(n+1)^3}=\\ 1+\pi ^2\frac{2 \zeta (3)-9}{72} \approx 0.0958502 $$

Therefore, Mathematica is correct.


The 3D integral

NIntegrate[FractionalPart[x/y] FractionalPart[y/z] FractionalPart[z/x], 
   {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]


depends only on ratios between x, y, and z. Therefore, it can be reduced to the 2D integral

NIntegrate[FractionalPart[x/y] y FractionalPart[1/x], {x, 0, 1}, {y, 0, 1}]


It has the following structure

ArrayPlot@Table[FractionalPart[x/y] y FractionalPart[1/x], 
    {x, 0.001, 1, 0.001}, {y, 0.001, 1, 0.001}]

enter image description here

We can split the integral to two parts

NIntegrate[FractionalPart[x/y] y FractionalPart[1/x], {x, 0, 1}, {y, 0, x}]
NIntegrate[FractionalPart[x/y] y FractionalPart[1/x], {x, 0, 1}, {y, x, 1}]



After substitution $y/x = ξ$ the first one becomes

NIntegrate[x FractionalPart[1/x], {x, 0, 1}] NIntegrate[x^2 FractionalPart[1/x], {x, 0, 1}]


The second one is equivalent to

NIntegrate[x (1 - x) FractionalPart[1/x], {x, 0, 1}]


These integrals can be written as a sum of

Integrate[x (1/x - n), {x, 1/(n + 1), 1/n}] // Simplify
Integrate[x^2 (1/x - n), {x, 1/(n + 1), 1/n}] // Simplify
Integrate[x (1 - x) (1/x - n), {x, 1/(n + 1), 1/n}] // Simplify
1/(2 n (1 + n)^2)
(1 + 3 n)/(6 n^2 (1 + n)^3)
(-1 + 3 n^2)/(6 n^2 (1 + n)^3)
Sum[1/(2 n (1 + n)^2), {n, 1, ∞}]
Sum[(1 + 3 n)/(6 n^2 (1 + n)^3), {n, 1, ∞}]
Sum[(3 n^2 - 1)/(6 n^2 (1 + n)^3), {n, 1, ∞}]
1/2 (2 - π^2/6)
1/6 (3 - 2 Zeta[3])
1/12 (6 - π^2 + 4 Zeta[3])

Finally, we obtain

1/2 (2 - π^2/6) 1/6 (3 - 2 Zeta[3]) + 1/12 (6 - π^2 + 4 Zeta[3]) // Simplify
1 + 1/72 π^2 (-9 + 2 Zeta[3])
  • 1
    $\begingroup$ A very good job! Thanks! (+1) $\endgroup$ Jan 2, 2014 at 16:28

The Maple image you showed in your comment above was done in Maple 2D math (document mode). little hard to replicate it using classical interface (worksheet mode) which I use since one does not see the actual Maple commands that way.

The Maple commands you ave also might be using another package that was loaded before and not shown, such as Maple's Student. It is best that you post complete self contained Maple code to be able to compare.

But I have Maple 17, and not able to get the same result. Maple is not able to do this integral either.


Error, (in floor) too many levels of recursion

Mathematica graphics

There is one thing I noticed though, is that Maple has a rule to integrate floor function, and Mathematica does not do it: Maple's definition is same as M:

floor - greatest integer less than or equal to a number



    (*  floor(x)*x  *)

and in Mathematica, it remains unevaluated

Integrate[Floor[x], x]

Mathematica graphics

But do you want to see something bizarre? I gave Integrate a rule integrate floor(x/y) to x*floor(x/y), which is also how it is defined in Maple:

 (*  floor(x/y)*x *)

Unprotect Integrate and add the rule:

 (Unprotect[Integrate]; Integrate[Floor[x_/y_],x_] := x Floor[x/y];Protect[Integrate];)
 Integrate[x-Floor[x/y] , {x, 0, 1}]

and this is the result

Mathematica graphics

Where did the 99999999999999999999/(100000000000000000000 y) come from? This should be 1


Mathematica graphics

Very strange result. Here is Maple's result:

 (* -floor(1/y)+1/2 *)

So same final result, but M exact answer has this 99999999999999999999/(100000000000000000000 y) term which only becomes 1.0 with using N on it. This might be related to the WorkingPrecision messages you are seeing.

The bottom line is: Maple does not give 1 as you showed in your screen image.

  • $\begingroup$ Thanks for your useful post! (+1) Indeed, some things out there are pretty strange ... $\endgroup$ Jan 1, 2014 at 16:59
  • $\begingroup$ Nasser, I made a small spelling correction one minute after your last edit, figuring it would count as part of your edit. It didn't. Sorry, I wouldn't have used up an edit if I had known it would be charged. $\endgroup$
    – DavidC
    Jan 1, 2014 at 17:12
  • $\begingroup$ We also know the answer can't be 1 since the region of integration is contained in the unit cube. $\endgroup$
    – Greg Hurst
    Jan 1, 2014 at 23:25

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.