A Simplified Introduction to Virus Propagation Using Maple's Turtle Graphics Package
Total Page:16
File Type:pdf, Size:1020Kb
E. Roanes-Lozano, C. Solano-Macías & E. Roanes-Macías.: A simplified introduction to virus propagation using Maple's Turtle Graphics 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 robots 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.t. 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. computer algebra systems (CAS): Macsyma/Maxima, Reduce, Maple, Mathematica, Axiom, CoCoA, Singular, Sage, Xcas, 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