# Modulus (absolute) of a function, its quadrature, and relevance of zeros

Modulus of a (discretized) function, $|f_h(x)|$, where $h$ refers to the mesh spacing, would, in general, have zeros, and those zeros would not necessarily lie exactly at the mesh points.

A naive abs call on such a function, abs(f_h), is a very bad representation of such a modulus.

This is especially relevant when a quadrature of such a result is attempted. The most sensible remedy I can think of is something like a modulus-aware quadrature, i.e., you can no longer treat the 'integral of the modulus of a function' as a two step process, a modulus, followed by an integration. A modulus-aware quadrature would involve detection of discrete intervals where zeros are present (discrete root-finding), and computation of the quadrature over those intervals differently, compared to intervals where there are no sign changes. (And very likely modulus-aware computation is relevant for non-quadrature purposes).

Given the importance of such an operation, in computational error analysis at the minimum, there are two serious issues in relation to this:

• The notation $\int_{\Omega} |f_h(x)| dx$, as well as $h \sum |f_h|$, is not only wrong, it's misleading to students. This notation is telling a student that you can treat the integral of a modulus on a discretized function (the discretization denoted by the presence of '$h$' in the subscript) as a two step process. You cannot blame a student when he/she looks at that notation and goes ahead and tries to do a quadrature(abs(f_h)) or sum(abs(f_h)). This shoehorning of mathematical notation, meant for continuous analysis, into discrete analyses, should be nothing short of a crisis in computational science, which, unfortunately, is treated as business-as-usual as far as I can tell. (and since it has direct relevance to $L_2$ and similar norm calculations, the addition of a squaring operation not making things any better, I wonder about the percentage of computational scientists out there going about their daily lives doing an incorrect error and norm analysis without realizing it).

• The discussion of modulus-aware quadrature in texts (e.g., the one that I have, Heath, Scientific Computing), as well as computational libraries (e.g., MATLAB, python scientific stack, etc) is either completely absent, or seriously lacking.

Not to single out, but as a case in point, Nico Schlomer has developed a great quadrature library for python quadpy. If you take a look at the front-page (readme.md) of that github project, you would be truly impressed with the level of depth and breadth of the available schemes, to say the least. Except that you wouldn't find a single mention of the issue I described above. All the greatness of such a quadrature library would be fairly useless to someone trying to compute a simple modulus-aware quadrature.

So my question is, why is there so much lack of serious treatment of modulus-aware quadrature in numerical analysis as well as computational science circles?

• The drama is not really necessary here: Lots of people have made this observation and made their peace with the issue somehow. To call for "nothing short of a crisis in computational science" is not productive. And it is patently wrong that the quadrature library is "fairly useless". – Wolfgang Bangerth Dec 5 '17 at 1:57
• By the way, I've already pointed out your attitude problem here: scicomp.stackexchange.com/questions/27946/… . I would recommend thinking about these issues. – Wolfgang Bangerth Dec 5 '17 at 2:06
• The same attitude was shown in this post: scicomp.stackexchange.com/q/28271/9667 – nicoguaro Dec 5 '17 at 4:31

I don't think that, in the face of this, I want to go into great detail of why the approach everyone uses is completely appropriate. Suffice it to say that while $|f_h|$ is indeed a poorly behaved quantity, the error is in fact computed through integrals of the form $$e = \left(\int |u-u_h|^2\right)^{1/2}.$$ In other words, one takes the square of the absolute value. This is a quantity that does not have a kink and is in fact well-behaved. Nothing terrible will happen if you integrate it.