<<

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using 's package

A simplified introduction to virus propagation using Maple's Turtle Graphics package

Eugenio Roanes-Lozano Instituto de Matemática Interdisciplinar & Departamento de Didáctica de las Ciencias Experimentales, Sociales y Matemáticas Facultad de Educación, Universidad Complutense de Madrid, Spain

Carmen Solano-Macías Departamento de Información y Comunicación Facultad de CC. de la Documentación y Comunicación, Universidad de Extremadura, Spain

Eugenio Roanes-Macías Departamento de Álgebra, Universidad Complutense de Madrid, Spain

[email protected] ; [email protected] ; [email protected]

Partially funded by the research project PGC2018-096509-B-100 (Government of Spain)

1

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

1. INTRODUCTION: TURTLE GEOMETRY AND LOGO • Logo language: developed at the end of the ‘60s • Characterized by the use of Turtle Geometry (a.k.a. as Turtle Graphics). • Oriented to introduce kids to programming (Papert, 1980). • Basic movements of the turtle (graphic cursor): FD, BK RT, LT. • It is not based on a Cartesian Coordinate system.

2

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Initially were used to plot the trail of the turtle. http://cyberneticzoo.com/cyberneticanimals/1969-the-logo-turtle-seymour-papert-marvin-minsky-et-al-american/

3

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• IBM Logo / LCSI Logo (’80)

4

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• A modern Logo version (FMS Logo):

5

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Scratch 3 (uses graphical programming blocks)

6

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• The Turtle Geometry applies constructionist ideas (Papert, 1980; Kafai & Resnick, 1996). • Advantages w.r.. working with Cartesian Coordinates: − trigonometric calculations are performed internally (it is oriented to be used by kids), − repeating a certain design elsewhere only requires to allocate the turtle in the new position and new heading and to apply the same list of commands.

• Lots of possibilities (Abelson & diSessa, 1981). • There are, for instance, extensions to: − spherical geometry (Cabezas & Hernández-Encinas, 1988), − elliptic geometry (Sims-Coomber & Martin, 1994), and − hyperbolic geometry (Sims-Coomber, Martin & Thorne, 1991).

7

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Logo: Great success in the '80s, followed by decay. • Reasons for the decay of Logo: − social:  knowing programming is no longer considered a must,  although powerful and well designed (procedural, recursive, etc.), Logo is very friendly, and many people associate it to children, underestimating it (Harvey, 1997)

8

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

− computational: more modern programming languages including Turtle Graphics:

 Scratch, Scratch 2, Scratch 3 (Lifelong Kindergarten Group, 2013; Roanes-Lozano, 2018)  with intuitive graphical programming blocks,  easiness to change the costumes of the sprites (graphic cursor),  easiness to develop animations,  surprisingly, there is neither BK nor RETURN commands and it has limited recursive capabilities,  the classic turtle has been substituted by a cat.

 Snap! (Garcia, Segars & Paley, 2012; Harvey & Mönig, 2017)  can be considered a descendent or evolution of Scratch, with wider programming capabilities (e.g. recursion: report block).

9

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Nevertheless there are many Logo dialects available (Boytchev, 2014), some really powerful, with 2D and 3D graphics, like  FMSLogo,  StarLogo (Resnick, 1995),  NetLogo (Wilensky, 2013) and some of the modern dialects can deal with multiple turtles, although its use is scarce (Give'on, 1991; Resnick, 1997; Neuwirth, 2001).

10

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Reason for the decay of Turtle Geometry: − computational: nowadays there is a wide variety of mathematical software available:  dynamic geometry systems (DGS):  Cabri Geometry, The Geometer's Sketchpad,  Cinderella,  Geometry Expressions,  GeoGebra, etc.  systems (CAS):  /, Reduce,  Maple, Mathematica,  Axiom, CoCoA, , Sage, , etc.

11

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• But there are many implementations of Turtle Geometry (more or less powerful): − PythonTurtle (Rachum, 2011), − Haskell (Boiten, 2004), − Java TurtleGraphics, Jurtle, Pencil Code Online, − Xcas, − NetPrologo (Sancho, 2012), − Turbo-Prolog (Roberts, 1987) , − Turbo-Pascal and Turbo-C (Roanes-Lozano & Roanes-Macías, 1994b), − Maple (Roanes-Lozano & Roanes-Macías, 1994a), − Derive (Lechner, Roanes-Lozano, Roanes-Macias & Wiesenbauer, 1997), − Reduce (Cotter, 1998), − TI-92 calculator (Kutzler & Stoutemyer, 1997), − Smartphones: Turtle Draw.

12

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

2. THE 1994 MAPLE IMPLEMENTATION OF TURTLE GEOMETRY • The authors were the first and third authors of this paper (father and son). • Just to give the flavour of the implementation, we include afterwards the main procedures of the implementation:

ClearScreen:=proc() global XCor, YCor, Heading, PenColor, posicion_lapiz, dib; XCor := 0; YCor := 0; Heading := 0; PenColor := COLOUR(RGB,0,0,0); posicion_lapiz := 1; dib:={}; NULL; end: #ClearScreen

13

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

Forwd:=proc(distancia:algebraic) global XCor, YCor, dib; local antigua_absc_tort, antigua_ord_tort, angulo_radianes; angulo_radianes := Pi * (90-Heading) / 180; antigua_absc_tort := XCor; antigua_ord_tort := YCor; XCor := XCor + distancia * cos(angulo_radianes); YCor := YCor + distancia * sin(angulo_radianes); if posicion_lapiz = 1 then dib:={op(dib),CURVES([[evalf(antigua_absc_tort), evalf(antigua_ord_tort)],[evalf(XCor),evalf(YCor)]], PenColor)} fi; NULL; end: #Forwd

14

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

TurnRight:=proc(angulo:algebraic) global Heading; Heading := Modu(Heading + angulo); NULL; end: #TurnRight

FullScreen:=proc() PLOT(op(dib),AXESSTYLE(NONE),SCALING(CONSTRAINED)); #New 2020 end: #FullScreen

15

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• The list of primitives implemented in Maple were: Forwd(n:algebraic): Back(n:algebraic): SetPosition(xl:algebraic,x2:algebraic): SetX(xl:algebraic): SetY(x2:algebraic): Home(): ClearScreen():

TurnRight(ang:algebraic): TurnLeft(ang:algebraic): SetHeading(ang:algebraic): SetHeadingTowards(xl:algebraic, x2:algebraic):

PenUp(): PenDown(): SetPenColor(color): Dot(x1:algebraic, x2:algebraic): FullScreen():

16

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

3. THE ORIGIN OF THIS WORK • The first and second authors (husband and wife) have a teenager son that was very disappointed when a lockdown was ordered in Spain (at the beginning of the pandemic). • It wasn’t easy to explain to him why he should stay at home (without meeting his friends and relatives). • Therefore we decided to develop a visual, simplified explanation of virus propagation (in the form of a tale and a video). • Both were focused, supervised and polished by the second author (that teaches at a school of communication and information sciences and is used to prepare videos for her students), taking into account the audience (boys and young people).

17

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• The tale and video have an elementary but clear mathematical background: − they use fractals trees:  the number of branches at each level of the tree can be related to the average number of animals infected by each ill animal,  the depth of the tree can be related to the time passed till the animals stop meeting. − they are made visual by using Turtle Geometry, − they insist on the social conscience.

• It was initially implemented in the computer language Scratch 3.

• Scratch’s graphic cursor was used to simulate the animals infected:

18

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

4. THE ORIGINAL TALE • The Spanish versions of the tale and a video are available from the IMI (UCM) web page: https://www.ucm.es/imi/other-activities (you can find two screenshots below).

• The original English tale is included in: Eugenio Roanes-Lozano & Carmen Solano-Macías. Using fractals and Turtle Geometry to visually explain the spread of a virus to kids: a STEM multitarget activity. (Submitted). (you can also find two screenshots below).

19

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

20

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

21

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

An illustrated tale of fractals, cats and virus for kids

by Eugenio Roanes Lozano

Coco is a cat that returns sick to his town after a trip. You can see him in the photograph beside. He is suffering from a very contagious disease and he wants to meet his friends and family, since he has missed them so much. Coco doesn’t know anything about fractals, he just wants to share some sardines with his family and to chase some mice with is mates later. Anyway, we’ll use fractals and the computer language Scratch to show him why he shouldn’t meet his family and friends, that he should remain isolated. (…)

22

E. Roanes-Lozano C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

Let us explain in a simplified way what happens if poor Coco meets his friends and family. In this illness a sick cat infects an average of two other cats. In all drawings Coco is in the center. If before all cats isolate themselves, it only takes time for Coco to see his friends, we have three sick cats:

If Coco meets his friends, and these in turn meet their friends before stopping meeting other cats (depth 2), the number of sick cats is 7:

E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

5. The Maple version • The Maple version is available from MaplePrimes (and has a much better definition):

24 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

WHY STAYING AT HOME IS GOOD TO AVOID THE SPREAD OF A VIRUS? A TALE OF FRACTALS, CATS AND VIRUS Eugenio Roanes Lozano

Hi. My name is Eugenio and I’m a Professor at the Departamento de Didáctica de las Ciencias Experimentales, Sociales y Matemáticas at the Facultad de Educación of the Universidad Complutense de Madrid (UCM) and a member of the Instituto de Matemática Interdisciplinar (IMI) of the UCM. I have a 14-year-old son. In the beginning of the pandemic, a confinement was ordered in Spain. It is not easy to make a kid understand that we shouldn't meet our friends and relatives for some time and that we should all stay at home in the first stage. So, I developed a simplified explanation of virus propagation for kids, firstly in Scratch and later in Maple, the latter using an implementation of turtle geometry that we developed long ago and has a much better graphic resolution (E. Roanes-Lozano and E. Roanes-Macías. An Implementation of “Turtle Graphics” in Maple V. MapleTech. Special Issue, 1994, 82-85). A video (in Spanish) of the Scratch version is available from the Instituto de Matemática Interdisciplinar (IMI) web page: https://www.ucm.es/imi/other-activities I firstly need to mention a fractal is. A fractal is a geometric object whose structure is repeated at any scale. An example in is Romanesco broccoli, that you perhaps have eaten (you can search for images on the Internet). You can find a simple fractal in the following image (drawn with Maple):

25 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

Notice that each branch is divided into two branches, always forming the same angle and decreasing in size in the same proportion. We can say that the tree in the previous image is of “depth 7” because there are 7 levels of branches. It is quite easy to create this kind of drawing with the so called “turtle geometry” (with a recursive procedure, that is, a procedure that calls itself). Perhaps you have used Scratch at school (or Logo, if you are older), which graphics are based in turtle geometry. All drawings along these pages have been created with Maple (Maple is a trademark of Waterloo Maple Inc.).We can easily reform the code that generated the previous tree so that it has three, four, five,… branches at each level, instead of two.

26 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

But let’s begin with a tale that explains in a much simplified way how the spread of a disease works. - o O o - Let's suppose that a cat returns sick to Catland suffering from a very contagious disease and he meets his friends and family, since he has missed them so much. We do not know very well how many cats each sick cat infects in average (before the order to STAY AT HOME arrives, as cats in Catland are very obedient and obey right away). Therefore, we’ll analyze different scenarios: 1. Each sick cat infects two other cats. 2. Each sick cat infects three other cats. 3. Each sick cat infects five other cats

1. EACH SICK CAT INFECTS TWO CATS In all the figures that follow, the cat initially sick is in the center of the image. The infected cats are represented by a red square. • Before everyone gets confined at home, it only takes time for that first sick cat to see his friends, but then confinement is ordered (depth 1)

27 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

As you can see, with the cat meeting his friends and family, we already have 3 sick cats. • Before all cats confine themselves at home, the first cat meets his friends, and these in turn have time to meet their friends (depth 2)

In this case, the number of sick cats is 7. • Before every cat is confined at home, there is time for the initially sick cat to meet his friends, for these to meet their friends, and for the latter (friends of the friends of the first sick cat) to meet their friends (depth 3).

28 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

There are already 15 sick cats... • Depth 4: 31 sick cats.

29 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Depth 5: 63 sick cats.

Next we’ll see what would happen if each sick cat infected three cats, instead of two. 2. EVERY SICK CAT INFECTS THREE CATS • Now we speed up, as you’ve got the idea.

30 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

The first sick cat has infected three friends or family before confining himself at home. So there are 4 infected cats. • If each of the recently infected cats in the previous figure have in turn contact with their friends and family, we move on to the following situation, with 13 sick cats:

31 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• And if each of these 13 infected cats lives a normal life, the disease spreads even more, and we already have 40 !

32 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• At the next step we have 121 sick cats:

33 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• And, if they keep seeing friends and family, there will be 364 sick cats (the image reminds of what is called a Sierpinski triangle):

34 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

4 EVERY SICK CAT INFECTS FIVE CATS • In this case already at depth 2 we already have 31 sick cats.

5 CONCLUSSION This is an example of exponential growth. And the higher the number of cats infected by each sick cat, the worse the situation is. Therefore, avoiding meeting friends and relatives that do not live with you is hard, but good for stopping the infection. So, it is hard, but I stay at home at the first stage too!

35 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Advantage of the Maple implementation: very good resolution (internally the coordinates are stored in exact arithmetic, rounded for plotting): depth 5, 364 cats:

(reminds a Sierpinski triangle)

36 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

• Disadvantage: we can’t stamp the cat image and relate it to the tale…

• The code of the 1994 Maple implementation of Turtle Geometry was included for some years within Maple Share Library (that was included with Maple). It is now available from the authors-

37 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

CONCLUSIONS • The tale has been read and the video has been watched by kids, adults and students of the school of where the first author teaches. It has received a positive response (evaluated in the latter case1). • We believe that mathematics and can be used in fruitful synergy to introduce science concepts in an elementary but accurate way. • The almost forgotten Turtle Geometry is very powerful for certain tasks. • The 1994 Maple implementation of Turtle Geometry has shown its possibilities and advantages (due to its careful implementation and to relying on exact arithmetic instead of floating point arithmetic –something possible because it is implemented on a CAS). THANK YOU!

1 Eugenio Roanes-Lozano & Carmen Solano-Macías: Reflective discourse analysis of a group of pedagogy students regarding an awareness video on COVID-19 propagation. (Submitted).

38 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

REFERENCES

Abelson, H., & DiSessa, A. A. (1981). Turtle Geometry: The computer as a Medium for Exploring Mathematics. Cambridge: The MIT Press. https://bit.ly/2FcO2QQ Boiten, E. A. (2004). Turtle Graphics: Exercises in Haskell. Canterbury: University of Kent. https://bit.ly/2AqY6l2 Boytchev, P. (2014). Logo Tree Project. Retrieved from https://bit.ly/2s6MC1y Cabezas, J., & Hernández-Encinas, L. (1988). Geometría esférica en logo. Gaceta matemática, (1), 13-24. https://bit.ly/2Tu7sDU Cotter, C. (1998). Turtle Graphics Interface for REDUCE Version 3. Retrieved from https://bit.ly/2VvOZbz Garcia, D., Segars, L., & Paley, J. (2012). Snap! (build your own blocks): tutorial presentation. Journal of Computing Sciences in Colleges, 27(4), 120-121. https://bit.ly/2C2jLAd Give'on, Y. S. (1991). Teaching recursive programming using parallel multi-turtle graphics. Computers & Education, 16(3), 267-280. https://doi.org/10.1016/0360-1315(91)90061-U Harvey, B. (1997). Computer Science Logo Style: Symbolic Computing (Vol. 1). Cambridge: MIT Press. https://bit.ly/2LOCW4X Harvey, B., & Mönig, J. (2017). Snap! Reference manual. Retrieved from https://bit.ly/2TvzK0L

39 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

Kafai, Y., & Resnick, M. (1996). Constructionism in practice. Designing, thinking and in a digital world. Mahwah: Lawrence Erlbaum Associates. Kutzler, B., & Stoutemyer, D. R. (1997). Great TI-92 Programs (Vol. 1). Austria: bk teachware. Lechner, J., Roanes-Lozano, E., Roanes-Macias, E., & Wiesenbauer, J. (1997). An implementation of Turtle Graphics in Derive 3. The Bulletin of the Derive User Group, 25, 15-22. Lifelong Kindergarten Group. (2013). Getting Started with Scratch 2.0. Available from https://bit.ly/2JHEzyQ Neuwirth, E. (2001). Turtle Ballet: Simulating Parallel Turtles in a Nonparallel LOGO Version. In G. Futschek. (Eds.), European Logo conference Eurologo 2001, a turtle odyssey (pp. 263-270). Austria: Osterreichische Computer Gesellschaft. Papert, S. (1980). Mindstorms: Children, computers, and powerful ideas. New York: Basic Books. Rachum, R. (2011). PythonTurtle. Retrieved from https://bit.ly/2t0hAbi Resnick, M. (1995). New paradigms for computing, new paradigms for thinking. In A. A. diSessa, et al. (Eds.), Computers and exploratory learning (pp. 31-43). Berlin, Heidelberg: Springer. Resnick, M. (1997). Turtles, termites, and traffic jams: Explorations in massively parallel . Cambridge: MIT Press. Roanes-Lozano, E. (2018). Geometría de la tortuga con Scratch 2.0 & enseñanza de matemática elemental. Madrid: Universidad Complutense de Madrid. Disponible en https://bit.ly/2F9y88Y

40 E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics package

Roanes-Lozano, E., & Roanes-Macías, E. (1994a). An implementation of “Turtle Graphics” in Maple V. Maple Technical Newsletter, 1994 Special Issue, 82-85. https://bit.ly/2Av4Det Roanes-Lozano, E., & Roanes-Macías, E. (1994b). Nuevas tecnologías en Geometría. Madrid: Editorial Complutense. https://bit.ly/2Rv5iGp Roberts, R. (1987). Power of Turbo PROLOG: The Natural Language of . New York: McGraw-Hill Professional. https://bit.ly/2RuvO2V Sancho, F. (2012). NetProLogo. Retrieved from https://bit.ly/2LXjvGV Sims-Coomber, H., Martin, R., & Thorne, M. (1991). A non-Euclidean implementation of LOGO. Computers & Graphics, 15(1), 117-130. https://doi.org/10.1016/0097-8493(91)90038-J Sims-Coomber, H., & Martin, R. (1994). An implementation of LOGO for elliptic geometry. Computers & graphics, 18(4), 543-552. https://doi.org/10.1016/0097-8493(94)90068-X

Wilensky, U. (2013). NetLogo 5.0.5 User Manual. Retrieved from https://bit.ly/2GUQtJs

41