upvote
While some comments do point out the general opaqueness of Mathematica, the goal of Simplify is actually documented in Mathematica and something which can be changed: https://reference.wolfram.com/language/ref/ComplexityFunctio...

The default is a balance between leaf count and number of digits. But the documentation page above gives an example of how to nudge the cost function away from specialised functions.

reply
deleted
reply
I think "simplify" is pretty clear here. For trigonometric functions you would expect a trig function and an inverse trig function to be simplified. We all know what we'd expect if we saw sin(arcsin(x)) (ie x). If we saw cos(arcsin(x)) I'll spoil it for you: it simplifies to sqrt(1-x^2).

Hyperbolic functions aren't used as much but the same principle applies. Here the core identity is cosh^2(x) = sinh^2(x) = 1 so:

      sinh(arccosh(x))
    = sqrt(1 + cosh^2(arccosh(x))
    = sqrt(1 + x^2)
You should absolutely expect that from "simplify".
reply
OK, something weird is going on with HN here.

The first time I looked at the comment above, there was a reply, a reply to that reply, and a reply to the reply to the reply.

Later I came back and this time there were no replies. Since HN won't let you delete a comment that has a reply the only ways a comment chain should be able to go away are (1) the participants delete them in reverse order, or (2) a moderator intervenes.

I came back again and the comments are back!

I wonder if this is related to another comment problem I've seen many times in the past few weeks? I'll be using the "next" or "prev" links on top level comments to move through the comment and will come to a point where that breaks. Next reaches a comment that it will not go past. Coming from below prev will also not go past that point. Examining the links, next and prev are pointing to a nonexistent comment.

reply
How is going from two functions with one variable to three functions with a variable and a constant a simplification?
reply
If you can't recognize how much simpler the simplified version is, I'm not sure exactly what to tell you. But let's think about it in terms of assembly steps:

1. Multiply the input by itself

2. Add 1

3. Take the square root. There is often a fast square root function available.

The above is a fairly simply sequence of SIMD instructions. You can even do it without SIMD if you want.

Compare this to sinh being (e^x - e^-x) / 2 (you can reduce this to one exponentiation in terms of e^2x but I digress) and arccosh being ln(x + sqrt(s^2 - 1)) and you have an exponentiation, subtraction, division, logarithm, addition, square root and a subtraction. Computers generally implement e^2 and logarithm using numerical method approximations (eg of a Taylor's series expansion).

reply
This is sometimes helpful. But more often it has very little overlap with what I need when I "simplify" some math.

"Simplify" is a very old term (>50y) in computer algebra. Its meaning has become kind of layered in that time.

reply
deleted
reply
If simplify means make it fast for a computer to run we might as well make division illegal.
reply
In this case, a heuristic like "less parameters, less operators and less function calls" covers all the cases.
reply
It doesn't, because we might consider different outputs "simple" depending on what we're going to do next.
reply
deleted
reply