LISP-STAT. and Dynamic Graphics. An Object-Oriented Environment for Statistical Computing LUKE TIERNBY JOHN WILEY & SONS

Size: px
Start display at page:

Download "LISP-STAT. and Dynamic Graphics. An Object-Oriented Environment for Statistical Computing LUKE TIERNBY JOHN WILEY & SONS"

Transcription

1 LISP-STAT An Object-Oriented Environment for Statistical Computing and Dynamic Graphics LUKE TIERNBY School of Statistics University of Minnesota Minneapolis, Minnesota A Wiley-Interscience Publication JOHN WILEY & SONS NewYork / Chichester / Brisbane / Toronto / Singapore

2 This Page intentionally left blank

3 LISP-STAT

4 This Page intentionally left blank

5 LISP-STAT An Object-Oriented Environment for Statistical Computing and Dynamic Graphics LUKE TIERNBY School of Statistics University of Minnesota Minneapolis, Minnesota A Wiley-Interscience Publication JOHN WILEY & SONS NewYork / Chichester / Brisbane / Toronto / Singapore

6 Macintosh is a trademark of Macintosh Laboratory, Inc., licensed to Apple Computer Inc. Postscript is a trademark of Adobe Systems Inc. SuoView is a trademark of Sun Micmsystems, Inc. TJNM is a registered trademark of AT&T. X Window System is a trademark of the Massachusetts Institute of Technology. In recognition of the importance of preserving what has been written, it is a policy of John Wdey & Sons, Inc. to have books of enduring value published in the United States printed on acid-free paper, and we exert our beat efforts to that end. Copyright by John Wdey 8a Sons All rights reserved. Published simultaneously in Canada. Reproduction or translation of any part of this work beyond that permitted by Section 107 or 108 of the 1976 United States Copyright Act without the permission of the copyright owner is unlawful Requests for permission or further information should be addressed to the Permissions Department, John Wdey & Sons, Inc. Library of Congrena Cataloging in Publication Dato: Tierney, Luke. Lisp-Stat: an obj&a3ented environment for statistical computing and dynamic graphics I Luke Tierney. p. ern - Wley series in pmbabixity and mathematical statistics. Applied pmbability and statistics, ISSN ) "A Wiley Interscience publication." Includes bibiiographica1 refmnces. ISBNo Lispstat (Computer prugram) 2. XLisp-Stat (Computer program) 3. Mathematical statistics -Data processing. 4. USP (Computer program language) 5. Objeetoriented pmgramming (Computer science) I. Title. XI. Series QA276.4.W W=M CIP

7 Contents Preface xi 1 Introduction Environments for Statisticd Computing The I. ispstat Environment Why Lisp? Using Lispstat Some Design and Portability Issues The Future of LispStnt A Lispstat Tutorial The Lisp Interpreter Elementary Computations and Graphs One-Dimensional Summaries and Plots Two-Dimensional Plots Plotting Functions More 011 the Interpreter Saving Your Ubrk A Command History hfcchanisrn Getting Help Listing and Undefining Variables Interrupting a Calculation Some Data-Handling Functions Generating Systematic Data Generating Random Data Forming Subsets and Deleting Caws Combining Several Lists Modifying Data Reading Data Files DynamicGraphs Spinning Plots Scatterplot Matrices Interacting with Individual Plots V

8 vi Linked Plots Modifying a Scatterplot Dynamic Simulations Regression Defining Functions and Methods Defining Functions Functions as Arguments Graphical Animation Control Defining Xfethods More Models and Techniques Nonlinenr Regression Maximization and Lfaximum Likelihood Estimation Approximate Bayesian Computations Programming in Lisp 3.1 Writing Simple Functions Predicates and Logical Expressions Conditional Evaluation Iteration and Recursion Environments Some Terminology Local Variables Local Functions... Functions and Expressions as Data Anonymous Functions Using Function Arguments Returning Functions as Resillts Expressions as Data Mapping Assignment and Destructive Modification Equality Some Examples Newton's Method for Finding Roots Symbolic Differentiation... 4 Additional Lisp Features 4.1 Input/Output The Lisp Reader Basic Printing Functions Format Files and Streams Defining hfore Flexible Functions Keyword Arguments Optional Arguments Variable Number of Arguments

9 4.3 Control Structure Conditionai Evaluat. ion Looping Basic Lisp Data and Functions Numbers Strings and Characters Synibols Lists Vectors Sequences Arrays Other Data Types Odds and Ends Errors Code-Writing Support Debugging Toois Timing De set.f Special Variables Statistical Functions 5.1 Compound Data Compound Data Properties Vectorized Arithmetic Data-Handling Functions Basic Operations Sorting Functions Interpolation and Smoothing Probability Distributions Array and Linear Algebra Functions Basic Matrix and Array Functions Matrix Multiplication Linear Algebra Functions Regression Computation Functions Some Examples Constructing a Projection Operator Robust Regression Object-Oriented Programming Some Motivation Objects and Messages Basic Structure and Terminology Construct.irlg Kew Objects Defining New Methods Printing Objects

10 ... Vill COXTENTS 6.3 Prototypes aud Inheritance Constructing Prototypes and lnstances Prototypes Inheriting from Prototypes Overriding and Modifying Inherited Methods Additional Details Creating Objects and Prototypes Additional Methods and Functions Shared Slots The Object Documentation System Saving Objects Some Built-in Prototypes Compound Data Objects Linear Regression hiodeiv Nonlinear Regression Models Multiple Inheritance Other Object Systems SomeExamples A Rectangular Data Set An Alternate Data Representation Windows. Menus. and Dialogs The Window System Interface Windows Menus Dialog Windows Some Standard Modal Dialogs hlodeless Slidcr Dialogs Constructing Custotn Dialogs The Dialog Prototypes Dialog Items Additional Details Graphics Windows The Graphical Model Coordinates. Drawing hlodes. and Colors Drawable Objects Graphical Messages Initialization and State Messages Basic Drawing Xlessages Additional Messages Double Buffering and Animation Responding to Events Resize and EX~OSLUF Events Mouse Events Key Events

11 CONTEXTS ix Idle Acticms hlenus Additional Features Canvas Dimensions Clipping Saving Graphs Adding New Colors Adding Sew Cursors An Example Statistical Graphics Windows The Graph Prototype Constructing a New Graph Adding Data and Axes Scaling and Transformatiom blouse Events and Mouse Modes Linking Window Layout, Resizing, and Redrawing Plot Overlays hleniis and Menu Items Miscellaneous hfessages Some Standard Graph Prototypes Scatterplots Scstterplot Matrices Rotsting Plots Histograms Xame Lists Somc Dyiramic Graphics Examples 297 :0.1 Some Animations cJ.1.1 Anocher Lock at Power Transformations Plot Iriterpoiation Choosing a Smoothing Parameter tlsing New hlouse Modes Sensitivity in Simple Linear Regression Hand Rotation Graphical Function Input Plot Control Overlays A Press Button Control Two-Button Controls GrnndTours Parallel Coordinate Plots An Alternative Linking Strategy Bibliography 34 1

12 X CUNTENTS A Answers to Selected Exercises The XLISP-STAT Implementation 355 B.1 Obtaining the XLISP-STAT Software B.2 XLISP-STAT on the Macintosh B.2.1 Basics B.2.2 Menus B.2.3 Windows B.2.4 More Advanced Features B.3 XLISP-STAT on UNIX Systems B.3.1 XLISP-STAT under Xll XLISP-STAT under SmView B.3.3 Running UNIX Commands from XLISP-STAT B.3.4 Dynamic Loading and Foreign Function Calling B.4 Some Additional Features Index 371

13 Preface This book describes a statistical environment called Lispstat. As its name suggests. LispStat is based on the Lisp language. It includes support for vectorized arithmetic operations. a comprehensive set of basic statistical op erations, an object-oriented programming system, arid support for dynamic graphics. The primary objective of this book is to introduce the LispStat system and show how it can be used as an effective platform for a large number of statistical computing tasks, ranging from basic calculations to customizing dynamic graphs. -4 further objective is to introduce object-oriented programming and graphics programming in a statistical context. The discussion of these ideas is based on the LispStat system, so readers with access to such a system can reproduce the examples presented here and use them as a basis for further experimentation. But the issues presented are more general and should apply to other environments as well. This book can be used as a supplement to several courses on statistical computing and computational statistics. A course emphasizing the use of different programming paradigms could be based on the material in Chap ters 3-6. A course on dynamic graphics could use primarily the material in Chapters Prerequisites The statistical background assumed for most of the book is a solid undergraduate sequence in statistical theory and methods. including basic regression analysis. A few sections assume somewhat more; these sections indicate the background they require. No prior knowledge of Lisp is assumed. Some experience with a programming language like FORTRAN or C, or with a statistical system like S [6,71, would be helpful but is not essential. Notational Conventions Throughout this book mathematical synibols and formulas are written in italics. Iike 5 and x + y. Lisp symbols and expressions are written in a xi

14 xii typewriter font, like x and (+ x y). shown as PREFACE Interactions with the comput,er are The prompt > is typed by the computer. The expression (+ 1 2) and the return. at the end of the line are entered by the user. and t.he answer 3 is then typed by the computer. Several features described in this book are available in any Lisp system, some are peculiar to particular Lisp dialects like Common Lisp, and some arc only available in a Lisp-Stat syst.em. I have attempted to identify these situations consistently by describing a feature as a Lisp. Common Lisp, or LispStat feature, respectively. Software Availability As with any book on computing, you will benefit most from reading this book if you can try out and experiment with the examples. Most sections also contain some exercises to try on a LispStat system. At the time of writing, there is one implementation of LispStat. called XLISP-STAT. This implementation is based on the XLISP dialect of Lisp, a subset of Common Lisp developcd by David Betz [ 10,111. Versions of XLISP- STAT are available for the Apple Ilacintosh, for Sun workstations, and for many workstations running the UNIX operating system and the X1 1 window system. A nongraphics version for generic UNIX systems is available as well. Further details on obtaining the XLISP-STAT system are given in Appendix B.1. Version 2.1 of XLISP-STAT corresponds t.0 t.he description in this book. Earlier versions may deviate from the description in some respects. IUustrat,ions reproduced in this book are taken from the Macintosh version of XLISP-STAT. Acknowledgments Many of the functions included in LispStat were motivated by similar functions in the S system [6,7]. Several of the examples used in this book have been taken from the introductory statistics text by Devore and Peck [26]. A number of programming examples have been adapted from examples in Abelson and Sussman [l]. Several ideas in the tutorial chapter were borrowed from Gary Oehlert's MucAaowa User's Guzde [47). The XLISP-STAT help system is patterned after the help system prwided by Kyoto Common Lisp. Work on LispStat was supported in part by grants from the Minnehlac Project at the University of Minnesota, by a single quarter leave granted by the University of Minnesota, by grant DhfS from the National

15 Science Fordation. and by a research contract with Bell Communications Research. hluch of the work on this book was completed during a visit to the Statistics and Economics Research Division at Bellcore in the fall of I would like to express iny gratitude to Bellcore for their hospitality and support. I would like to thank Doug Bates, Rick Becker, Andrea5 Ruja, Kathryn Chaloner, John Chanihers. Dennis Cook. Rich Faldowski, Jim Harner, David Harris. Jay Kadane, Jim Lindsey. U'ei-Yin Loh, Sharon Lohr. Michael Meyer, Gary Oehlert, Ron Pmitt. Anne Steuer. Debbie Swayne, Paul Tukey, Sandy iveisberg, Allan Wilks. and Forrest Young for cominents and suggestions that have lead to irriprovemeiits in the Lisp-Stat system and in the presentation of this book. I am particularly grateful tu Jini Harner for his careful reading of the manuscript. Finally, I would like to thank David Betz for developing XLISP and making the source code publically available. LUKE TIERNEY

16 This Page intentionally left blank

17 LISP-STAT

18 This Page intentionally left blank

19 Chapter 1. Introduction 1.1 Environments for Statistical Computing In the early days, statistical computing was mostly concerned with calculating numbers. Computers were slow and had to be programmed carefully, at a fairly low level, to get reasonable performance. As a result, most early statistical systems were simple front, ends to efficient but rigid numerical algorithms. Users of these systems would submit requats for calculations, and would receive t.heir results later the same day or on t.he following day. As computers have become faster and cheaper, it is now possible to do in seconds or minutes comput.ations that used to take hours or days. This presents new challenges to statistical software. Since computing hardware is now able to perform many different calculations and analyses in a short period of time: a supportive statistical software environment. has to make it easy to express different computations to the computer. to pass results of one computation on to another, to examine results, and to keep track of computations. Furthermore, as it becomes apparent that some series of computations is used repeatedly, perhaps with minor variations, it should be possible to build a simple abstraction for describing and requesting that series of computations as a unit. In short, to complement the capabilities of modern hardware, statistical environments must become interactive statistical languages. -4nother important development has taken place in parallel to the increase in raw computational speed. More and more statistical computing is done on personal computers and workstations equipped with high-resolution bitmapped displays. This display hardware opens up many new opportunities. One of the most exciting areas of activity in statistical research is the field of dynamic computer graphics and its use in statistics. Graphical methods have been an important tool in statistics for many year;. But an inherent limitation of traditional, two-dimensional graphics is that they cannot easily represent more than two-dimensional information. The ability of modern 1

20 2 CHAPTER 1. INTRODUCTION computer displays to show a rapidly changing series of two-dimensional plots opens up a third dimension: time. Dynamically changing plots can take several forms, ranging from syst,ematic changes in a rotating point cloud to changes determined interactively by brushing operations in which points highlighted in one plot are simultaneously highlighted in several other plots. Many interesting ideas for dynamic graphical displays have been proposed in recent years f201. But to assess the full potential of these ideas, and to determine fruitful direct.ions for future development, the new methods need to be made available to a wide range of users and tested in a variety of situations. Most dynamic graphical techniques proposed to date have been implemented on specialized hardware, often using complex programming methods. As a result, very few statisticians have been able to explore the use of these methods in practice, and still fewer have had the opportunity to experiment with variations on these methods. To support progress in this area, a statistical environment needs to implement standard dynamic graphical methods such as point cloud rotation and also provide a.set of basic dynamic graphics building blocks that can be used to implement new ideas easily and portably. Recent experience has shown that a new programming paradigm, objectoriented programming, is very useful for graphics programming in general and statistical graphics programming in particular [58,45]. Object-oriented methods also have many other applications within a statistical system. They can be used for developing flexible data structures [44,58] and for representing statistical models [48]. Tools for graphics programming and ob ject-oriented programming are only two of many features needed in a modem statistical environment. 0thers include the ability to handle "nonstandard" statistical data. Standard data are lists or collections or' numbers. Most data sets can be represented by such collections. Within the context of linear models, different models can also be represented by coilections of numbers: the model coefficients and the matrix of predictors. But once a more general class of models is considered, it becomes difficult, if not impossible, to find numerical representations of different models. For example, a system for fitting nonlinear regression models would be severely limited if it required that the nonlinear mean function be selected from some fixed set of families. In this case it is necessary to be able to specify the mean function in a more general way. either as a procedure for evaluating the mean response for different parameter vdues, or as an expression. Once a language permits the use of such non-numerical data many new opportunities are opened up. For example, it becomes possible to have programs examine model expressions, compute expressions for derivatives, or try to determine structure that leads to simplifications in computation or interpretation.

21 1.2. THE LISP-STAT EN E?RONkfELVT The Lisp-Stat Environment The requirements outlined above suggest that a flexibie, mociern statistical environment must be embedded in a high-level, interactive programming language. Two approaches can be taken in developing such an environment. The first approach. taken by the S system [6,7], is to develop a new. high-level language from scratch. The second approach is to adapt an existing language for statistical computation. The language most often suggested is Lisp. LispStat represents an attempt to develop a complete Statistical environment based on the Lisp language. It consists of a Lisp syst,em with modifications to standard Lisp functions to support vectorized arithmetic, additional functions for basic statistical computations, an interface to a window system, and tools for constructing graphs, in particular dynamic graphs, within this window system. LispStat also contains an object-oriented programming system that is used to support graphics programming and to represent statistical models, such as linear and nonlinear regression models. LispStat is not a single system or implementation. Instead, it is a specification of a set of essential ingredients that can be implemented using a variety of Lisp system and window system combinations. At the time of writing, one LispStat implementation exists, a system called XLISP-STAT. This system is based on the XLISP dialect of Lisp, and can be used with the hfacintosh or the X11 window systems. Over time, other implementations may become available. Versions of XLISP-STAT for use in several other window systems are currently being developed. A Common Lisp version of LispStat is also under deyelopment Why Lisp? Lisp is a very rich general purpose programming language that is ideally suited for interactive, experimental programming. It allows the use of functions as data, and it is capable of supporting a number of different programming paradigms, including object-oriented programming. These points have lead to the use of Lisp as a tool for introducing basic programming concepts in computer science classes [l]. and have lead a number of authors to use and recommend Lisp as an ideal base environment for statistical computing [45,48,58]. Lisp is act ually quite an old language. It is the second oldest language in use today, second only to FORTRAN. Over the years a number of different Lisp dialects have developed, but since the early 1980s the Lisp community has been converging towards using a single dialect, Common Lisp [56]. Many excellent Common Lisp systems are now available. and code produced by Common Lisp compilers is competitive in speed with compiled C and FOR- TRAN code. A LispStat system is assumed to he based on the Common Lisp dialect., or a reasonable subset of Common Lisp. AH aspects of the Lisp language that are used in this book are described

22 4 CHAPTER I. IXTRODUCTIOX here. primarily in Chapters 3 and 4. But there are many other features of the language that are not described or are only mentioned briefty. If you would Iike to explore the Lisp language further, there are several excellent books available. The definition of the Common Lisp language is given by Steele [56]. A complete documentation of all Common Lisp functions is contained in Two good introductions to the Common Lisp language are Winston and Horn IS71 and Tater [59]. Several other languages have been suggested and used as the basis for statistical environments. A language that has received considerable attention is APL [3]. APL has many useful features? including a wide range of functions for handling matrices and arrays. But it does not have the ability to easily handle high-level data, such as functions or expressions, nor does it lend itself readily to supporting the object-oriented programming style that is so important for graphical programming. Adding these features to APL appears to be considerably harder than adding matrix and array functions to Lisp Using Lisp-Stat A LispStat system can be used at a nuinber of different levels, ranging from a basic statistical calculator and plotter to a platforni for designing graphical user interfaces for statistics. The orgmization of this book is based on the natural progression through these levels. Chapter 2 describes how to use LispStat es a statistical calculator and plotter. Much can be accomplished by using LispStat at this level. You can enter data, compute summary statistics, produce static and dynamic plots; and fit regression models. The commands used for these calculations. such as (mean precipitation) and (ataadard-deviation precipitation) to calculate the mean and standard deviation of a data set precipitation. happen to be Lisp expressions. But this does not mean you have to learn a large amount of Lisp before you can start to use Lispstat. By learning a few basic commands. much like the basic commands in any other statistic4 system, you can start to analyze data in a matter of minutes. But there are a number of benefits that derive from the fact that commands in LispStat are Lisp expressions. Even though you do not need to know Lisp to stai-t using Lispstat, as you learn to use the system you are learning the basics of Lisp. Having learned how to calculate means and standard deviations. it is a small step to calculating a st,andardized variable by an expression of the form (/ (- precipitation (mean precipitation)) (standard-deviation precipitation))

23 If you find that you often want to standardize a variable, then it is again a small step to encapsulating this process into a function defined by (defun standardize (XI (/ (- x (mean XI) (standard-deviation XI)) The transition from using Lisp-Stat as a calculator to customizing the system by writing your own functions is very natural and is outlined in the final sections of Chapter 2. The tools described in Chapter 2 are already quite powerful. But you can do much more than simply combine a few operation into a new function. Using the Lisp programming language. you can implement new algorithms and design functions for fitting new classes of models. To take full advantage of these capabilities. you need to learn about the basic control structures and functions provided by Lisp and LispStat. Chapter 3 introduces control structures, such as conditional evaluation constructs. and also describes some of the programniing styles that are frequently used in Lisp programming. Chapter 3 presents a number of additional standard Lisp functions, and Chapter 5 describes the statistical functions included in Lispstat. LispStat plots and regression models are implementtxi using an objectoriented programming system. Chapter 2 gives a brief introduction to the use of objects, and Chapter 6 presents a more detailed description of both the LispStat object system arid the ideas behind the object-oriented paradigm. The LispStat object system is the foundation of the LisyStat window system described in Chapter 7. In addition to forming the basis of the graphics system, the window system provides access from within LispStat to graphical user interface tools such as menus and dialogs. The graphics system consists of two additional layers built on top of the window system. The first layer. described in Chapter 8, contains tools needed to draw images on the screen. The second layer, presented in Chapter 9. contains support for managing plot data and standard interact ion techniques. The LisyStat graphics system can be used in many different ways. Simple animations, such a a normal probability plot controlled by a scroll bar for interactively changing the power in a power transformation. can be constructed easily- using only the tools introduced in Chapt.er 2. The menu and dialog objects described in Chapter 7 can be used to design a graphical interface to a set of functions or a set of modeling tools. The objects and ideas prescoted in Chapters 8 and 9 can be used either to cltstoniize standard plots in minor ways or to develop entirely new types of plots. Chapter 10 presents several examples that illustrate the range of possibilities. A good strategy for using Lispstat is to start by interactively trying out some expressions at the keyboard. Once you identify a set of expressions or operations that fit together naturally, you can encapsulate them by defining a new function or a new type of object. This new function or object, can then be used as a basic building block in further explorations. This strategy is

24 6 CHAPTER I. IN'TRODCrCTiON useful whether you are exploring a new data set, a new numerical technique, or a new graphical idea. The ability to move easily through a series of exploration and encapsulation steps is one of the keys to the power of an interactive statistical environment like LispStat Some Design and Portability Issues A general objective in designing LispStat was to develop a system that can be used interactively on a wide range of computers. Several design decisions and compromises needed to be made in order to achieve this objective. User Interface Variations A major issue in designing a graphical system to work on a range of different computers is the differerice among user interface designs. For example, the Macintosh interface usually places menus in a menu bar, whereas many other interfaces pop up menus when the mouse is clicked in a window. To d d with this issue, I have tried to design the LispStat graphics system around a few general conventions, leaving the details of the interface to a particular implementation. For example, the Lisp-Stat graphics system assumes that each plot has a menu for controlling it. From within LispStat the menu is treated identically across all implementations. Individual implement ations are responsible for such details as determining when to prosent the menu to the user. On a Macintosh the menu might be placed in the menu bar when the plot is the front window. On other systems the menu might be popped up when a particular mouse button is clicked in the plot window. The advantage of using only a few general interface features is that Lisp- Stat code can be written to run on a wide range on computers. The disadvantage is that it is not possible to exploit all the features offered by a particular interface. Fortunat.ely, most graphical user interfaces are quite similar and little is lost by adhering to a common denominator. Operating System Variations Differences among operating systems lead to variations among LisgStat sys tems whenever LispStat needs to interface to the operating system. This occurs when LispStat starts up and when a file is accessed. Each version of LispStat should include information on how to start LispStat from the operating system arid on the naming conventions for files and directories. On some operating systems it may be possible to call other operating system commands from within LispStat or to link code written in other languages into LispStat. The details will differ from one operating system to another.

25 1.2. THE LISP-STAT ELWIRONMENT 7 Different Lisp Systems The ideal base for LispStat is a Common Lisp system. Unfortunately, Common Lisp systems can be rather expensive. Some Common Lisp systems also do not work well with the amount of memory available on most microcomputers and workstations. The subset of Common Lisp provided by XLISP is adequate to support a LispStat system; the most important Common Lisp feature that is not provided in XLlSP is a compiler. Since XLISP is available free of charge, it is possible to make a version of LispStat based on XLISP available free of charge as well. The Hardware Model Like the user interface model. the hardware model used in designing Lisp- Stat is based on a greatest common denominator. It assumes a computer has a bitmapped display and a pointing device. It does not assume any special purpose hardware, such as hardware support for depth cuing or double buffering. A LispStat implementation can take advantage of hardware double buffering without changing the way LispStat views the hardware: but, some changes would be needed to take advantage of hardware depth cuing. It remains to be seen whether such modifications are worthwhile The Future of Lisp-Stat LispStat is an evolving system. Its objective is to provide an environment for statistical computing that takes full advantage of the computational speed and graphical capabilities of modern computing hardware by 0 providing it useful set of programming tools for numerical statistical computing 0 providing n franiework for using higher-level data such as functions and expressions 0 providing a set of useful building blocks for customizing and developing dynamic graphical methods Experience in using LispStat and new developments in statistid methodology and in computing hardware will lead to modifications and additions to the system. As LispStat evolves. new versions should remain compatible with previous ones whenever possible.

26 This Page intentionally left blank

27 Chapter 2 A Lisp-Stat Tutorial This chapter is interded as an introduction to using Lisp-Stat M a statistical calculator and plotrter. After introducing basic numerical operations and plots, it shows how to construct random or systematic data sets, how to modify data sets, how to use some built-in dynamic plots, and how to construct linear regression models. The final two sections give a brief introduction to writing frrrtctions of your own, and to some more advanced modeling tools that iise funct,ional data. 2.1 The Lisp Interpreter Your interaction with a Lisp-Stat system consists of a conversation between you and the Lisp interpreter. Imagine you are sitting at your computer and have started your system. Or better yet* get a version of LispStat and start it up. \Vheti it is ready to start the conversation. it gives you a prompt like > at the beginning of n blank line. If you type in an expression, the interpreter responds by printing the result of evaluating that expression. For example, if you give the interpreter a number and type retwn, then it responds by simply printing the riiiinber back to you on the following line and then gives you a new prompt. Operations on numbers can be performed by combining numbers and a symbol. representing an operation, into cclmpound espressians like (+ 1 2) : > (+ 1 2) 3 9

28 10 CHAPTER 2. A LISP-STAT TUTORIAL As you have probably guessed, this expression means that the numbers 1 and 2 are to be added together. The notation in which the operator is placed before the operands is called pjix notation. This notation may be confusing at first, since it departs from standard mathematical practice, but it does offer some significant advantages. One advantage is that operations taking an arbitrary number of arguments can be accommodated. For example, > ( ) 6 > (* ) To understand how the interpreter works, the basic rule to remember is that everything is evaluated. Embers evaluate to themselves': > > > -1-1 Severd ot,,er basic forms of data evaluate to themselves as well. These include logical values > t T > nil NIL ; true ; false and strings > "This is a string " "This is a string " always enclosed in doubie quotes. The semicolon ";'' is the Lisp comment character. Anything you type after a semicolon, up to the next time you type a return, is ignored by the interpreter. If the interpreter is given a symbol, like Pi or this-is-a-symbol 'When typing a negative number, be sure not to leave any space between the minus sign and the number, or the interpreter will get confused.

29 2.1. THE LISP INTERPRETER 11 to evaluate, it checks if there is a value associated with the synibol, and returns that value if there is one: > pi If there is no value associated with the symbol. the interpreter signals an error: > X error: unbound variable - X The synibol pi is predefined as an approximation to the number?r. At this point the symbol x does not have a value. We will see how to give a symbol a value in the npxt section. When typing a symbol s name vou can use either upper case or lower case letters. Lisp internally converts lower caw letters in a symbol s name to upper case. Evaluating compound expressions is a bit more complicated. A compound expression is a list of elenients separated by whzte space (spaces, tabs, or returns) and enclosed in parentheses. The elements of the list can be strings. nunibers. or other compound expressions. In evaluating a compound expression like ( ) the interpreter treats the list as representing a functzon upplzcation. The first element of the list represents a Lisp function, a piece of code that can be applied to some arguments and that returns a result. In this case the function is the addition function, represented by the symbol +. The remaining elements of the list are the arguments; here the arguments are the numbers 1, 2 and 3. FVhen asked to evaluate this expression, the interpreter takes the addition function, applies it to the arguments. and returns the result: > ( ) 6 The arguments to a function are always evaluated before the function is applied. In the previous example the arguments were all numbers and thus evaluated to themselves. But in > (+ (* 2 3) 4) 10 the interpreter has to evaluate the first argument (* 2 3) to the function + before it can apply the function. Numbers, strings, and symbols are some of the basic data types avuilable in Lisp. I will refer to these basic data types jointjy as szrnpl~ data. In addition, Lisp provides several methods for forming more complex data structures. called cornpound data. The most basic form of coinpound data is the list. A list can be constructed using the list function:

30 12 CHAPTER 2. A LISP-STAT TUTORIAL > (list ) ( ) The result printed by the interpreter looks a lot like the compound expressions we have been using: a sequence of elements separated by white space and enclosed in parentheses. In fact, Lisp expressions are simply Several other fornis of compound data are available as well, including vectors and multi-dimensional arrays. These are described in Section 4.4. Before going on to our first statistical applications, let's look at one more feature of the interpreter. Suppose we would like the interpret>er to print the list (+ 1 2) back at us. Typixig the list directly into the interpreter won't work because the interpreter will insist on evaluating the list: > (+ 1 2) 3 The solution is t.o tell the interpreter not to evaluate the list. This process is called quoting. It is like putting quotation marks around an expression in a written sentence t.o say: take this expression 1it.erally. For example, using quotation marks gives the two sentences and Say your name! Say 'L;your name"! very different meanings. Here is how you would quote our expression in Lisp: > (quote (+ 1 2)) (+ 1 2) quote is not a function. It does not obey the rules of function evaluation described above: its argument is not evaluated. quote is called a special form - special because it has special rules for the treatment of its arguments. I will introduce other special forms as they are needed. Together with the basic evaluation rules described here, these special forms make up the syntax of the Lisp language. The special form quote is used so often that a shorthand notation hm been developed. a single quote placed before the expression: > '(+ 1 2) ; single quote shorthand (+ 1 2) ZThe name Lisp is an acronym for LISt Processing. The language way originally developed as a tool for symbolic computation tasks, such as writing programs to symbolicaliy differentiate an expression.

Dynamic and Interactive Graphics in Lisp-Stat

Dynamic and Interactive Graphics in Lisp-Stat Dynamic and Interactive Graphics in Lisp-Stat Luke Tierney Department of Statistics & Actuarial Science University of Iowa July 31, 2017 Luke Tierney (U. of Iowa) Lisp-Stat Graphics Baltimore: JSM 2017

More information

Basic Programming Language Syntax

Basic Programming Language Syntax Java Created in 1990 by Sun Microsystems. Free compiler from Sun, commercial from many vendors. We use free (Sun) Java on UNIX. Compiling and Interpreting...are processes of translating a high-level programming

More information

The Mathcad Workspace 7

The Mathcad Workspace 7 For information on system requirements and how to install Mathcad on your computer, refer to Chapter 1, Welcome to Mathcad. When you start Mathcad, you ll see a window like that shown in Figure 2-1. By

More information

STEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS

STEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS STEPHEN WOLFRAM MATHEMATICADO OO Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS Table of Contents XXI a section new for Version 3 a section new for Version 4 a section substantially modified for

More information

Excel for Chemists. Second Edition

Excel for Chemists. Second Edition Excel for Chemists Second Edition This page intentionally left blank ExceL for Chemists A Comprehensive Guide Second Edition E. Joseph Billo Department of Chemistry Boston College Chestnut Hill, Massachusetts

More information

LISP. Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits.

LISP. Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits. LISP Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits. From one perspective, sequences of bits can be interpreted as a code for ordinary decimal digits,

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

EES Program Overview

EES Program Overview EES Program Overview EES (pronounced 'ease') is an acronym for Engineering Equation Solver. The basic function provided by EES is the numerical solution of a set of algebraic equations. EES can also be

More information

Excel 2010: Getting Started with Excel

Excel 2010: Getting Started with Excel Excel 2010: Getting Started with Excel Excel 2010 Getting Started with Excel Introduction Page 1 Excel is a spreadsheet program that allows you to store, organize, and analyze information. In this lesson,

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

Word 2010: Preparing Your Dissertation. May 18, 2011

Word 2010: Preparing Your Dissertation. May 18, 2011 Word 2010: Preparing Your Dissertation May 18, 2011 Author: Anne Kolaczyk, Maureen Hogue Editor: Maureen Hogue, Anne Kolaczyk, Susan Antonovitz 2008, 2010. 2011 Office of Information Technologies, University

More information

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Modern Programming Languages. Lecture LISP Programming Language An Introduction Modern Programming Languages Lecture 18-21 LISP Programming Language An Introduction 72 Functional Programming Paradigm and LISP Functional programming is a style of programming that emphasizes the evaluation

More information

COMPUTATIONAL DYNAMICS

COMPUTATIONAL DYNAMICS COMPUTATIONAL DYNAMICS THIRD EDITION AHMED A. SHABANA Richard and Loan Hill Professor of Engineering University of Illinois at Chicago A John Wiley and Sons, Ltd., Publication COMPUTATIONAL DYNAMICS COMPUTATIONAL

More information

Making the Transition from R-code to Arc

Making the Transition from R-code to Arc Making the Transition from R-code to Arc Sanford Weisberg Supported by the National Science Foundation Division of Undergraduate Education Grants 93-54678 and 96-52887. May 17, 2000 Arc is the revision

More information

[CHAPTER] 1 INTRODUCTION 1

[CHAPTER] 1 INTRODUCTION 1 FM_TOC C7817 47493 1/28/11 9:29 AM Page iii Table of Contents [CHAPTER] 1 INTRODUCTION 1 1.1 Two Fundamental Ideas of Computer Science: Algorithms and Information Processing...2 1.1.1 Algorithms...2 1.1.2

More information

Formulas and Functions

Formulas and Functions Conventions used in this document: Keyboard keys that must be pressed will be shown as Enter or Ctrl. Controls to be activated with the mouse will be shown as Start button > Settings > System > About.

More information

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing

More information

STATISTICAL TECHNIQUES. Interpreting Basic Statistical Values

STATISTICAL TECHNIQUES. Interpreting Basic Statistical Values STATISTICAL TECHNIQUES Interpreting Basic Statistical Values INTERPRETING BASIC STATISTICAL VALUES Sample representative How would one represent the average or typical piece of information from a given

More information

PROBLEM SOLVING WITH FORTRAN 90

PROBLEM SOLVING WITH FORTRAN 90 David R. Brooks PROBLEM SOLVING WITH FORTRAN 90 FOR SCIENTISTS AND ENGINEERS Springer Contents Preface v 1.1 Overview for Instructors v 1.1.1 The Case for Fortran 90 vi 1.1.2 Structure of the Text vii

More information

Unit. Programming Fundamentals. School of Science and Technology INTRODUCTION

Unit. Programming Fundamentals. School of Science and Technology INTRODUCTION INTRODUCTION Programming Fundamentals Unit 1 In order to communicate with each other, we use natural languages like Bengali, English, Hindi, Urdu, French, Gujarati etc. We have different language around

More information

An introduction to plotting data

An introduction to plotting data An introduction to plotting data Eric D. Black California Institute of Technology February 25, 2014 1 Introduction Plotting data is one of the essential skills every scientist must have. We use it on a

More information

Class Structure. Prerequisites

Class Structure. Prerequisites Class Structure Procedural abstraction and recursion 6.037 - Structure and Interpretation of Computer Programs Mike Phillips, Benjamin Barenblat, Leon Shen, Ben Vandiver, Alex Vandiver, Arthur Migdal Massachusetts

More information

IT 374 C# and Applications/ IT695 C# Data Structures

IT 374 C# and Applications/ IT695 C# Data Structures IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation

More information

SFU CMPT week 11

SFU CMPT week 11 SFU CMPT-363 2004-2 week 11 Manuel Zahariev E-mail: manuelz@cs.sfu.ca Based on course material from Arthur Kirkpatrick, Alissa Antle and Paul Hibbits July 21, 2004 1 Analytic Methods Advantages can be

More information

9. Elementary Algebraic and Transcendental Scalar Functions

9. Elementary Algebraic and Transcendental Scalar Functions Scalar Functions Summary. Introduction 2. Constants 2a. Numeric Constants 2b. Character Constants 2c. Symbol Constants 2d. Nested Constants 3. Scalar Functions 4. Arithmetic Scalar Functions 5. Operators

More information

MATLAB Project: Getting Started with MATLAB

MATLAB Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB built-in functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos,

More information

Microsoft Excel 2010 Handout

Microsoft Excel 2010 Handout Microsoft Excel 2010 Handout Excel is an electronic spreadsheet program you can use to enter and organize data, and perform a wide variety of number crunching tasks. Excel helps you organize and track

More information

The Very Basics of the R Interpreter

The Very Basics of the R Interpreter Chapter 2 The Very Basics of the R Interpreter OK, the computer is fired up. We have R installed. It is time to get started. 1. Start R by double-clicking on the R desktop icon. 2. Alternatively, open

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

More information

6: USING ANCHORED FRAMES

6: USING ANCHORED FRAMES 15 Exercise 6: USING ANCHORED FRAMES Open Forest2 if it is not already open on the screen. Add an anchored frame to the text: 1. Position the cursor in the line after which you would like the graphic to

More information

Choose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip.

Choose the file menu, and select Open. Input to be typed at the Maple prompt. Output from Maple. An important tip. MAPLE Maple is a powerful and widely used mathematical software system designed by the Computer Science Department of the University of Waterloo. It can be used for a variety of tasks, such as solving

More information

Part II Composition of Functions

Part II Composition of Functions Part II Composition of Functions The big idea in this part of the book is deceptively simple. It s that we can take the value returned by one function and use it as an argument to another function. By

More information

Our Strategy for Learning Fortran 90

Our Strategy for Learning Fortran 90 Our Strategy for Learning Fortran 90 We want to consider some computational problems which build in complexity. evaluating an integral solving nonlinear equations vector/matrix operations fitting data

More information

Introduction. Chapter The Nuprl 5 Architecture

Introduction. Chapter The Nuprl 5 Architecture Chapter 1 Introduction The Nuprl proof development system is a framework for the development of formalized mathematical knowledge as well as for the synthesis, verification, and optimization of software.

More information

Design Principles for a Beginning Programming Language

Design Principles for a Beginning Programming Language Design Principles for a Beginning Programming Language John T Minor and Laxmi P Gewali School of Computer Science University of Nevada, Las Vegas Abstract: We consider the issue of designing an appropriate

More information

Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem

Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem (Thursday, Jan 29, 1998) Read: Chapter 1 in CLR. Analyzing Algorithms: In order to design good algorithms, we must first agree the criteria for measuring

More information

D-Optimal Designs. Chapter 888. Introduction. D-Optimal Design Overview

D-Optimal Designs. Chapter 888. Introduction. D-Optimal Design Overview Chapter 888 Introduction This procedure generates D-optimal designs for multi-factor experiments with both quantitative and qualitative factors. The factors can have a mixed number of levels. For example,

More information

Contents. Table of Contents. Table of Contents... iii Preface... xvii. Getting Started iii

Contents. Table of Contents. Table of Contents... iii Preface... xvii. Getting Started iii Contents Discovering the Possibilities... iii Preface... xvii Preface to the First Edition xvii Preface to the Second Edition xviii Getting Started... 1 Chapter Overview 1 Philosophy Behind this Book 1

More information

This chapter is intended to take you through the basic steps of using the Visual Basic

This chapter is intended to take you through the basic steps of using the Visual Basic CHAPTER 1 The Basics This chapter is intended to take you through the basic steps of using the Visual Basic Editor window and writing a simple piece of VBA code. It will show you how to use the Visual

More information

Table : IEEE Single Format ± a a 2 a 3 :::a 8 b b 2 b 3 :::b 23 If exponent bitstring a :::a 8 is Then numerical value represented is ( ) 2 = (

Table : IEEE Single Format ± a a 2 a 3 :::a 8 b b 2 b 3 :::b 23 If exponent bitstring a :::a 8 is Then numerical value represented is ( ) 2 = ( Floating Point Numbers in Java by Michael L. Overton Virtually all modern computers follow the IEEE 2 floating point standard in their representation of floating point numbers. The Java programming language

More information

Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1

Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1 Excel Essentials Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1 FREQUENTLY USED KEYBOARD SHORTCUTS... 1 FORMATTING CELLS WITH PRESET

More information

Excel Tips and FAQs - MS 2010

Excel Tips and FAQs - MS 2010 BIOL 211D Excel Tips and FAQs - MS 2010 Remember to save frequently! Part I. Managing and Summarizing Data NOTE IN EXCEL 2010, THERE ARE A NUMBER OF WAYS TO DO THE CORRECT THING! FAQ1: How do I sort my

More information

1 Welcome to Microsoft Excel 2007

1 Welcome to Microsoft Excel 2007 1 Welcome to Microsoft Excel 2007 The Excel Window With Office 2007, Microsoft has abandoned the interface consisting of a menu and a collection of toolbars so common in all Windows applications until

More information

Matlab Introduction. Scalar Variables and Arithmetic Operators

Matlab Introduction. Scalar Variables and Arithmetic Operators Matlab Introduction Matlab is both a powerful computational environment and a programming language that easily handles matrix and complex arithmetic. It is a large software package that has many advanced

More information

Preparation for Precalculus

Preparation for Precalculus Preparation for Precalculus Congratulations on your acceptance to the Governor s School of Southside Virginia (GSSV). I look forward to working with you as your mathematics instructor. I am confident that

More information

AEMLog Users Guide. Version 1.01

AEMLog Users Guide. Version 1.01 AEMLog Users Guide Version 1.01 INTRODUCTION...2 DOCUMENTATION...2 INSTALLING AEMLOG...4 AEMLOG QUICK REFERENCE...5 THE MAIN GRAPH SCREEN...5 MENU COMMANDS...6 File Menu...6 Graph Menu...7 Analysis Menu...8

More information

Frames, Environments, and Scope in R and S-PLUS

Frames, Environments, and Scope in R and S-PLUS Frames, Environments, and Scope in R and S-PLUS Appendix to An R and S-PLUS Companion to Applied Regression John Fox March 2002 1 Introduction Section 2.2.1 of the text describes in some detail how objects

More information

Introduction to the workbook and spreadsheet

Introduction to the workbook and spreadsheet Excel Tutorial To make the most of this tutorial I suggest you follow through it while sitting in front of a computer with Microsoft Excel running. This will allow you to try things out as you follow along.

More information

MACHINE INDEPENDENCE IN COMPILING*

MACHINE INDEPENDENCE IN COMPILING* MACHINE INDEPENDENCE IN COMPILING* Harry D. Huskey University of California Berkeley, California, USA Since 1958, there has been a substantial interest in the development of problem-oriented languages

More information

UNIT V SYSTEM SOFTWARE TOOLS

UNIT V SYSTEM SOFTWARE TOOLS 5.1 Text editors UNIT V SYSTEM SOFTWARE TOOLS A text editor is a type of program used for editing plain text files. Text editors are often provided with operating systems or software development packages,

More information

Anima-LP. Version 2.1alpha. User's Manual. August 10, 1992

Anima-LP. Version 2.1alpha. User's Manual. August 10, 1992 Anima-LP Version 2.1alpha User's Manual August 10, 1992 Christopher V. Jones Faculty of Business Administration Simon Fraser University Burnaby, BC V5A 1S6 CANADA chris_jones@sfu.ca 1992 Christopher V.

More information

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB?

Appendix A. Introduction to MATLAB. A.1 What Is MATLAB? Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system

More information

MathML Editor: The Basics *

MathML Editor: The Basics * OpenStax-CNX module: m26312 1 MathML Editor: The Basics * Natalie Weber This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 3.0 Abstract This module provides

More information

ChemSense Studio Client Version 3.0.7

ChemSense Studio Client Version 3.0.7 Quick Start Guide: ChemSense Studio Client Version 3.0.7 January 5, 2005 Comments/Questions/Bug Report? E-mail: chemsense-contact@ctl.sri.com Background The ChemSense Studio Client software supports the

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

Simulink Basics Tutorial

Simulink Basics Tutorial 1 of 20 1/11/2011 5:45 PM Starting Simulink Model Files Basic Elements Running Simulations Building Systems Simulink Basics Tutorial Simulink is a graphical extension to MATLAB for modeling and simulation

More information

For many people, learning any new computer software can be an anxietyproducing

For many people, learning any new computer software can be an anxietyproducing 1 Getting to Know Stata 12 For many people, learning any new computer software can be an anxietyproducing task. When that computer program involves statistics, the stress level generally increases exponentially.

More information

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are: LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words

More information

Introduction to C/C++ Programming

Introduction to C/C++ Programming Chapter 1 Introduction to C/C++ Programming This book is about learning numerical programming skill and the software development process. Therefore, it requires a lot of hands-on programming exercises.

More information

Stating the obvious, people and computers do not speak the same language.

Stating the obvious, people and computers do not speak the same language. 3.4 SYSTEM SOFTWARE 3.4.3 TRANSLATION SOFTWARE INTRODUCTION Stating the obvious, people and computers do not speak the same language. People have to write programs in order to instruct a computer what

More information

Chapter 17. Fundamental Concepts Expressed in JavaScript

Chapter 17. Fundamental Concepts Expressed in JavaScript Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program

More information

An Introduction to MATLAB See Chapter 1 of Gilat

An Introduction to MATLAB See Chapter 1 of Gilat 1 An Introduction to MATLAB See Chapter 1 of Gilat Kipp Martin University of Chicago Booth School of Business January 25, 2012 Outline The MATLAB IDE MATLAB is an acronym for Matrix Laboratory. It was

More information

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors. 1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN

More information

A Tutorial for Excel 2002 for Windows

A Tutorial for Excel 2002 for Windows INFORMATION SYSTEMS SERVICES Writing Formulae with Microsoft Excel 2002 A Tutorial for Excel 2002 for Windows AUTHOR: Information Systems Services DATE: August 2004 EDITION: 2.0 TUT 47 UNIVERSITY OF LEEDS

More information

Lesson 1: Writing Your First JavaScript

Lesson 1: Writing Your First JavaScript JavaScript 101 1-1 Lesson 1: Writing Your First JavaScript OBJECTIVES: In this lesson you will be taught how to Use the tag Insert JavaScript code in a Web page Hide your JavaScript

More information

THE ADHERENCE OF OPEN SOURCE JAVA PROGRAMMERS TO STANDARD CODING PRACTICES

THE ADHERENCE OF OPEN SOURCE JAVA PROGRAMMERS TO STANDARD CODING PRACTICES THE ADHERENCE OF OPEN SOURCE JAVA PROGRAMMERS TO STANDARD CODING PRACTICES Mahmoud O. Elish Department of Computer Science George Mason University Fairfax VA 223-44 USA melish@gmu.edu ABSTRACT The use

More information

Chapter 1. Introduction

Chapter 1. Introduction Chapter 1 Introduction This chapter introduces ViSta, the Visual Statistics system. ViSta is designed for students and teachers in introductory and multivariate statistics, for researchers who have data

More information

Scheme: Expressions & Procedures

Scheme: Expressions & Procedures Scheme: Expressions & Procedures CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Friday, March 31, 2017 Glenn G. Chappell Department of Computer Science University

More information

Appendix A. HINTS WHEN USING EXCEL w

Appendix A. HINTS WHEN USING EXCEL w Appendix A HINTS WHEN USING EXCEL w This appendix provides hints when using Microsoft Excel. Appendix A includes general features that are useful in all the applications solved with Excel in this book.

More information

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department 0901212 Python Programming 1 st Semester 2014/2015 Course Catalog This course introduces

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi... Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................

More information

Common Lisp Object System Specification. 1. Programmer Interface Concepts

Common Lisp Object System Specification. 1. Programmer Interface Concepts Common Lisp Object System Specification 1. Programmer Interface Concepts Authors: Daniel G. Bobrow, Linda G. DeMichiel, Richard P. Gabriel, Sonya E. Keene, Gregor Kiczales, and David A. Moon. Draft Dated:

More information

Getting Started p. 1 Obtaining Tcl/Tk p. 1 Interactive Execution p. 1 Direct Execution p. 4 Reading this Book p. 6 Requirements for Networking

Getting Started p. 1 Obtaining Tcl/Tk p. 1 Interactive Execution p. 1 Direct Execution p. 4 Reading this Book p. 6 Requirements for Networking Foreword p. xi Acknowledgments p. xiii Getting Started p. 1 Obtaining Tcl/Tk p. 1 Interactive Execution p. 1 Direct Execution p. 4 Reading this Book p. 6 Requirements for Networking Examples p. 7 Requirements

More information

Functional programming in LISP

Functional programming in LISP Programming Languages Week 4 Functional programming in LISP College of Information Science and Engineering Ritsumeikan University review of part 3 enumeration of dictionaries you receive a sequence of

More information

Magic Tutorial #1: Getting Started

Magic Tutorial #1: Getting Started Magic Tutorial #1: Getting Started John Ousterhout (updated by others, too) Computer Science Division Electrical Engineering and Computer Sciences University of California Berkeley, CA 94720 This tutorial

More information

Chapter 2 Basic Elements of C++

Chapter 2 Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion

More information

Nano-Lisp The Tutorial Handbook

Nano-Lisp The Tutorial Handbook Nano-Lisp The Tutorial Handbook Francis Sergeraert March 4, 2006 1 Various types of Nano-Lisp objects. There are several type notions and in this documentation only the notion of implementation type (itype

More information

Practical 1P1 Computing Exercise

Practical 1P1 Computing Exercise Practical 1P1 Computing Exercise What you should learn from this exercise How to use the teaching lab computers and printers. How to use a spreadsheet for basic data analysis. How to embed Excel tables

More information

MASTERING COBOL PROGRAMMING

MASTERING COBOL PROGRAMMING MASTERING COBOL PROGRAMMING MACMILLAN MASTER SERIES Banking Basic English Law Basic Management Biology British Politics Business Communication Business Microcomputing Chemistry COBOL Programming Commerce

More information

TABLE OF CONTENTS PART I: BASIC MICROSOFT WORD TOOLS... 1 PAGE BREAKS... 1 SECTION BREAKS... 3 STYLES... 6 TABLE OF CONTENTS... 8

TABLE OF CONTENTS PART I: BASIC MICROSOFT WORD TOOLS... 1 PAGE BREAKS... 1 SECTION BREAKS... 3 STYLES... 6 TABLE OF CONTENTS... 8 TABLE OF CONTENTS PART I: BASIC MICROSOFT WORD TOOLS... 1 PAGE BREAKS... 1 SECTION BREAKS... 3 STYLES... 6 TABLE OF CONTENTS... 8 LIST OF TABLES / LIST OF FIGURES... 11 PART II: FORMATTING REQUIREMENTS:

More information

9.2 Linux Essentials Exam Objectives

9.2 Linux Essentials Exam Objectives 9.2 Linux Essentials Exam Objectives This chapter will cover the topics for the following Linux Essentials exam objectives: Topic 3: The Power of the Command Line (weight: 10) 3.3: Turning Commands into

More information

EDMS. Architecture and Concepts

EDMS. Architecture and Concepts EDMS Engineering Data Management System Architecture and Concepts Hannu Peltonen Helsinki University of Technology Department of Computer Science Laboratory of Information Processing Science Abstract

More information

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

More information

, has the form T i1i 2 i m. = κ i1i 2 i m. x i1. 1 xi2 2 xim m (2)

, has the form T i1i 2 i m. = κ i1i 2 i m. x i1. 1 xi2 2 xim m (2) CS61B, Fall 2002 Project #1 P. N. Hilfinger Due: Friday, 4 October 2002 at 2400 This first project involves writing a calculator program that can perform polynomial arithmetic. We ll do only a very limited

More information

LEARNING TO PROGRAM WITH MATLAB. Building GUI Tools. Wiley. University of Notre Dame. Craig S. Lent Department of Electrical Engineering

LEARNING TO PROGRAM WITH MATLAB. Building GUI Tools. Wiley. University of Notre Dame. Craig S. Lent Department of Electrical Engineering LEARNING TO PROGRAM WITH MATLAB Building GUI Tools Craig S. Lent Department of Electrical Engineering University of Notre Dame Wiley Contents Preface ix I MATLAB Programming 1 1 Getting Started 3 1.1 Running

More information

An Introduction to Programming with IDL

An Introduction to Programming with IDL An Introduction to Programming with IDL Interactive Data Language Kenneth P. Bowman Department of Atmospheric Sciences Texas A&M University AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN

More information

MATLAB Project: Getting Started with MATLAB

MATLAB Project: Getting Started with MATLAB Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos, sin,

More information

This book is licensed under a Creative Commons Attribution 3.0 License

This book is licensed under a Creative Commons Attribution 3.0 License 6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars

More information

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

CPS122 Lecture: From Python to Java last revised January 4, Objectives: Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

Programming for Engineers Introduction to C

Programming for Engineers Introduction to C Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines

More information

A Small Interpreted Language

A Small Interpreted Language A Small Interpreted Language What would you need to build a small computing language based on mathematical principles? The language should be simple, Turing equivalent (i.e.: it can compute anything that

More information

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below. Graphing in Excel featuring Excel 2007 1 A spreadsheet can be a powerful tool for analyzing and graphing data, but it works completely differently from the graphing calculator that you re used to. If you

More information

Lesson 1: Creating and formatting an Answers analysis

Lesson 1: Creating and formatting an Answers analysis Lesson 1: Creating and formatting an Answers analysis Answers is the ad-hoc query environment in the OBIEE suite. It is in Answers that you create and format analyses to help analyze business results.

More information

Introduction to Information Technology Turban, Rainer and Potter John Wiley & Sons, Inc. Copyright 2005

Introduction to Information Technology Turban, Rainer and Potter John Wiley & Sons, Inc. Copyright 2005 Introduction to Information Technology Turban, Rainer and Potter John Wiley & Sons, Inc. Copyright 2005 Computer Software Chapter Outline Significance of software System software Application software Software

More information

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation Chapter 7 Introduction to Matrices This chapter introduces the theory and application of matrices. It is divided into two main sections. Section 7.1 discusses some of the basic properties and operations

More information

Reasoning About Programs Panagiotis Manolios

Reasoning About Programs Panagiotis Manolios Reasoning About Programs Panagiotis Manolios Northeastern University March 22, 2012 Version: 58 Copyright c 2012 by Panagiotis Manolios All rights reserved. We hereby grant permission for this publication

More information

Functional Programming

Functional Programming Functional Programming CS331 Chapter 14 Functional Programming Original functional language is LISP LISt Processing The list is the fundamental data structure Developed by John McCarthy in the 60 s Used

More information

ü 1.1 Getting Started

ü 1.1 Getting Started Chapter 1 Introduction Welcome to Mathematica! This tutorial manual is intended as a supplement to Rogawski's Calculus textbook and aimed at students looking to quickly learn Mathematica through examples.

More information