3

I am pretty new to Mathematica (and programming in general). Often, I use Mathematica to check some results (mainly consisting of linear equations) and I wonder why the equations do not equal 0. Then, (sometimes after 10 minutes or so) I find out that I forgot the Simply command (again). I then put my expression into "Simplify[...]" and get 0. However, I wonder, what is the purpose of this command? Why doesn't Mathematica automatically simplify "simple" expressions? E. g. I have the following expression:

-3 a66 + 2 (-a66 + 2 (2 a66 - a77)) + 2 (2 a66 - a77) + a77 - 2 (-2 a66 + 2 (-a66 + 2 (2 a66 - a77)) + a77)

which, only when using Simplify, reduces to

-a66 + a77

I don't see why any user would prefer the former form. So the only reason I could think of is that simplifying needs a lot of computational power. While this may be the case for "difficult" expressions involving trigonometrical expressions, I can't see why this could be the case here.

My Internet search doesn't give any results on this question and it's hard to imagine no one had this question before.

Note that this is not a rant but I genuinely wonder what the reasoning behind this is.

user49466
  • 31
  • 1
  • The short answer is just what you said: simplifying can cost extra computational power, so you need to tell Mathematica to do it explicitly. The longer answer is that there is a basic difference between evaluation of expressions and manipulation of mathematical formulae. In the end, Mathematica is a programming language: if you want it to do mathematics, you need to use the functions that tell it to do mathematics. – Sjoerd Smit Jun 12 '17 at 13:47
  • 1
    There is Refine, Simplify, FullSimplify, TrigReduce, TensorReduce, Reduce, PossibleZeroQ. This question is not well posed, after all. I find it a duplicate of What is the difference between a few simplification techniques? – Artes Jun 12 '17 at 13:47
  • 4
    It does auto-simplify in the most trivial cases, and you will find many complaints on this site about this. There is often value of keeping an expression in a certain form. In non-trivial cases simplification takes a long time (because it is neither a straightforward, nor a well defined task). Finally, you forgot that Mathematica is a programming language, not a machine that answers questions (for that see Wolfram|Alpha). Doing too much automatically is counterproductive when programming specific tasks – Szabolcs Jun 12 '17 at 13:48
  • 1
  • Thank you for your answers. I am really sorry; I did not know about the many simplification commands. I also did not thought that Mathematica is a programming language - to me, it was presented as a powerful computing tool. However, as at least I find it quite annoying, do you know if there is a trick which tells something like "in this notebook, try for every computation for 1 second if you can simplify it (in the way the Simplify command would do), if it can be simplified, return the simplified expression, if not, do what you usually would do"? – user49466 Jun 13 '17 at 10:07
  • I also want to apologize for my question being to opinion-based. I did not realise that as I thought there would be one and only one good reason for that. – user49466 Jun 13 '17 at 10:09
  • @user49466 You could use $Post like this: $Post = Quiet[Simplify[#, TimeConstraint -> {1, 1}], {Simplify::time, Simplify::gtime}] &; to simplify every output. You could use CellProlog and CellEpilog to automatically set and reset $Post on specific notebook. But it will simplify only outputs, if you assign expression to a variable you'll see simplified version as result of this assignment, but actually assigned value would be unsimplified. – jkuczm Jun 13 '17 at 14:01

1 Answers1

0

I wonder, what is the purpose of this command?

It is easier to understand the meaning of equation when it is in simplest form. In your case, the un-simplified equation is hard to read for user who wants to determine if it is quadratic,linear or nonlinear by quick glance. The simplified one tells you quickly what it is.

Why doesn't Mathematica automatically simplify "simple" expressions?

Sometimes over simplification destroys the power form expression which is easier to read than expanded form which Simplify always does. Example (x-10+y)^10 is easier to read than x^10 + .......etc and all other terms.

Aschoolar
  • 883
  • 5
  • 14
  • I am sorry, but I don't understand your last command. My Mathematica (Version 8) does not expand your expression (x-10+y)^10 if I use Simplify. Is this what you mean? – user49466 Jun 13 '17 at 10:01
  • It does expands it first and then simplifies it. Something user wants to keep equation in original form with a very little modification. For example, if you have (x-10+y)^10+(x-10)^+10(10+y)^10+(x+y)^3 – Aschoolar Jun 13 '17 at 13:49
  • When I type in Mathematica Simplify[(x - 10 + y)^10 + (x - 10)^+10 (10 + y)^10 + (x + y)^3], I get (-10 + x)^10 (10 + y)^10 + (-10 + x + y)^10 + (x + y)^3 as output. I am sorry but I don't understand your comment. – user49466 Jun 14 '17 at 12:09