# Detection of Discontinuity Points in one Variable Functions using Spaces of Trigonometric Functions

Pablo Palma, Rodolfo Gallo, Raúl Manzanilla

► To cite this version:

Pablo Palma, Rodolfo Gallo, Raúl Manzanilla. Detection of Discontinuity Points in one Variable Functions using Spaces of Trigonometric Functions. Bull. Comput. Appl. Math., 2021, 9 (2), pp.9-22. hal-03566889

HAL Id: hal-03566889

https://hal.science/hal-03566889

Submitted on 11 Feb 2022

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution - ShareAlike 4.0 International License
# Detection of Discontinuity Points in one Variable Functions using Spaces of Trigonometric Functions

Pablo Palma<fnref n="1" />, Rodolfo Gallo<fnref n="2" />, Raúl Manzanilla<fnref n="3" /> <fnref n="4" />

CompAMa Vol.9, No.2, pp.9-22, 2021 - Received April 12, 2021 - Accepted September 21, 2021

Special Issue II JEM 2020, Eds. Carmen Judith Vanegas and Saúl Buitrago Boret

## Abstract

Given a set of Lagrange type data in two dimensions and assuming that the points of the data set are associated with the graph of an explicit function with discontinuities, one wants to determine the points at which the function exhibits discontinuities. This is a concrete problem that appears in the area of approximation of curves with discontinuities and is present in different scientific areas. To do this, it is necessary to recognize discontinuity placement at the function. This need to characterize the placement of discontinuity points is fundamental for the development of mathematical models that take into account the discontinuities of functions. In this work, a new methodology is proposed to determine the points where the discontinuities of a function occur using an approximation space constructed from continuous trigonometric functions. The approach used to locate the discontinuity points of the function is based on the Gibbs phenomenon which is related to the oscillations found at the points of discontinuity when the discontinuous function is represented by a continuous function. Results will be presented and show the numerical process to approximate the placements of discontinuity points is successful.

<footnote n="1">¹Instituto de Postgrado, Maestría de Investigación en Matemática, UTM, Ecuador. (ppalma1312@utm.edu.ec). (ORCID iD: https://orcid.org/0000-0002-6944-3083).</footnote>

<footnote n="2">²School of Mathematical and Computational Sciences, Yachay Tech, Ecuador. (rgallo@yachaytech.edu.ec). (ORCID iD: https://orcid.org/0000-0002-2961-9136).</footnote>

<footnote n="3">³School of Mathematical and Computational Sciences, Yachay Tech, Ecuador. (rmanzanilla@yachaytech.edu.ec). (ORCID iD: https://orcid.org/0000-0002-8456-0333).</footnote>

<footnote n="4">⁴Corresponding author.</footnote>
**Keywords:** Approximation; detection of discontinuities; numerical methods; Gibbs phenomenon; applied mathematics.

## Resumen

Dado un conjunto de datos tipo Lagrange en dos dimensiones y asumiendo que los puntos del conjunto de datos están asociados con la gráfica de una función explícita con discontinuidades, se desea determinar los puntos en los que la función exhibe discontinuidades. Este es un problema concreto que aparece en el área de aproximación de curvas con discontinuidades y se presenta en diferentes áreas científicas. Para hacer esto, es necesario reconocer la ubicación de la discontinuidad en la función. Esta necesidad de caracterizar la ubicación de los puntos de discontinuidad es fundamental para el desarrollo de modelos matemáticos que tengan en cuenta las discontinuidades de funciones. En este trabajo se propone una nueva metodología para determinar los puntos donde ocurren las discontinuidades de una función utilizando un espacio de aproximación construido a partir de funciones trigonométricas continuas. El enfoque utilizado para localizar los puntos de discontinuidad de la función se basa en el fenómeno de Gibbs que se relaciona con las oscilaciones encontradas en los puntos de discontinuidad cuando la función discontinua está representada por una función continua. Los resultados se presentarán y mostrarán que el proceso numérico para aproximar las ubicaciones de los puntos de discontinuidad es exitoso.

**Palabras claves:** Aproximación; detección de discontinuidades; métodos numéricos; fenómeno de Gibbs; matemáticas aplicadas.

# 1 Introduction

Given a data set (scattered or regularly distributed)

$$D = \{(x_i, y_i) \in \mathbb{R}^2 : i = 1, \dots, m\}, \text{ with } x_i \in [a, b]. \quad (1)$$

It is assumed that the points of $D$ are associated with the graph of an explicit function $f$ that presents discontinuities, i.e.

$$f(x_i) = y_i, \quad \text{for } i = 1, \dots, m. \quad (2)$$

Using the set $D$, our goal is to determine the points at which the function $f$ presents discontinuities.

This is a specific problem that appears in the approximation problem of
curves with discontinuities and it is found in different scientific areas such as geology, satellite images, pattern recognition, structures of oil reservoirs, (cf. [1-7]) among others. For this, it is necessary to recognize and describe the discontinuity that occurs in said curve.

This need to characterize the points of discontinuity is fundamental for the development of mathematical models that represent phenomena in which abrupt changes in physical properties intervene, such as the change from one material to another with different properties.

The main objective of this work is to present results associated with the determination of the points where the discontinuities of the function *f* occur, using the approximation functions constructed from continuous trigonometric functions.

The approach used to locate the points where the function is discontinuous is based on the phenomenon of Gibbs, which shows the approximation function oscillations at the discontinuity points when this approximation function is continuous (cf. [8-13]).

In this article, numerical results are shown that give a characterization of the location of the discontinuity points based on the error of approximation.

## 2 Methodology developed for locating the point of discontinuity

The detection discontinuities methodology presented in this article is based on detecting of high variation on the error values between the values of approximation function and the values of the unknown function *f* in the data points that belong to *D*. (1)

This methodology can be summarized in the following four steps:

Step 1. Construct an approximation vector space of continuous functions. In this article, one considers a trigonometric function space which will be specified later.

Step 2. Do a least squares adjustment process with the data on *D* given in (1).

Step 3. Detect oscillations of the error which are present near discontinuities points to locate the discontinuity point. After adjusting of least squares is done, one proceeds to analyze the
points where one found abrupt error oscillation, indicating discontinuity points exist. (cf. [8, 10, 11, 14])

Step 4. Locate of discontinuity points.

To do it, an analysis of error based on a four-point sweep is proposed.
Later, more details about this four-point sweep will be given.

At follows, one explains each step mentioned above.

## 2.1 Approximation function space

The space considered in this article is formed by trigonometric functions. Given $n \in IN$ let's consider the following set of trigonometric functions,

$$ B = \{ 1 ; \\ \cos(x) ; \cos(2x) ; \cos(3x) ; \cdots ; \cos(nx); \\ \sin(x) ; \sin(2x) ; \sin(3x) ; \cdots ; \sin(nx) \}, \quad (3) $$

where: $x \in [-\pi, \pi]$

Let $V_n$ be the vector space spanned by $B$ which is a finite-dimensional vector space of dimension $2n + 1$, since all elements in $B$ are linearly independent for the classical sum and scalar multiplication of functions.

Functions in space $V_n$ are part of the representation in the Fourier series of a square integrable and $2\pi$-periodic function $f$ as

$$ f(x) \approx \frac{a_0}{2} + \sum_{n=1}^{+\infty} [a_n \cos(nx) + b_n \sin(nx)]. \quad (4) $$

Thus, one can associate the functions in $V_n$ space to the truncate Fourier series of a $2\pi$-periodic unknown function $f$, i.e.: if $v \in V_n$ then

$$ v(x) = c_0 + \sum_{i=1}^{n} [c_i \cos(ix) + s_i \sin(ix)] \quad (5) $$

## 2.2 Least squares adjustment process

Let us proceed to formulate the least squares problem associated with the data set $D$ given in (1).

Let us define the following vectors

$$ W = (w(x_i))_{1<i<m} \quad \text{for } w \in V_n, \quad \text{and} \quad Y = (y_i)_{1<i<m} \quad (6) $$
The least squares problem is:

$$ \text{Find } u \in V_n, \text{ such that } \|U - Y\|_m = \inf_{w \in V} \|W - Y\|_m. \quad (7) $$

Using the representation of $w \in V_n$ on the basis (3) B of $V_n$, one has

$$ w(x) = c_0^w + \sum_{i=1}^{n} [c_i^w \cos(ix) + s_i^w \sin(ix)] \quad (8) $$

where $c_0^w, c_i^w, s_i^w$, for $i = 1, \dots, n$, are real numbers.

Let us denote the vector $C_w$ and the matrix $A$, respectively, by:

$$ C_w = \begin{pmatrix} c_0^w \\ c_1^w \\ \vdots \\ c_n^w \\ s_1^w \\ \vdots \\ s_n^w \end{pmatrix}, \quad (9) $$

$$ A = \begin{pmatrix} 1 & \cos(x_1) & \cdots & \cos(nx_1) & \sin(x_1) & \cdots & \sin(nx_1) \\ 1 & \cos(x_2) & \cdots & \cos(nx_2) & \sin(x_2) & \cdots & \sin(nx_2) \\ \vdots & \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ 1 & \cos(x_m) & \cdots & \cos(nx_m) & \sin(x_m) & \cdots & \sin(nx_m) \end{pmatrix}. \quad (10) $$

Thus, the least squares problem (7) is equivalent to:

$$ \text{Find } C_u \in \mathbb{R}^{2n+1}, \text{ such that } \|AC_u - Y\|_m = \inf_{C_w \in \mathbb{R}^{2n+1}} \|AC_w - Y\|_m. \quad (11) $$

Therefore, (cf. [8]) one needs to solve the normal equations, i.e.:

$$ \text{Find } C_u \in \mathbb{R}^{2n+1}, \text{ such that } A^T A C_u = A^T Y, \quad (12) $$

which in the general case ($n << m$) has a unique solution.

At this point, one has a continuous approximation of the unknown function $f$, and one can study the behavior of error at points in $D$ (see (1))
## 2.3 Detecting error oscillations near discontinuity points

For the detection of candidates to be discontinuity points, a well-known fact of the Gibbs phenomenon will be used (cf. [8]). Given a point set in $\mathbb{R}^2$ associated with a discontinuous function (finite jump). To represent this data set one uses an approximate function defined as a linear combination of trigonometric functions, in a more general way the approximate function is a continuous function. therefore, near the discontinuity point, the graph of the approximate function will present oscillations and one can use it to detecting discontinuity points. This fact is recognized on approximate function likes polynomials, radial basis functions, and other continuous representations. One can see this behavior in the case of the Fourier series in figure 1. Here close to discontinuity points, it is possible to observe the oscillations of interest, i.e.; where the overshoots and undershoots are more important.

<figure><img src="image_2.png" /><figcaption>Fig. 1: Oscillations of interest.</figcaption></figure>

The same observation is valid when is used an approximation process based on continuous function like it is shown in figure 2(a).

Based on the mentioned before and using the data set D given in (1), one proceeds to define the error as

$$E(x_i) = y_i - u(x_i) \quad \text{for} \quad i = 1, \dots, m, \qquad (13)$$
where $u$ is the adjustment solution to the problem (12).

This definition of error without absolute value aims to highlight error variations on points of $D$ where is located the discontinuity since, in the Gibbs phenomenon, the error changes sign in the neighborhood where discontinuity point is located (cf. [8, 9]). This fact can be observed in the following figure 2(b).

<figure><img src="image_3.png" /><figcaption>Fig. 2: Oscillation of interest in adjustment case</figcaption></figure>

## 2.4 Location of discontinuity point

To determine where the discontinuity point is located, one uses the fact that near the point where the discontinuity occurs there is an overshoot and undershoot (cf. [8]).

From a discrete point of view, this results in a "Z" shape between the points where impulses (undershoots, overshoots) are contrary and consecutive. This relationship is magnified on the error (13) as it can be observed in figure 3.

To implement this observation, one proposes a strategy to detect the strong error variations where impulses are contrary and consecutive. This strategy is based on the following steps:

i.- Doing a sweep of four points on the data, it proceeds to classify the points having strong variations, i.e. $E(x_i) - E(x_{i+1})$ and $E(x_{i+2}) - E(x_{i+4})$ change of sign and one preserve error variation

$$ \mathrm{Var}_i = |E(x_{i+1}) - E(x_{i+2})|, \text{ for } i = 1, \dots, m-4. \quad (14) $$
<figure><img src="image_4.png" /><figcaption>Fig. 3: "Z" shape after adjustment</figcaption></figure>

ii.- One determines index $i_0$ where $Var_{i_0}$ has the maximum value. So $i_0$ is the index related to the location of discontinuity point.

iii.- One takes

$$x_D = \frac{x_{i_0+1} + x_{i_0+2}}{2}. \qquad (15)$$

as an approximation of discontinuity point.

Obviously, this proposal detects a point of discontinuity when it exists, and then it is necessary to divide the work interval into two intervals with $x_D$ as the boundary point of each one and repeat the detection process. This process of division into intervals culminates when the adjustment carried out does not present strong variations in the error, for example, variations less than 20% of the absolute value error obtained from the analysis of the error carried out previously.
# 3 Numerical examples

Using some discontinuous functions known, one proceeds to test the methodology proposed in the previous section.

## 3.1 Test function

Let use the following test functions:

$$f_1(x) = \begin{cases} 3 & \text{if } -3 \le x \le 1 \\ 1 & \text{if } 1 < x \le 4 \end{cases} \qquad (16)$$

$$f_2(x) = \begin{cases} e^{2x} & \text{if } -4 \le x \le 1 \\ \cos(x) & \text{if } 1 < x \le 7 \end{cases} \qquad (17)$$

to test the methodology proposed to approximate the discontinuity point.

For each one of the test functions, one generates a data set formed by a number of 200 points ($m = 200$) randomly distributed on its definition interval to then proceed to adjust the data set using the vector space $V_n$. Remember, the dimension of $V_n$ is $2n + 1$.

## 3.2 Discontinuity point location

In figures 4 - 5 can be observed how the adjustment work over the data set related to the function $f_1$ and $f_2$. Here, the decrease of error variation when $n$ increases is appreciated. This is consistent with the fact, when $n$ becomes bigger the adjustment function in $V_n$ tend to interpolation function of the data set. Figures 6 - 7 show the behavior of the methodology used to locate discontinuity point from a data set. In the previous figures 6 - 7, the discrete effect of the appearance of the "Z" shape between the points where the impulses are opposite and consecutive can be observed. Also, one observes the detection of discontinuity point is easier when one uses a space $V_n$ with low dimension relative to the number of data.

In the following table, the results of the methodology described in section 2.4 to locate the discontinuous point in the data set could be observed and shows it is working.
<figure><img src="image_5.png" /><figcaption>Fig. 4: $f_1$ data adjustment and error.</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>Fig. 5: $f_2$ data adjustment and error.</figcaption></figure>
<figure><img src="image_7.png" /><figcaption>(a) Case $n = 10$ for test function $f_1$.</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>(c) Case $n = 30$ for test function $f_1$.</figcaption></figure>

<caption>(d) Case $n = 40$ for test function $f_1$.</caption>

<figure><img src="image_9.png" /><figcaption>(a) Case $n = 10$ for test function $f_2$.</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>(c) Case $n = 30$ for test function $f_2$.</figcaption></figure>

<caption>(d) Case $n = 40$ for test function $f_2$.</caption>

<caption>Fig. 7: Discontinuity point localization for different values of $n$ using data from $f_2$.</caption>
<table><caption>Tab. 1: Discontinuity points obtained.</caption><caption>Data points number m = 200</caption><thead><tr><th>n</th><th>Dim(V<sub>n</sub>)</th><th>f<sub>1</sub></th><th>f<sub>2</sub></th></tr><tr><th></th><th></th><th>x<sub>D</sub></th><th>x<sub>D</sub></th></tr></thead><tbody><tr><td>10</td><td>21</td><td>1.0195</td><td>1.0153</td></tr><tr><td>20</td><td>41</td><td>1.0195</td><td>1.0153</td></tr><tr><td>30</td><td>61</td><td>1.0195</td><td>1.0153</td></tr><tr><td>40</td><td>81</td><td>0.95271</td><td>1.1319</td></tr></tbody></table>

## 4 Conclusions

In this article one can conclude the following:

1. A methodology is developed to approximate the location of points of discontinuity related to a data set of a real function.

2. The numerical examples show the methodology is feasible and allows to find the points of discontinuity.

3. For better and faster results the dimension of the approximation space $V_n$ must be much smaller than the number of points in the data set.

4. To approximate the location of all possible points of discontinuity from the data set, one must proceed in a recurrent manner, defining a tolerance level on the variations of the error.

## References

[1] C. Gout, C. Le Guyader, L. Romani, and A. Saint-Guirons. Approximation of surfaces with fault(s) and/or rapidly varying data, using a segmentation process, $d^m$-splines and the finite element method. *Numerical Algorithms*, 48(1):67–92, 2008. doi: 10.1007/s11075-008-9177-8.

[2] C. Gout and I. Ramière. Surface approximation from rapidly varying bathymetric data. In *IEEE International Geoscience and Remote Sensing Symposium (IGARSS)*, volume 4, pages 2679–2681. Symposium. Proceedings(IEEE Cat. No.03CH37477), 2003. DOI: 10.1109/IGARSS.2003.1294549.
[3] D. Apprato, R. Arcangéli, and R. Manzanilla. Sur la construction de surfaces de classe à partir d'un grand nombre de données de lagrange. *ESAIM: Mathematical Modelling and Numerical Analysis*, 21(4):529-555, 1987. http://www.numdam.org/item/M2AN_1987__21_4_529_0/.

[4] D. Apprato and C. Gout. A result about scale transformation families in approximation: application to surface fitting from rapidly varying data. *Numerical Algorithms*, 23(2):263-279, 2000. doi:10.1023/a:1019108318920.

[5] R. Arcangéli. Some application of discrete $d^m$-spline. *In Mathematical Methods in Computer Aided Geometric Design Lyche, T. and Schumaker, L. (eds.)*, pages 35-44, 1989. https://doi.org/10.1016/C2013-0-11108-7.

[6] R. Arcangéli, R. Manzanilla, and J. Torrens. Approximation spline de surfaces de type explicite comportant des failles. *ESAIM: Mathematical Modelling and Numerical Analysis*, 31(5):643-676, 1997. http://www.numdam.org/item/M2AN_1997__31_5_643_0.

[7] R. Manzanilla. *Sur l'approximation de surfaces définies par une équation explicite*. PhD thesis, Thèse, Université de Pau, Université de Pau et des Pays de l'Adour, 6 1986. http://www.theses.fr/1986PAUU3006.

[8] A.J. Jerri. *The Gibbs Phenomenon in Fourier Analysis, Splines and Wavelet Approximations*, volume 446 of Mathematics and Its Applications. Springer US, 1998. ISBN 978-1-4419-4800-7, doi: 10.1007/978-1-4757-2847-7.

[9] E. Rivera R. and R. Martínez G. Características del fenómeno de gibbs. *Impulso tecnológico*, 15(37):14-16, 1 2018. https://www.researchgate.net/publication/328229930_Caracteristicas_del_Fenomeno_de_Gibbs.

[10] J.W. Gibbs. Fourier's series. *Nature*, 59(1522):200-200, 1 1898. https://doi.org/10.1038/059200b0.

[11] R. Rodríguez del Río and E. Zuazua Iriondo. Approximation spline de surfaces de type explicite comportant des failles. *Cubo. Matemática Educacional*, 5(2):185-224, 2003. https://eprints.ucm.es/id/eprint/8364.
[12] R. Schaback. Creating surfaces from scattered data using radial basis functions. *Mathematical Methods in Computer Aided Geometric Design III*, M. Dæhlen, T. Lyche and L.L. Schumaker (eds.), 5(2):477–496, 1995. https://num.math.uni-goettingen.de/schaback/research/papers/CSfSDURBF.pdf.

[13] T. Gutzmer and A. Iske. Detection of discontinuities in scattered data approximation. *Numerical Algorithms*, 16(2):155–170, 1997. doi:10.1023/a:1019139130423.

[14] M. Buhmann. *Radial basis functions: Theory and implementations*. Cambridge Monographs on Applied and Computational Mathematics. Cambridge University Press, 2004. ISBN 0-521-63338-9, doi: 10.1007/978-1-4757-2847-7.