Didáctica del graficado de funciones: el caso de las funciones piecewise Didactics of Function Plotting: The Case of Piecewise Functions Didática de funções gráficas: o caso de funções por partes

This paper presents an educational method that allows matching elementary functions. It is proposed to plot piecewise type functions by means of a graphing function that uses windows. In this case, the advantage is that both teachers and students who do not have programming knowledge or specialized graphing commands will be able to view them in the classroom using educational mathematical software. Also, three case studies are presented where good results have been obtained.


Introduction
In mathematics courses, when the student has an approach to algebraic functions, from that moment he is asked to graph a linear or a quadratic function. To this is added that the student must be able to differentiate the dependent variable from the independent one.
Likewise, in the classroom, the student must learn what is the domain and what is the counter domain. At the same time, she must know how to distinguish when it comes to a relationship or a function between these sets. This is what is traditionally handled in secondary or upper secondary education, however, the School Mathematical Discourse (DME) is hidden there.
In the teaching of mathematics, the DME is the language that is handled in class, it is the system of reason that produces symbolic violence due to the imposition of arguments, meanings and procedures (Soto, Gómez, Silva and Cordero, 2012;Soto and Cantoral, 2014).
It is everything that remains unchanged despite the modifications that are supposedly made, since in reality the concepts that are being taught are not modified (Cantoral, Montiel and Reyes, 2015). Something similar occurs with the textbooks used in mathematics classes: they are influenced by the DME (Cantoral et al., 2015).
The trace of the DME is seen in the textbooks that are used in different areas, not only in the teaching of school mathematics. For example, in the area of control engineering (Ogata, 2003;D'Azzo, 1995) the way in which the way of determining a transfer function is exposed does not change. To this we can add that these arguments do not change when comparing a previous edition against an updated one of the same work.
The same thing happens if we compare the graphing of functions reviewing two books by different authors (Barnett, R. (1994); Stewart, 2007) and the same can be said if we compare these works against their updated versions with the difference that pedagogical resources have been added and technology management such as mathematical software management (Barnett, 2012;Stewart, 2012). However, there are authors who have used other procedures, either adding or showing different paths that lead to the same result. For example, in (Gómez, 2017;Ogata, 2003) the alternative procedures for the decomposition of partial fractions were presented using the Heaveside method, replacing the methodology of the undetermined coefficients that are handled in the traditional courses of integral calculus and precalculus (Ayres et al. al., 1994;Purcell, et.al., 2007;Edwards and Penney, 2007;Barnett, 2012).
In (Sandoval-Hernandez, et. al, 2019a) a direct current bias analysis was performed for two rectifier diodes in series, where an algebraic solution was presented in terms of the parameters of the circuit components. In this article, the DME that prevails in basic electronics courses was avoided, since in a traditional way, the polarization of a rectifier diode is found graphically, that is, the crossing of the characteristic curve of the rectifier diode against the line of circuit load. This traditional methodology appears in (Boylestad & Nashelsky, 2003). Alternatively, the bias point for this circuit can be obtained using the Newton-Raphson method (Burden and Faires, 2005;Chapra, 2004).
In addition, in the work (Sandoval-Hernandez, et. al, 2019b) two approximations were proposed in terms of elementary functions, one for the error function and the other for the normal cumulative function, which can help in statistics classes by showing paths alternatives in their determination compared against the traditional tables where the DME is involved (Spiegel,1994). Similarly, in (Sandoval-Hernandez, et. al, 2021a) the DME that has prevailed in algebra books in the deduction of the general formula to solve second degree equations was overcome, presenting an alternative for this formula through the substitution of a complex number. Likewise, an analysis of significant digits was presented there when it was decided to rationalize the general formula to find the roots. This same analysis was done for a solution by means of power series when there is a small perturbation value (Holmes, 2012) in the linear term of a quadratic equation In this work we propose to join two or more elementary functions by means of a function that allows graphing a combination of transcendental and/or algebraic functions that represent functions defined by pieces, known as piecewise (Chua et. al., 1987) avoiding the use of specialized mathematical software commands such as Maple (Fox, 2011;Barnes, 2014), Octave (Lie. 2019) or Matlab (Barnes, 2014;Nakamura, 1997), etc. This methodology can be implemented in precalculus courses such as algebra and trigonometry in high school, where most students do not yet have knowledge of programming languages (Joyanes-Aguilar, 2001) or advanced mathematical software.

Function graph
The first contact that students have with graphs, be they histograms, charts and Cartesian graphs, is in basic education (Cordero and Flores, 2005). In traditional teaching where the DME is present, to graph a function we tell students that they must start by making a table of values (Baldor, 2011, Olvera, 1991. In general, we give students the domain, that is, the set of values that the independent variable x is going to take on. In some cases, without telling them why those values have been chosen (again the DME is present) and then we proceed as shown in figure 1. Then we proceed to make a tabulation to form the coordinate points, which we will put in the Cartesian plane. Finally we join them with a line. This procedure shown is used when teaching students how to graph algebraic and transcendental functions. Educational mathematical software is currently available for these purposes and one of them is GeoGebra (Sánchez, 2019). In this way, using mathematical software, the problem presented in Figure 1 can be graphed easily and quickly by entering the coordinates and the equation of the line. However, if we wanted to graph a function 1 ( ) = 0 and then a function 2 ( ) = sin( ) by hand or in some mathematical software, we would have to graph separately indicating the interval where each of the functions will be, which would then make it necessary to enter two equations and graph them independently.
(1) This is a piecewise type function (Chua et. al., 1987). In this example there are two functions, a straight line and the sine function that are valid in each of the indicated intervals.
To graph this function f(x) in Maple we would have to enter the commands ˃with(plots); ˃f:=x; ˃g:=sin(x); ˃recta:=plot(f, x=0..3.14, color=red): ˃seno:= (f, x=0..3.14..9.9, color=blue): ˃display(recta, seno): This can be overcome if we use an advanced command that allows graphing this type of function. For this purpose the piecewise command solves the problem. Using the functions f, g in Maple and adding the commands ˃mi_fun:=piecewise(0 ˂= x and x ˂=3.14, f, 3.14 ˂= x and x˂ 10,g): ˃plot(mi_fun, x=0..12): the problem is solved. However, this would imply that the students know a little programming and Maple software. Unfortunately, many high school students and first-semester college students do not have them. Figure 2 shows the function plotted in Maple. 2011; Barnes, 2014), Octave (Lie. 2019) or Matlab (Barnes, 2014;Nakamura, 1997) where the commands to graph elementary functions were searched.

Materials
The

Results
In the documentary research, it was found that the graphing commands included in several mathematical computer programs are plot and piecewise. The former is generally used to graph a function in two dimensions in terms of the dependent variable and the independent variable. This function usually has several arguments to customize the graph, for example the color and the type of font to be used. The second command is used to build and define the piecewise functions. This command also has additional arguments to define various piecewise functions and the interval where each of the functions that will be part of the piecewise function will be valid.  (Fox, 2011;Barnes, 2014) to build a piecewise function, each of the built-in functions and the plotting intervals must first be defined, then the plot command is used to plot it.
In the case of Maxima, the piecewise function can be defined by simultaneously entering the plot interval for each piece and then using the plot2d or wxplot2d command.
In the case of Excel, the graphs can be generated through an interactive menu with which the user interacts. These graphs are customized according to the interest of the person.
However, it is possible to write a macro in Visual Basic for Applications to make different types of graphs (Torres-Remon, 2016). The latter represents a great disadvantage if the user does not have programming knowledge.
The syntax of the code that is written in Matlab and Octave is practically the same with the difference that Matlab is licensed software (Lie. 2019;Nakamura, 1997), however the graphing commands that are used in these programs have a syntax of graphics very similar to the one used by Maple.

The window method
We will analyze the behavior of the logistic function given by which is widely used in models of population growth, spread of epidemics, among others (Zill et. al., 2002).
The proposed windows method consists firstly of using the horizontal translation property to shift a function to the left or right (Stewart et. al., 2004). To make these translations we assume that there is a ℎ > 0. In such a way that (    . (4) Figure 4 shows how the function curve tends to change shape more abruptly when = 50. The larger the value of , the graph tends to take the form of the unit step (Ogata, 2003) for < 0. If we now consider a ( ) and a ( ) and we subtract them then a unitary window is generated (Proakis, Manolakis, 2004). See that in (5) the graphing intervals and the speed with which the window is activated and deactivated are specified. Figure 5 shows the case where = 10, = −2, = 4.

Figura 5. El método de la Ventana
Fuente: Elaboración propia It can be seen in the figure that the window is active for any interval < < . Note that on the left we have the difference in the magnitudes of both functions and on the right, the window closes when > because the function tends to zero. In this way, using the window, we proceed to multiply any elementary function during the interval interval < < eliminating the use of programming commands. Therefore, the mathematical expression for graphing a function is defined in terms of the window with the start and end points of the graphing interval given by ℎ( ) = ( )( ( ) − ( )). (6) It is worth mentioning that when there are two or more functions that are going to be graphed, these can be concatenated with the signs (+) y (−).

Discussion
In this section, three case studies are presented where the window method is implemented to graph piecewise functions.
Solution. Substituting the function and the values of the interval that define (7) we have ( 2  ) 1+exp(1000( −6)) ) . (8) In this case, it has only been multiplied by the function where the graphing interval ends, that is, for = 6. Figure 6 shows the graph of (8) where it shows the validity of the functions for the intervals given by (7). It is important to note that in this example we have four functions defined on four intervals. You can see the concatenation for each of the functions, as well as the interval where the window will be active for each of the functions. Figure 7 shows the graph of (8) where each of the functions defined in (7) can be seen. It is important to reiterate that in < −1 y > 8.5 function is 0. This is because the concatenated window system starts and ends without the need to propose cancel functions at those ends. In the comics that we have read in our childhood or free time, a series of costumed superheroes appear who seek to do justice by catching the villains who commit crimes in the cities. According to the comics, there are different ways to call these superheroes when a disaster is happening or to stop a villain from doing his thing.
In this example, we will invoke one that belongs to the Justice League (Superfriends).
It is worth mentioning that these characters, their emblems and their stories are the property of DC Comics (Avery-Natale, 2013). We will draw the Batman emblem that was used in the film directed by Tim Burton in the year 1989.

Solution:
For the modeling of the classic Batman logo, an image of 299x168 pixels was used, which proceeded to model the perimeter using splines with the interpolation procedures presented in (Burden and Faires, 2005 Using the functions (9) and (10)  Note that in (12) and (13) the absolute value has been included in order to consider that the functions that have to represent the upper and lower part of the figure are even. Figure   (8) presents the Batman emblem using the windows method for graphing.

Implementation Considerations
In the case studies presented in this article, piecewise type functions were graphed, so this methodology facilitates the graphing of these functions when teaching software is used. Also, in all examples we chose = 1000 in order to make domain hacking for windows faster.

Limitations
To use this graphing methodology, it is recommended to use algebraic or trigonometric functions with integer coefficients such as those presented in examples 1 and 2.
As more piecewise functions are added and the respective graphing intervals are defined, it is necessary to incorporate more windows. This results in the presence of more exponential functions that activate and deactivate each of the functions to be graphed. In example 3, twelve exponential functions were used to graph the upper part of the emblem, while six exponential functions were used for the lower part. This results in greater computation time in the graphing of the functions. Figure 8 shows the computation times to graph the Batman emblem. Note that the computation times calculated for the upper half are longer than for the lower half because more exponential functions have been used in the upper half. It is important to note that example 3 must be implemented in Maple or some other similar mathematical software because (13) has many numerical and exponential terms. This is a limitation for using educational software since they are not designed to perform scientific computation that involves considerable numerical calculation.

Conclusions
In this article, the window method for graphing functions was proposed, which consists of joining functions using the logistic function so that teachers can have graphing methodologies for piecewise functions and can be included in precalculus courses. Various functions can be linked, as far as the software allows. However, from example 3 we conclude that when you have several functions with floating point numbers and exponential functions, it is best to opt for scientific mathematical software since these programs have a high numerical robustness.
Vol. 12, Núm. 24 Enero -Junio 2022, e351 We believe that the strategy proposed in this article can be applied in pre-calculus courses, being a useful plotting tool since algebraic functions with integers are usually proposed in the classroom and the graphing of functions by pieces is ruled out.

Future lines of research
To use the window method more efficiently, it is possible to reduce computation times by replacing the exponential functions with other functions. This is necessary when you want For its incorporation, the pilot didactic strategies and evaluation instruments necessary to implement this proposal and make measurements in the expected learning of the students must be designed.