# Different outputs for Simplify

In at least one instance, the same Simplify command (without using options) produces very different results on two of my computers, one Windows 7 and the other Windows 10. Here is the code:

sf = Simplify;

r1 = (-1 + (-11 - a^2 + 2 a^4) b^2 + (8 - 3 a^2) b^3 + (-2 + a^2) b^4 -
b (-6 - 3 a^2 + a Sqrt[b (2 + (-2 + a^2) b)] +
2 a^3 Sqrt[b (2 + (-2 + a^2) b)]) -
a (Sqrt[b (2 + (-2 + a^2) b)] - 3 Sqrt[b^5 (2 + (-2 + a^2) b)] + Sqrt[
b^7 (2 + (-2 + a^2) b)]))/(-1 + b - a^2 b +
a Sqrt[b (2 + (-2 + a^2) b)])^2;


This is what I got on one of the computers, the Windows 10 one:

Dr1 = D[r1, b] // sf

(* (6 + 3 a^2 + 2 (-11 - a^2 + 2 a^4) b + 3 (8 - 3 a^2) b^2 +
4 (-2 + a^2) b^3 - (a (1 + (-2 + a^2) b))/Sqrt[b (2 + (-2 + a^2) b)] - (
a b (1 + (-2 + a^2) b))/Sqrt[b (2 + (-2 + a^2) b)] - (
2 a^3 b (1 + (-2 + a^2) b))/Sqrt[b (2 + (-2 + a^2) b)] -
a Sqrt[b (2 + (-2 + a^2) b)] - 2 a^3 Sqrt[b (2 + (-2 + a^2) b)] + (
a b^6 (-7 - 4 (-2 + a^2) b))/Sqrt[b^7 (2 + (-2 + a^2) b)] + (
3 a b^4 (5 + 3 (-2 + a^2) b))/Sqrt[b^5 (2 + (-2 + a^2) b)])/(-1 + b -
a^2 b + a Sqrt[
b (2 + (-2 + a^2) b)])^2 - (2 (1 - a^2 + (a - 2 a b + a^3 b)/Sqrt[
b (2 + (-2 + a^2) b)]) (-1 + (-11 - a^2 + 2 a^4) b^2 + (8 -
3 a^2) b^3 + (-2 + a^2) b^4 -
b (-6 - 3 a^2 + a Sqrt[b (2 + (-2 + a^2) b)] +
2 a^3 Sqrt[b (2 + (-2 + a^2) b)]) -
a (Sqrt[b (2 + (-2 + a^2) b)] - 3 Sqrt[b^5 (2 + (-2 + a^2) b)] + Sqrt[
b^7 (2 + (-2 + a^2) b)])))/(-1 + b - a^2 b +
a Sqrt[b (2 + (-2 + a^2) b)])^3 *)


And this, much better expression is what I got on the other computer, the Windows 7 one:

D[r1, b] // sf

(* (2 (-1 + b)^2 b (4 (-2 + 9 a^2 - 8 a^4 + 2 a^6) b^4 -
3 a Sqrt[b (2 + (-2 + a^2) b)] -
b (-8 - 11 a^2 + 10 a Sqrt[b (2 + (-2 + a^2) b)] +
10 a^3 Sqrt[b (2 + (-2 + a^2) b)]) -
b^2 (24 - 14 a^2 - 14 a^4 - 29 a Sqrt[b (2 + (-2 + a^2) b)] +
14 a^3 Sqrt[b (2 + (-2 + a^2) b)] +
4 a^5 Sqrt[b (2 + (-2 + a^2) b)]) -
b^3 (-24 + 61 a^2 - 18 a^4 - 4 a^6 + 16 a Sqrt[b (2 + (-2 + a^2) b)] -
24 a^3 Sqrt[b (2 + (-2 + a^2) b)] +
8 a^5 Sqrt[b (2 + (-2 + a^2) b)])))/(Sqrt[
b (2 + (-2 + a^2) b)] (-a b + Sqrt[b (2 + (-2 + a^2) b)])^3 (-1 + b -
a^2 b + a Sqrt[b (2 + (-2 + a^2) b)])^2) *)


Can I find the reason for this and make it the same on both computers? If so, how to do this? I may have changed global preferences for Simplify on the Windows 7 computer, but don't remember if or how or what I did concerning that. This behavior occurs both in Mathematica 11.2 and Mathematica 11.1.1.

• Simplify is time constrained. Consequently, you get the best result that is found within that time. Since different machines provide different performance, you can get different results. You can use the option TimeConstraint to go beyond the default: Options[Simplify, TimeConstraint] Feb 8 '18 at 17:20
• @BobHanlon : Thank you for your comment. I have now tried it with TimeConstraint -> [Infinity] on the Windows 10 computer, but the result is the same bad expression. Feb 8 '18 at 18:42
• I get your results on a Mac that are identical to your Windows10 results. Does $Assumptions for either system contain any assumptions on a or b? Feb 8 '18 at 22:04 • @BobHanlon : Thank you for checking it on your Mac and making the comment. On my Windows 7 machine, I used $Assumptions = (a > 0 && 0 < b < 1). When I use the same $Assumptions on the Windows 10 computer, the output changes just a bit, but it is just as bad and unusable as without the $Assumptions. Feb 9 '18 at 1:13

To get a better form, use FullSimplify

\$Assumptions = a > 0 && 0 < b < 1;

r1 = (-1 + (-11 - a^2 + 2 a^4) b^2 + (8 - 3 a^2) b^3 + (-2 + a^2) b^4 -
b (-6 - 3 a^2 + a Sqrt[b (2 + (-2 + a^2) b)] +
2 a^3 Sqrt[b (2 + (-2 + a^2) b)]) -
a (Sqrt[b (2 + (-2 + a^2) b)] - 3 Sqrt[b^5 (2 + (-2 + a^2) b)] +
Sqrt[b^7 (2 + (-2 + a^2) b)]))/(-1 + b - a^2 b +
a Sqrt[b (2 + (-2 + a^2) b)])^2;

Dr1 = D[r1, b] // FullSimplify

(* ((-1 + b)^2 (2 a^5 b^2 (1 + 2 b) + 3 a (-1 + b)^2 (1 + 4 b) +
2 a^3 b (3 + (4 - 7 b) b) -
2 a^2 (2 Sqrt[b (2 + (-2 + a^2) b)] + 3 Sqrt[b^3 (2 + (-2 + a^2) b)] -
5 Sqrt[b^5 (2 + (-2 + a^2) b)]) -
4 (Sqrt[b (2 + (-2 + a^2) b)] - 2 Sqrt[b^3 (2 + (-2 + a^2) b)] + Sqrt[
b^5 (2 + (-2 + a^2) b)]) -
2 a^4 (Sqrt[b^3 (2 + (-2 + a^2) b)] +
2 Sqrt[b^5 (2 + (-2 + a^2) b)])))/(Sqrt[
b (2 + (-2 + a^2) b)] (-1 + b - a^2 b + a Sqrt[b (2 + (-2 + a^2) b)])^3) *)

Dr1 // LeafCount

(* 248 *)


Whereas the LeafCount for your Windows 7 result with Simplify is 317

(2 (-1 + b)^2 b (4 (-2 + 9 a^2 - 8 a^4 + 2 a^6) b^4 -
3 a Sqrt[b (2 + (-2 + a^2) b)] -
b (-8 - 11 a^2 + 10 a Sqrt[b (2 + (-2 + a^2) b)] +
10 a^3 Sqrt[b (2 + (-2 + a^2) b)]) -
b^2 (24 - 14 a^2 - 14 a^4 - 29 a Sqrt[b (2 + (-2 + a^2) b)] +
14 a^3 Sqrt[b (2 + (-2 + a^2) b)] +
4 a^5 Sqrt[b (2 + (-2 + a^2) b)]) -
b^3 (-24 + 61 a^2 - 18 a^4 - 4 a^6 + 16 a Sqrt[b (2 + (-2 + a^2) b)] -
24 a^3 Sqrt[b (2 + (-2 + a^2) b)] +
8 a^5 Sqrt[b (2 + (-2 + a^2) b)])))/(Sqrt[
b (2 + (-2 + a^2) b)] (-a b + Sqrt[b (2 + (-2 + a^2) b)])^3 (-1 + b -
a^2 b + a Sqrt[b (2 + (-2 + a^2) b)])^2) // LeafCount

(* 317 *)

• Thank you. I get about the same LeafCount (251) by first (manually) collecting the Sqrt terms in the expression for r1 and then using the simple Simplify on D[r1,b], and I get your leaf count 248 using FullSimplify on D[r1,b]. However, my befuddlement at the very different outputs of the same command on different computers still remains. Feb 9 '18 at 15:33