1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Advice for Mathematica as Mathematician's Aid

Discussion in 'Mathematics' started by CarlEdman, Aug 1, 2020.

  1. CarlEdman

    CarlEdman Guest

    I use Mathematica mainly as an aid in symbolic attacks on problems, usually intermediate or harder and often number theoretic. While Reduce, Simplify, et al. are remarkably powerful, they of course cannot solve most real problems. If they could, most of mathematics would be solved and we wouldn't need mathematicians any more. We could just Reduce[Exists[{x,y,z,n},x^n+y^n==z^n&&n>2]] and out would pop a proof or disproof of Fermat's Last Theorem (yes, I realize that Mathematica actually has recently been given this as an axiom and would hence may reduce to False here, but in general it of course cannot).

    So, instead, I like to use Mathematica as superior replacement for the old-fashioned pen-and-paper method I've used all my life. Ideally, I'd supply the specifications and transformations, but Mathematica would take care of all the error-prone tedium of substitutions and obvious simplifications. The savings on writing pads alone would pay for a Mathematica license.

    Any general advice on working in this mode (how, ideally, to specify the problem; advanced tips on when to use Reduce, Simplify, FullSimplify, Solve, and Refine, etc.) welcome.

    But I also have some specific recurring situations in which Mathematica just refuses to do obvious simplifications. Whenever that happens, I have to copy the Output by hand, perform the simplifications manually, and continue work from there. That is not ideal as it introduces the possibility of error and can be labor-intensive if the simplifications are complex or need to be done repeatedly after every change of a previous transformation.

    Common cases of failure and frustration for me are sub-expression are as follows (where p, q, r, ... stand for complicated expression of the symbolic variables x, y, ... with specified domains (Integers, usually) and n, m, ... stand for integral constants):

    • Power[p^(n m) q,1/n]. Of course you want to pull the p out of the Power, to transform the subexpression to p^m Power[q,1/n], if p is demonstrably non-negative or n odd, or Abs[p^m] Power[q,1/n], if it is not. But no matter how I try to coax Mathematica to do this, &&ing p>0 or giving that as an assumption to Simplify or Refine, Mathematica just won't do it.
    • (p^n q)/(p^m r). You want to cancel out p as far as possible, either completely if p is demonstrably positive or with a ConditionalExpression or PieceWise otherwise. I can't make Mathematica do it.
    • p==q+Power[r,1/n] && Elem[x,Integers] && Elem[y,Integers]. A good Reduce would be to introduce a dummy variable z and rewrite as p==q+z && z^n==r && Elem[x,Integers] && Elem[y,Integers] && Elem[z,Integers]. Again, I can't make Mathematica do it automatically.

    Is there some function beyond Reduce, Simplify, FullSimplify, Refine, or Solve that would do these kinds of reductions automatically?

    Would it be worthwhile and effective to write some custom TransformationFunctions that perform these reductions automatically for the cases I frequently see?

    Any other advice?

    EDIT 1: CLARIFICATION: I understand that most of these simplifications will happen if p, q, ... are just Mathematica symbols or very simple expressions. What I should have made clear is that I used them as meta-syntactic variables. Then when you enter something even moderately complicated for p or q (like a polynomial in x and y with integer coefficients), they unfortunately often don't.

    EDIT 2: SUMMARY CONCLUSION: First, let me thank the helpful commenters, in particular MarcoB who pointed me in the direction of ComplexityFunction (of which I had previously been ignorant) and provided interesting links.

    In general, MarcoB is of course absolutely right. What the simplest version of an equation is not at all obvious. Minimizing LeafCount is a good heuristic, but it is incomplete and fallible.

    Incomplete because, for example, $(x+y)(x-y)$ or $(x^2-y^2)$ are equivalent and have the same leaf count, but I will sometimes prefer the one and sometimes the other. Or: $(a_0 + a_1 x + a_2 x^2)$ or $a_2 (x-x_0) (x-x_1)$? Again, similar leaf count, but different preferences. Also fallible because one sometimes prefers slightly higher leaf counts.

    For most sums, I--and I think most people--prefer the terms to be listed from largest to smallest and with leading term apparently positive, pulling out a minus sign if necessary. So the StandardForm of listing polynomials from lowest to highest power--while perfectly sensible from a coding point of view--is sufficiently jarring to the trained eye that, for a while, I had set OutputForm to TraditionalForm until the warnings every time I copied and pasted out of it scared me away from that option. And, of course, that the polynomial is in some small variable, like in a perturbation equation or power series expansion, I do want the polynomial listed from lowest to highest power.

    Obviously, always producing the version preferred by the user is beyond the power of computers until we have human-level (or at least near-mathematician-level) A.I.

    That said, I dream of a version of Mathematica (11? Are you listening Mathematica devs?) in which the OutputForm can be interactively manipulated by the user. One would be able to pick up a sub-expression with the mouse and jiggle it to quickly vary it between the most commonly useful forms or drag it to other parts of the expression while maintaining mathematical correctness. That should be doable and would be very neat.

    Login To add answer/comment

Share This Page