1
$\begingroup$

When calculating the modulus of a complex number in Mathematica, the standard (and probably least-ugly) way of doing it is by using the Abs[ ] function. When doing it by hand or in LaTeX though, the standard way is to nest the complex number in between vertical bars "| |", like so:

$$\left|3+4i\right|=5$$

Is there a way to do this in Mathematica? That is, is there a way to use "| |" just as we would use Abs[] when inputting, and not just formatting the output? I dislike seeing and using a cluster of Abs[] functions every time I work with complex numbers.

| improve this question | | | | |
$\endgroup$
  • $\begingroup$ You can use TraditionalForm to see it in this form. Inputting it in this form is a different matter though. $\endgroup$ – Szabolcs Jul 14 '16 at 19:46
  • $\begingroup$ @Szabolcs Yeah I'm interested in inputting it like that. I edited the question. $\endgroup$ – Arturo don Juan Jul 14 '16 at 19:48
  • $\begingroup$ Well, you can type ESC l| ESC x ESC r| ESC if you don't find that too tedious. $\endgroup$ – Szabolcs Jul 14 '16 at 19:54
  • $\begingroup$ Sorry, that's not sufficient. You also need to define BracketingBar to evaluate to Abs. $\endgroup$ – Szabolcs Jul 14 '16 at 20:16