7
$\begingroup$

The last two days I spent improving my Mathematica skills regarding rather simple algebraic calculations:

  • discrete FT
  • splitting sums
  • combining sums
  • changing summation indices
  • replacing a sum with a KroneckerDelta: $\delta_{nm} = \frac{1}{N} \sum\limits_{k = 1}^N e^{2 \pi i \frac{k}{N}(n-m)}$
  • canceling symmetric sums over antisymmetric terms
  • inserting commutator-relations in equations
  • etc

But I'm far from being as fast as doing it by hand.

Using Simplify, Replace etc. and rules, to format equations takes quiet some time. I assume over time a collection of formating-rules will accelerate calculations. But even trivial calculations such as non-commutative products, together with commutations relations (see ladder operators in quantum mechanics) are a load of work in Mathematica! I just can not see that I will be as fast with Mathematica as by hand.

So my question is: Is Mathematica intended for doing lengthy algebraic calculations from start to finish, faster than, or at least not much slower than by hand?

I started building a library of Replacement rules and TranformationFunctions. Is that the way to go? Do you have some other tips for improvement? A book or a collection of examples?

$\endgroup$
5
  • 2
    $\begingroup$ Could you give a specific example of a symbolic calculation you think takes longer by Mathematica than by hand? But in short, yes: Mathematica is superb for doing lengthy algebraic calculations from start to finish, and there are several important calculations in my career that I could have done only with Mathematica. $\endgroup$ – David G. Stork May 5 '15 at 8:20
  • $\begingroup$ [link]mathematica.stackexchange.com/questions/82596/… [link]mathematica.stackexchange.com/questions/65471/… [link]mathematica.stackexchange.com/questions/20540/… are examples that are really trivial by hand, but to bring Mathematica to do them takes me rather long $\endgroup$ – user29242 May 5 '15 at 8:23
  • $\begingroup$ As given in the solution you accepted: Subscript[ϕ, 1] == Subscript[ϕ, II + 1] /. Exp[a_] :> Simplify[Exp[a], Assumptions -> k ∈ Integers]. Quick and easy! $\endgroup$ – David G. Stork May 5 '15 at 8:25
  • $\begingroup$ @David Yes, individual problems on their own are not the problem. It is that I have to use many of these formatting rules, which takes me at the moment at least 5-10 times longer than doing it by hand. I am aware that most likely this is just because I have too little experience with Mathematica, but the sort of simple problems I had issues with, made me question whether Mathemaica is intended for such use:) I'm glad to hear that you manage to use it this way, so my struggles won't be for nothing. Do you use Mathematica for most of your calculations or just for the ones, not doable by hand? $\endgroup$ – user29242 May 5 '15 at 8:36
  • 2
    $\begingroup$ is your problem that it takes you longer to write the input for Mathematica to do the calculation or that Mathematica itself is slow? Mathematica is definitely used for algebraic calculations which are too much work to do by hand in any chance (e.g. feyncalc), but it needs some experience and effort to make it perform these efficiently. For very demanding calculations, you might have to switch to specialiced packages though... $\endgroup$ – Albert Retey May 5 '15 at 13:27
14
$\begingroup$

I do analytical calculations with Mma on the regular basis during already about 10 years in the area of theoretical solid state physics. Previously I did such analytical calculations by hand, now I do it in the on-screen regime only, without passing to the paper stage even for intermediate steps. Basing on my experience I can tell the following. The timing depends first of all upon ones personal flexibility with Mma. The more masterful are you, the faster it goes.

However, even with a good level of the Mma mastering, if it is about really heavy and lengthily analytical calculations, it is faster to calculate once by hand, than by Mma.

Please understand me clearly, I do not mean such calculations where you may be satisfied by the application of the Simplifyor PowerExpand or alike, or even few of them at once, and that ends your calculations. If it is about application of these only, your time will only be taken by the typing, that is, three times nothing.

I mean real cases when you have several heavy expressions, and you need to transform parts of these expressions in one way, other parts in another way, collapse some parts together, expand other parts, bring the expressions to a form desired by you, rather than Mma to compare, neglect some parts, apply some approximations to other parts and so on. I think each of us may pick up a good example from his own experience. That is the kind of things usually done in theoretical physics. Then it really takes some time to write all necessary Mma operators, and it often takes less time to do all this by hand, the more that we were trained to calculate by hand from childhood, and have mastered it.

OK, but each of us, who made lengthily calculations, knows that in such calculations small errors pop up very soon. I mean such as "+" instead of "-" when you go to a new line, or missed factor of 2 somewhere, or like that. And in the end we get an incorrect result. So we need to recalculate. How many times? I told my PhD students to recalculate no less than 7 times. It was a good try-and-error figure in the time we did everything by hand.

Mma, in contrast" does no such mistakes. So altogether it takes many fold less time to do it with Mma, then by hands.

So, have fun!

$\endgroup$