Random Walks & Cellular Automata

Size: px
Start display at page:

Download "Random Walks & Cellular Automata"

Transcription

1 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules MCS 507 Lecture 30 Mathematical, Statistical and Scientific Software Jan Verschelde, 5 November 2012 Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

2 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

3 particle movements Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

4 designing the simulation All particles originate at (0, 0). For every particle, for every time step do: 1 generate a random integer d {1, 2, 3, 4}, 2 move according to the value of d: 1 if d = 1: move particle north 2 if d = 2: move particle south 3 if d = 3: move particle east 4 if d = 4: move particle west Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

5 the script walk2d.py import numpy as np import random from scitools.std import plot def particles(npa,nst,pls): """ Shows random particle movement with npa : number of particles, nst : number of time steps, pls : how many steps for next plot. """ Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

6 the script continued x = np.zeros(npa); y = np.zeros(npa) xymax = 3*np.sqrt(nst); xymin = -xymax for step in range(nst): for i in range(npa): d = random.randint(1,4) if d == 1: y[i] += 1 # north elif d == 2: y[i] -= 1 # south elif d == 3: x[i] += 1 # east elif d == 4: x[i] -= 1 # west if (step+1) % pls == 0: plot(x,y, bo, \ axis=[xymin, xymax, xymin, xymax], \ title= %d particles after %d steps \ % (npa, step+1)) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

7 the main function def main(): """ Fixes the seed for the random numbers and starts the particle simulation. """ random.seed(10) particles(3000,4000,20) will run a simulation of 3000 particles over 4000 stages plotted every 20 time steps. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

8 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

9 vectorization Vectorization: replace the Python for loops by NumPy operations on arrays. To speed up the simulation: 1 generate all random directions at once, 2 use where to update coordinates. The built-in function where has the syntax numpy.where(condition, [x, y]) and returns elements either from x or y (optional) depending on condition. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

10 generating all moves def particles(npa,nst,pls): """ Shows random particle movement with npa : number of particles, nst : number of time steps, pls : how many steps for next plot. """ x = np.zeros(npa); y = np.zeros(npa) xymax = 3*np.sqrt(nst); xymin = -xymax moves = np.random.random_integers(1,4,nst*npa) moves.shape = (nst,npa) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

11 script walk2dv.py continued for step in range(nst): this_move = moves[step,:] y += np.where(this_move == 1,1,0) y -= np.where(this_move == 2,1,0) x += np.where(this_move == 3,1,0) x -= np.where(this_move == 4,1,0) if (step+1) % pls == 0: plot(x,y, bo, \ axis=[xymin, xymax, xymin, xymax], \ title= %d particles after %d steps \ % (npa, step+1)) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

12 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

13 visualizing a matrix Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

14 running the code $ python spy_plot.py [[ , 0 0 0] [ , 0 1 1] [ , 0 0 0]..., [ , 0 0 0] [ , 0 1 0] [ , 0 0 0]] number of nonzeros : 964 quit? (y/n) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

15 a plot of a matrix Every nonzero element of the matrix is represented by a red disk in a plot. Extract rows and columns of nonzeroes of A: 1 from scipy import sparse 2 convert the matrix A into a sparse matrix, in coordinate format: S = sparse.coo_matrix(a) 3 x = S.row; y = S.col give in x and y the rows and columns of nonzeroes. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

16 the script spy_plot.py import numpy as np from scitools.std import plot r = 0.1 # ratio of nonzeroes n = 100 # dimension of the matrix A = np.random.rand(n,n) A = np.matrix(a < r,int) print A from scipy import sparse S = sparse.coo_matrix(a) print number of nonzeros :, S.nnz x = S.row; y = S.col plot(x,y, ro,axis=[-1, n, -1, n]) ans = raw_input( quit? (y/n) ) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

17 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

18 a movie of matrices We generate a sequence of random matrices of the same dimension n = 100 and ratio of nonzeroes r = 0.1. For each generated random matrix: 1 compute rows and columns of nonzeroes, 2 plot rows and columns as red disks. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

19 spy_plot_movie.py import numpy as np from scitools.std import plot from scipy import sparse r = 0.1 # ratio of nonzeroes n = 100 # dimension of the matrix for i in xrange(n): A = np.random.rand(n,n) A = np.matrix(a < r,int) S = sparse.coo_matrix(a) x = S.row; y = S.col plot(x,y, ro,axis=[-1, n, -1, n], \ title= matrix %d has %d nonzeroes \ % (i, S.nnz)) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

20 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

21 visualizing living cells Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

22 simulating cellular growth The game of life is a discovery of John Conway. Consider a rectangular grid of cells with rules: 1 An empty cell is born when it has 3 neighbors. 2 A living cell can either die or survive, as follows: 1 die by loneliness, if the cell has one or no neighbors; 2 die by overpopulation, if the cell has 4 neighbors; 3 survive, if the cell has two or three neighbors. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

23 design of the code Three ingredients: 1 The rectangular grid is represented by a NumPy matrix A of integers: Ai,j {0, 1}, Ai,j = 0: cell (i, j) is dead, Ai,j = 1: cell (i, j) is alive. 2 We update the matrix applying the rules, running over all pairs of indices (i, j). 3 We use plot of scitools.std to the rows and columns of the nonzero entries. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

24 the main function def main(): """ Generates a random matrix and applies the rules for Conway s game of life. """ r = 0.2 # ratio of nonzeroes n = 100 # dimension of the matrix A = np.random.rand(n,n) A = np.matrix(a < r,int) for i in xrange(10*n): S = sparse.coo_matrix(a) x = S.row; y = S.col plot(x,y, ro,axis=[-1, n, -1, n], \ title= stage %d % i) A = update(a) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

25 applying the rules def update(a): """ Applies the rules of Conway s game of life. """ B = np.zeros((a.shape[0],a.shape[1]),int) for i in range(0,a.shape[0]): for j in range(0,a.shape[1]): nb = neighbors(a,i,j) if A[i,j] == 1: if nb < 2 or nb > 3: B[i,j] = 0 else: B[i,j] = 1 else: if nb == 3: B[i,j] = 1 return B Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

26 counting live neighbors def neighbors(a,i,j): cnt = 0 if i > 0: if A[i-1,j]: cnt = cnt + 1 if j > 0: if A[i-1,j-1]: cnt = cnt + 1 if j < A.shape[1]-1: if A[i-1,j+1]: cnt = cnt + 1 if i < A.shape[0]-1: if A[i+1,j]: cnt = cnt + 1 if j > 0: if A[i+1,j-1]: cnt = cnt + 1 if j < A.shape[1]-1: if A[i+1,j+1]: cnt = cnt + 1 if j > 0: if A[i,j-1]: cnt = cnt + 1 if j < A.shape[1]-1: if A[i,j+1]: cnt = cnt + 1 return cnt Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

27 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

28 performance issues The straightforward code does not work well on a MacBook when the dimension gets at n = 300. Reasons for the problems with performance: Traversals through the matrix with double for loops in Python: incrementing loop counters is expensive. The loop counts i and j are Python objects. In counting the neighbors we access not only the (i, j)-th data element, but also (i 1, j), (i + 1, j), (i, j 1), and (i, j + 1). In the row or column oriented storing of the matrix, getting access to respectively (i 1, j),(i + 1, j) or (i, j 1),(i, j + 1) means accessing n elements before or after the (i, j)-th element. Vectorization reorganizes the counting of the live neighbors and the application of the rules. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

29 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

30 vectorizing the neighbor count For every cell (i, j) in the matrix we need to count the number of neighbors that are alive. We need to avoid to access at the same time the left, right, upper and lower neighbors because of the way matrices are stored. Idea: to count the right neighbors of live cells add to the matrix the same matrix shifted one column. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

31 counting the right live neighbors >>> import numpy as np >>> A = np.random.rand(5,5) >>> A = np.matrix(a < 0.3,int); A matrix([[1, 1, 1, 1, 1], [1, 1, 0, 0, 1], [0, 0, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]) >>> B = np.copy(a[:,+1:]) >>> B array([[1, 1, 1, 1], [1, 0, 0, 1], [0, 0, 0, 0], [0, 1, 1, 0], [0, 0, 0, 0]]) >>> A[:,:-1] = np.copy(a[:,:-1]) + B >>> A matrix([[2, 2, 2, 2, 1], [2, 1, 0, 1, 1], [0, 0, 0, 0, 0], [0, 1, 2, 1, 0], [0, 0, 0, 0, 0]]) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

32 the script game_neighbors.py def neighbor_count_matrix(a): """ Returns a matrix counting the number of live neighbors. """ AA = np.copy(a); R = np.copy(a) B = np.copy(r[:,:-1]) # omit last column C = np.copy(r[:,+1:]) # omit first column R[:,+1:] = np.copy(r[:,+1:]) + B R[:,:-1] = np.copy(r[:,:-1]) + C D = np.copy(r[:-1,:]) # omit last row E = np.copy(r[+1:,:]) # omit first row R[+1:,:] = np.copy(r[+1:,:]) + D R[:-1,:] = np.copy(r[:-1,:]) + E R = R - AA return R Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

33 the main test def main(): """ Test on neighbor count. """ n = 8; r = 0.2 A = np.random.rand(n,n) A = np.matrix(a < r,int) B = neighbor_count_matrix(a) print cells alive print A print vectorized neighbor count print B C = neighbor_count(a) print original neighbor count print C print equality check : print np.equal(b,c) if name == " main ": main() Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

34 Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of John Conway 3 Vectorizing the Game of Life performance issues vectorizing the neighbor count vectorizing the rules Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

35 recall the where method Converting a 0/1 matrix into a Boolean matrix: >>> A = np.random.rand(4,4) >>> A = np.matrix(a < 0.5, int) >>> A matrix([[0, 1, 1, 1], [0, 1, 0, 1], [1, 1, 1, 0], [0, 0, 1, 1]]) >>> B = np.where(a > 0, True, False) >>> B matrix([[false, True, True, True], [False, True, False, True], [ True, True, True, False], [False, False, True, True]], dtype=bool) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

36 die of loneliness >>> import numpy as np >>> A = np.random.rand(5,5) >>> A = np.matrix(a < 0.4,int) >>> A matrix([[0, 0, 0, 0, 0], [1, 1, 0, 0, 1], [1, 0, 0, 1, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) >>> from game_neighbors import neighbor_count_matrix >>> B = neighbor_count_matrix(a) >>> B array([[2, 2, 1, 1, 1], [2, 2, 2, 2, 1], [2, 3, 3, 2, 3], [1, 1, 2, 2, 3], [0, 0, 1, 2, 1]]) >>> lonely = np.where(b < 2,0,A); lonely array([[0, 0, 0, 0, 0], [1, 1, 0, 0, 0], [1, 0, 0, 1, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 0]]) Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

37 the script game_rules.py import numpy as np from game_neighbors import neighbor_count_matrix def update_matrix(a,b): """ The vectorized version of update. """ starve = np.where(b > 3,0,A) lonely = np.where(b < 2,0,starve) alive = np.where(b == 3,1,lonely) return alive To test, we compare the update methods. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

38 the vectorized game The script game_vector.py has a different update: import numpy as np from scitools.std import plot from scipy import sparse from game_neighbors import neighbor_count_matrix from game_rules import update_matrix def update(a): """ Applies the rules of Conway s game of life. """ B = neighbor_count_matrix(a) C = update_matrix(a,b) return C Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

39 Summary + Exercises Random walks and cellular automata simulate and model complicated dynamical systems. Vectorization is often critical for good performance. 1 Use the canvas of Tkinter for a GUI to make the game of life. Allow the user to define configurations of living cells via mouse clicks on the canvas. 2 Apply vectorization to your GUI. Compare the performance of your versions with and without factorization. Compare the performance of your vectorized GUI with the version that uses scitools.std. Homework due Friday 16 November at 10AM: exercises 1 and 3 of lecture 21; exercise 1 of lecture 22; exercise 2 of lecture 23; exercises 2 and 4 of lecture 24; exercises 1 and 2 of lecture 25; exercises 1 and 3 of lecture 26. Scientific Software (MCS 507) random walks and cellular automata 5 November / 39

Random Walks & Cellular Automata

Random Walks & Cellular Automata Random Walks & Cellular Automata 1 Particle Movements basic version of the simulation vectorized implementation 2 Cellular Automata pictures of matrices an animation of matrix plots the game of life of

More information

Running Cython and Vectorization

Running Cython and Vectorization Running Cython and Vectorization 1 Getting Started with Cython overview hello world with Cython 2 Numerical Integration experimental setup adding type declarations cdef functions & calling external functions

More information

Running Cython and Vectorization

Running Cython and Vectorization Running Cython and Vectorization 1 Getting Started with Cython overview hello world with Cython 2 Numerical Integration experimental setup adding type declarations cdef functions & calling external functions

More information

making connections general transit feed specification stop names and stop times storing the connections in a dictionary

making connections general transit feed specification stop names and stop times storing the connections in a dictionary making connections 1 CTA Tables general transit feed specification stop names and stop times storing the connections in a dictionary 2 CTA Schedules finding connections between stops sparse matrices in

More information

Running Cython. overview hello world with Cython. experimental setup adding type declarations cdef functions & calling external functions

Running Cython. overview hello world with Cython. experimental setup adding type declarations cdef functions & calling external functions Running Cython 1 Getting Started with Cython overview hello world with Cython 2 Numerical Integration experimental setup adding type declarations cdef functions & calling external functions 3 Using Cython

More information

Branching and Enumeration

Branching and Enumeration Branching and Enumeration 1 Booleans and Branching computing logical expressions computing truth tables with Sage if, else, and elif 2 Timing Python Code try-except costs more than if-else 3 Recursive

More information

Graph Adjacency Matrix Automata Joshua Abbott, Phyllis Z. Chinn, Tyler Evans, Allen J. Stewart Humboldt State University, Arcata, California

Graph Adjacency Matrix Automata Joshua Abbott, Phyllis Z. Chinn, Tyler Evans, Allen J. Stewart Humboldt State University, Arcata, California Graph Adjacency Matrix Automata Joshua Abbott, Phyllis Z. Chinn, Tyler Evans, Allen J. Stewart Humboldt State University, Arcata, California Abstract We define a graph adjacency matrix automaton (GAMA)

More information

User Interfaces. MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September Command Line Interfaces

User Interfaces. MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September Command Line Interfaces User 1 2 MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September 2011 User 1 2 command line interfaces Many programs run without dialogue with user, as $ executable

More information

Introduction To Python

Introduction To Python Introduction To Python Week 7: Program Dev: Conway's Game of Life Dr. Jim Lupo Asst Dir Computational Enablement LSU Center for Computation & Technology 9 Jul 2015, Page 1 of 33 Overview Look at a helpful

More information

CELLULAR AUTOMATA IN MATHEMATICAL MODELING JOSH KANTOR. 1. History

CELLULAR AUTOMATA IN MATHEMATICAL MODELING JOSH KANTOR. 1. History CELLULAR AUTOMATA IN MATHEMATICAL MODELING JOSH KANTOR 1. History Cellular automata were initially conceived of in 1948 by John von Neumann who was searching for ways of modeling evolution. He was trying

More information

2D Arrays. Lecture 25

2D Arrays. Lecture 25 2D Arrays Lecture 25 Apply to be a COMP110 UTA Applications are open at http://comp110.com/become-a-uta/ Due December 6 th at 11:59pm LDOC Hiring committee is made of 8 elected UTAs 2D Arrays 0 1 2 Easy

More information

Web Interfaces. the web server Apache processing forms with Python scripts Python code to write HTML

Web Interfaces. the web server Apache processing forms with Python scripts Python code to write HTML Web Interfaces 1 Python Scripts in Browsers the web server Apache processing forms with Python scripts Python code to write HTML 2 Web Interfaces for the Determinant dynamic interactive forms passing data

More information

A Slice of Life

A Slice of Life A Slice of Life 02-201 More on Slices Last Time: append() and copy() Operations s := make([]int, 10)! s = append(s, 5)! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 5! 0! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! s! c := make([]int,

More information

Cellular Automata Language (CAL) Language Reference Manual

Cellular Automata Language (CAL) Language Reference Manual Cellular Automata Language (CAL) Language Reference Manual Calvin Hu, Nathan Keane, Eugene Kim {ch2880, nak2126, esk2152@columbia.edu Columbia University COMS 4115: Programming Languages and Translators

More information

User Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy

User Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy User Interfaces 1 Command Line Interfaces getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy 2 Encapsulation by Object Oriented Programming

More information

Graphical User Interfaces

Graphical User Interfaces to visualize Graphical User Interfaces 1 2 to visualize MCS 507 Lecture 12 Mathematical, Statistical and Scientific Software Jan Verschelde, 19 September 2011 Graphical User Interfaces to visualize 1 2

More information

June 10, 2014 Scientific computing in practice Aalto University

June 10, 2014 Scientific computing in practice Aalto University Jussi Enkovaara import sys, os try: from Bio.PDB import PDBParser biopython_installed = True except ImportError: biopython_installed = False Exercises for Python in Scientific Computing June 10, 2014 Scientific

More information

Assignment 5. INF109 Dataprogrammering for naturvitskap

Assignment 5. INF109 Dataprogrammering for naturvitskap Assignment 5 INF109 Dataprogrammering for naturvitskap This is the fifth of seven assignments. You can get a total of 15 points for this task. Friday, 8. April, 23.59. Submit the report as a single.py

More information

Multithreaded Servers

Multithreaded Servers Multithreaded Servers 1 Serving Multiple Clients avoid to block clients with waiting using sockets and threads 2 Waiting for Data from 3 Clients running a simple multithreaded server code for client and

More information

Graphical User Interfaces

Graphical User Interfaces Graphical User Interfaces 1 User Interfaces GUIs in Python with Tkinter object oriented GUI programming 2 Mixing Colors specification of the GUI the widget Scale 3 Simulating a Bouncing Ball layout of

More information

UNIT 9C Randomness in Computation: Cellular Automata Principles of Computing, Carnegie Mellon University

UNIT 9C Randomness in Computation: Cellular Automata Principles of Computing, Carnegie Mellon University UNIT 9C Randomness in Computation: Cellular Automata 1 Exam locations: Announcements 2:30 Exam: Sections A, B, C, D, E go to Rashid (GHC 4401) Sections F, G go to PH 125C. 3:30 Exam: All sections go to

More information

Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999

Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999 Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999 1999 by CRC PRESS LLC CHAPTER THREE CONTROL STATEMENTS 3.1 FOR

More information

Problem 3. (12 points):

Problem 3. (12 points): Problem 3. (12 points): This problem tests your understanding of basic cache operations. Harry Q. Bovik has written the mother of all game-of-life programs. The Game-of-life is a computer game that was

More information

Conway s Game of Life Wang An Aloysius & Koh Shang Hui

Conway s Game of Life Wang An Aloysius & Koh Shang Hui Wang An Aloysius & Koh Shang Hui Winner of Foo Kean Pew Memorial Prize and Gold Award Singapore Mathematics Project Festival 2014 Abstract Conway s Game of Life is a cellular automaton devised by the British

More information

CSCI-1200 Data Structures Spring 2017 Lecture 15 Problem Solving Techniques, Continued

CSCI-1200 Data Structures Spring 2017 Lecture 15 Problem Solving Techniques, Continued CSCI-1200 Data Structures Spring 2017 Lecture 15 Problem Solving Techniques, Continued Review of Lecture 14 General Problem Solving Techniques: 1. Generating and Evaluating Ideas 2. Mapping Ideas into

More information

implementing the breadth-first search algorithm implementing the depth-first search algorithm

implementing the breadth-first search algorithm implementing the depth-first search algorithm Graph Traversals 1 Graph Traversals representing graphs adjacency matrices and adjacency lists 2 Implementing the Breadth-First and Depth-First Search Algorithms implementing the breadth-first search algorithm

More information

CmpSci 187: Programming with Data Structures Spring 2015

CmpSci 187: Programming with Data Structures Spring 2015 CmpSci 187: Programming with Data Structures Spring 2015 Lecture #9 John Ridgway February 26, 2015 1 Recursive Definitions, Algorithms, and Programs Recursion in General In mathematics and computer science

More information

Root Finding Methods. sympy and Sage. MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011

Root Finding Methods. sympy and Sage. MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011 wrap Root Finding Methods 1 2 wrap MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011 Root Finding Methods 1 wrap 2 wrap wrap octave-3.4.0:1> p = [1,0,2,-1]

More information

7/27/2015. UNIT 10A Discrete Simulation. Last Time. Waking Up. How to generate pseudo-random numbers. Using randomness in interesting applications

7/27/2015. UNIT 10A Discrete Simulation. Last Time. Waking Up. How to generate pseudo-random numbers. Using randomness in interesting applications 15110 Principles of Computing, Carnegie Mellon University UNIT 10A Discrete Simulation 1 Last Time How to generate pseudo-random numbers Using randomness in interesting applications Monte Carlo simulations:

More information

Short Introduction to Python Machine Learning Course Laboratory

Short Introduction to Python Machine Learning Course Laboratory Pattern Recognition and Applications Lab Short Introduction to Python Machine Learning Course Laboratory Battista Biggio battista.biggio@diee.unica.it Luca Didaci didaci@diee.unica.it Dept. Of Electrical

More information

processing data with a database

processing data with a database processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed

More information

Fall CSE 633 Parallel Algorithms. Cellular Automata. Nils Wisiol 11/13/12

Fall CSE 633 Parallel Algorithms. Cellular Automata. Nils Wisiol 11/13/12 Fall 2012 CSE 633 Parallel Algorithms Cellular Automata Nils Wisiol 11/13/12 Simple Automaton: Conway s Game of Life Simple Automaton: Conway s Game of Life John H. Conway Simple Automaton: Conway s Game

More information

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points) EECS 183 Fall 2013 Exam 1 Part 1 (80 points) Closed Book Closed Notes Closed Electronic Devices Closed Neighbor Turn off Your Cell Phones We will confiscate all electronic devices that we see including

More information

Lists and Loops. defining lists lists as queues and stacks inserting and removing membership and ordering lists

Lists and Loops. defining lists lists as queues and stacks inserting and removing membership and ordering lists Lists and Loops 1 Lists in Python defining lists lists as queues and stacks inserting and removing membership and ordering lists 2 Loops in Python for and while loops the composite trapezoidal rule MCS

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2013 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2013 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

callback, iterators, and generators

callback, iterators, and generators callback, iterators, and generators 1 Adding a Callback Function a function for Newton s method a function of the user to process results 2 A Newton Iterator defining a counter class refactoring the Newton

More information

Michele Van Dyne Museum 204B CSCI 136: Fundamentals of Computer Science II, Spring

Michele Van Dyne Museum 204B  CSCI 136: Fundamentals of Computer Science II, Spring Michele Van Dyne Museum 204B mvandyne@mtech.edu http://katie.mtech.edu/classes/csci136 CSCI 136: Fundamentals of Computer Science II, Spring 2016 1 Review of Java Basics Data Types Arrays NEW: multidimensional

More information

HW3: CS 110X C Domain Information. Final Version: 1/29/2014

HW3: CS 110X C Domain Information. Final Version: 1/29/2014 HW3: CS 110X C 2014 Note: This homework (and all remaining homework assignments) is a partner homework and must be completed by each partner pair. When you complete this assignment, you must not share

More information

COMPUTER SCIENCE. 4. Arrays. Section 1.4.

COMPUTER SCIENCE. 4. Arrays. Section 1.4. COMPUTER SCIENCE S E D G E W I C K / W A Y N E 4. Arrays Section 1.4 http://introcs.cs.princeton.edu Basic building blocks for programming any program you might want to write objects functions and modules

More information

from Recursion to Iteration

from Recursion to Iteration from Recursion to Iteration 1 Quicksort Revisited using arrays partitioning arrays via scan and swap recursive quicksort on arrays 2 converting recursion into iteration an iterative version with a stack

More information

Erlang: concurrent programming. Johan Montelius. October 2, 2016

Erlang: concurrent programming. Johan Montelius. October 2, 2016 Introduction Erlang: concurrent programming Johan Montelius October 2, 2016 In this assignment you should implement the game of life, a very simple simulation with surprising results. You will implement

More information

Programming Project: Game of Life

Programming Project: Game of Life Programming Project: Game of Life Collaboration Solo: All work must be your own with optional help from UofA section leaders The Game of Life was invented by John Conway to simulate the birth and death

More information

Numerical Integration

Numerical Integration Numerical Integration 1 Functions using Functions functions as arguments of other functions the one-line if-else statement functions returning multiple values 2 Constructing Integration Rules with sympy

More information

Outline. tallying the votes global and local variables call by value or call by reference. of variable length using keywords for optional arguments

Outline. tallying the votes global and local variables call by value or call by reference. of variable length using keywords for optional arguments Outline 1 Histograms tallying the votes global and local variables call by value or call by reference 2 Arguments of Functions of variable length using keywords for optional arguments 3 Functions using

More information

Programming for Engineers in Python

Programming for Engineers in Python Programming for Engineers in Python Autumn 2016-17 Lecture 11: NumPy & SciPy Introduction, Plotting and Data Analysis 1 Today s Plan Introduction to NumPy & SciPy Plotting Data Analysis 2 NumPy and SciPy

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2018 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2018 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

Arrays / Lists. In this section of notes you will be introduced to new type of variable that consists of other types. Types Of Variables

Arrays / Lists. In this section of notes you will be introduced to new type of variable that consists of other types. Types Of Variables Arrays / Lists In this section of notes you will be introduced to new type of variable that consists of other types. Types Of Variables Python variables 1. Simple (atomic) 2. Aggregate (composite) integer

More information

MORE ARRAYS: THE GAME OF LIFE CITS1001

MORE ARRAYS: THE GAME OF LIFE CITS1001 MORE ARRAYS: THE GAME OF LIFE CITS1001 2 Scope of this lecture The Game of Life Implementation Performance Issues References: http://www.bitstorm.org/gameoflife/ (and hundreds of other websites) 3 Game

More information

Lecture #13: More Sequences and Strings. Last modified: Tue Mar 18 16:17: CS61A: Lecture #13 1

Lecture #13: More Sequences and Strings. Last modified: Tue Mar 18 16:17: CS61A: Lecture #13 1 Lecture #13: More Sequences and Strings Last modified: Tue Mar 18 16:17:54 2014 CS61A: Lecture #13 1 Odds and Ends: Multi-Argument Map Python s built-in map function actually applies a function to one

More information

Maximum Density Still Life

Maximum Density Still Life The Hebrew University of Jerusalem Computer Science department Maximum Density Still Life Project in course AI 67842 Mohammad Moamen Table of Contents Problem description:... 3 Description:... 3 Objective

More information

AMath 483/583 Lecture 28 June 1, Notes: Notes: Python scripting for Fortran codes. Python scripting for Fortran codes.

AMath 483/583 Lecture 28 June 1, Notes: Notes: Python scripting for Fortran codes. Python scripting for Fortran codes. AMath 483/583 Lecture 28 June 1, 2011 Today: Python plus Fortran Comments on quadtests.py for project Linear vs. log-log plots Visualization Friday: Animation: plots to movies Binary I/O Parallel IPython

More information

Random Numbers Random Walk

Random Numbers Random Walk Random Numbers Random Walk Computational Physics Random Numbers Random Walk Outline Random Systems Random Numbers Monte Carlo Integration Example Random Walk Exercise 7 Introduction Random Systems Deterministic

More information

An Introduction to MATLAB

An Introduction to MATLAB An Introduction to MATLAB Day 1 Simon Mitchell Simon.Mitchell@ucla.edu High level language Programing language and development environment Built-in development tools Numerical manipulation Plotting of

More information

Lists and Loops. browse Python docs and interactive help

Lists and Loops. browse Python docs and interactive help Lists and Loops 1 Help in Python browse Python docs and interactive help 2 Lists in Python defining lists lists as queues and stacks inserting and removing membership and ordering lists 3 Loops in Python

More information

Midterm I Practice Problems

Midterm I Practice Problems 15-112 Midterm I Practice Problems Name: Section: andrewid: This PRACTICE midterm is not meant to be a perfect representation of the upcoming midterm! You are responsible for knowing all material covered

More information

lambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions

lambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions Outline 1 Guessing Secrets functions returning functions oracles and trapdoor functions 2 anonymous functions lambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions

More information

Handling arrays in Python (numpy)

Handling arrays in Python (numpy) Handling arrays in Python (numpy) Thanks to all contributors: Alison Pamment, Sam Pepler, Ag Stephens, Stephen Pascoe, Anabelle Guillory, Graham Parton, Esther Conway, Wendy Garland, Alan Iwi and Matt

More information

Pointers and Terminal Control

Pointers and Terminal Control Division of Mathematics and Computer Science Maryville College Outline 1 2 3 Outline 1 2 3 A Primer on Computer Memory Memory is a large list. Typically, each BYTE of memory has an address. Memory can

More information

CSCI-1200 Data Structures Fall 2017 Lecture 13 Problem Solving Techniques

CSCI-1200 Data Structures Fall 2017 Lecture 13 Problem Solving Techniques CSCI-1200 Data Structures Fall 2017 Lecture 13 Problem Solving Techniques Review from Lecture 12 Rules for writing recursive functions: 1. Handle the base case(s). 2. Define the problem solution in terms

More information

Day 15: Science Code in Python

Day 15: Science Code in Python Day 15: Science Code in Python 1 Turn In Homework 2 Homework Review 3 Science Code in Python? 4 Custom Code vs. Off-the-Shelf Trade-offs Costs (your time vs. your $$$) Your time (coding vs. learning) Control

More information

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15 1 LECTURE 1: INTRO Introduction to Scientific Python, CME 193 Jan. 9, 2014 web.stanford.edu/~ermartin/teaching/cme193-winter15 Eileen Martin Some slides are from Sven Schmit s Fall 14 slides 2 Course Details

More information

Combinatorics 3: Champions League draw

Combinatorics 3: Champions League draw Bachelor of Ecole Polytechnique Computational Mathematics, year 2, semester 1 Lecturer: Lucas Gerin (send mail) (mailto:lucas.gerin@polytechnique.edu) Combinatorics 3: Champions League draw Table of contents

More information

Web Clients and Crawlers

Web Clients and Crawlers Web Clients and Crawlers 1 Web Clients alternatives to web browsers opening a web page and copying its content 2 Scanning Files looking for strings between double quotes parsing URLs for the server location

More information

Math 15 - Spring Homework 5.2 Solutions

Math 15 - Spring Homework 5.2 Solutions Math 15 - Spring 2017 - Homework 5.2 Solutions 1. (5.2 # 14 (not assigned)) Use Prim s algorithm to construct a minimal spanning tree for the following network. Draw the minimal tree and compute its total

More information

THE RELATIONSHIP BETWEEN PROCEDURAL GENERATION TECHNIQUES: CELLULAR AUTOMATA AND NOISE JESSE HIGNITE. Advisor DANIEL PLANTE

THE RELATIONSHIP BETWEEN PROCEDURAL GENERATION TECHNIQUES: CELLULAR AUTOMATA AND NOISE JESSE HIGNITE. Advisor DANIEL PLANTE THE RELATIONSHIP BETWEEN PROCEDURAL GENERATION TECHNIQUES: CELLULAR AUTOMATA AND NOISE by JESSE HIGNITE Advisor DANIEL PLANTE A senior research proposal submitted in partial fulfillment of the requirements

More information

Exercise 4: Loops, Arrays and Files

Exercise 4: Loops, Arrays and Files Exercise 4: Loops, Arrays and Files worth 24% of the final mark November 4, 2004 Instructions Submit your programs in a floppy disk. Deliver the disk to Michele Zito at the 12noon lecture on Tuesday November

More information

Parallelizing The Matrix Multiplication. 6/10/2013 LONI Parallel Programming Workshop

Parallelizing The Matrix Multiplication. 6/10/2013 LONI Parallel Programming Workshop Parallelizing The Matrix Multiplication 6/10/2013 LONI Parallel Programming Workshop 2013 1 Serial version 6/10/2013 LONI Parallel Programming Workshop 2013 2 X = A md x B dn = C mn d c i,j = a i,k b k,j

More information

Implementing Algorithms

Implementing Algorithms Implementing Algorithms 1 Data Structures implementing algorithms arrays and linked lists 2 Implementing the Gale-Shapley algorithm selecting data structures overview of the selected data structures 3

More information

BASICS OF GRAPHICAL APPS

BASICS OF GRAPHICAL APPS CSC 2014 Java Bootcamp Lecture 7 GUI Design BASICS OF GRAPHICAL APPS 2 Graphical Applications So far we ve focused on command-line applications, which interact with the user using simple text prompts In

More information

Session 04: Introduction to Numpy

Session 04: Introduction to Numpy Session 04: Introduction to Numpy October 9th, 2017 Wouter Klijn Overview Introduction Hello world Arrays Creating Interacting Copying Differences with Matlab Matrixes vs Array Why Why not Matlib module

More information

CSc 110, Spring 2017 Lecture 38: Critters. Adapted from slides by Marty Stepp and Stuart Reges

CSc 110, Spring 2017 Lecture 38: Critters. Adapted from slides by Marty Stepp and Stuart Reges CSc 110, Spring 2017 Lecture 38: Critters Adapted from slides by Marty Stepp and Stuart Reges 1 Calling overridden methods Subclasses can call overridden methods with super super(classname, self).method(parameters)

More information

CS 1301 Exam 1 Answers Fall 2009

CS 1301 Exam 1 Answers Fall 2009 Page 1/6 CS 1301 Fall 2009 Exam 1 Your Name: I commit to uphold the ideals of honor and integrity by refusing to betray the trust bestowed upon me as a member of the Georgia Tech community. CS 1301 Exam

More information

Graphs. directed and undirected graphs weighted graphs adjacency matrices. abstract data type adjacency list adjacency matrix

Graphs. directed and undirected graphs weighted graphs adjacency matrices. abstract data type adjacency list adjacency matrix Graphs 1 Graphs directed and undirected graphs weighted graphs adjacency matrices 2 Graph Representations abstract data type adjacency list adjacency matrix 3 Graph Implementations adjacency matrix adjacency

More information

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c. MATLAB BASICS Starting Matlab < PC: Desktop icon or Start menu item < UNIX: Enter matlab at operating system prompt < Others: Might need to execute from a menu somewhere Entering Matlab commands < Matlab

More information

MAT 423: Homework 3 (09/12)

MAT 423: Homework 3 (09/12) MAT 423: Homework 3 (09/12) Ex 1. [3pts] We use Gauss elimination on the following tableau 1 2 1 0 0 1 1 0 3 3 α β 1 2 1 0 0 1 1 0 0 3 α + 3 β 1 2 1 0 0 1 1 0 0 0 α β. We deduce that if α 0 then there

More information

CS1110 Lab 5: Practice for A4 (Mar 8-9, 2016) First Name: Last Name: NetID:

CS1110 Lab 5: Practice for A4 (Mar 8-9, 2016) First Name: Last Name: NetID: CS1110 Lab 5: Practice for A4 (Mar 8-9, 2016) First Name: Last Name: NetID: The lab assignments are very important. Remember this: The lab problems feed into the assignments and the assignments define

More information

The Python interpreter

The Python interpreter The Python interpreter Daniel Winklehner, Remi Lehe US Particle Accelerator School (USPAS) Summer Session Self-Consistent Simulations of Beam and Plasma Systems S. M. Lund, J.-L. Vay, D. Bruhwiler, R.

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

LECTURE 19. Numerical and Scientific Packages

LECTURE 19. Numerical and Scientific Packages LECTURE 19 Numerical and Scientific Packages NUMERICAL AND SCIENTIFIC APPLICATIONS As you might expect, there are a number of third-party packages available for numerical and scientific computing that

More information

Lecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur

Lecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur Lecture 5: Matrices Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur 29 th July, 2008 Types of Matrices Matrix Addition and Multiplication

More information

This Worksheet shows you several ways to start using Enthought s distribution of Python!

This Worksheet shows you several ways to start using Enthought s distribution of Python! This Worksheet shows you several ways to start using Enthought s distribution of Python! Start the Terminal application by Selecting the Utilities item from the Go menu located at the top of the screen

More information

ENGR 102 Engineering Lab I - Computation

ENGR 102 Engineering Lab I - Computation ENGR 102 Engineering Lab I - Computation Learning Objectives by Week 1 ENGR 102 Engineering Lab I Computation 2 Credits 2. Introduction to the design and development of computer applications for engineers;

More information

(Refer Slide Time: 02.06)

(Refer Slide Time: 02.06) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 27 Depth First Search (DFS) Today we are going to be talking

More information

Unit 7: Algorithms and Python CS 101, Fall 2018

Unit 7: Algorithms and Python CS 101, Fall 2018 Unit 7: Algorithms and Python CS 101, Fall 2018 Learning Objectives After completing this unit, you should be able to: Identify whether a sequence of steps is an algorithm in the strict sense. Explain

More information

CS , Fall 2003 Exam 2

CS , Fall 2003 Exam 2 Andrew login ID: Full Name: CS 15-213, Fall 2003 Exam 2 November 18, 2003 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write

More information

Introduction to Python and NumPy I

Introduction to Python and NumPy I Introduction to Python and NumPy I This tutorial is continued in part two: Introduction to Python and NumPy II Table of contents Overview Launching Canopy Getting started in Python Getting help Python

More information

The Simplex Algorithm for LP, and an Open Problem

The Simplex Algorithm for LP, and an Open Problem The Simplex Algorithm for LP, and an Open Problem Linear Programming: General Formulation Inputs: real-valued m x n matrix A, and vectors c in R n and b in R m Output: n-dimensional vector x There is one

More information

MS&E351 Dynamic Programming and Stochastic Control Autumn 2016 Professor Benjamin Van Roy Python Tutorial

MS&E351 Dynamic Programming and Stochastic Control Autumn 2016 Professor Benjamin Van Roy Python Tutorial MS&E351 Dynamic Programming and Stochastic Control Autumn 2016 Professor Benjamin Van Roy 20160927 Python Tutorial In this course, we will use the python programming language and tools that support dynamic

More information

Outline. general information policies for the final exam

Outline. general information policies for the final exam Outline 1 final exam on Tuesday 5 May 2015, at 8AM, in BSB 337 general information policies for the final exam 2 some example questions strings, lists, dictionaries scope of variables in functions working

More information

CS1 Lecture 2 Jan. 16, 2019

CS1 Lecture 2 Jan. 16, 2019 CS1 Lecture 2 Jan. 16, 2019 Contacting me/tas by email You may send questions/comments to me/tas by email. For discussion section issues, sent to TA and me For homework or other issues send to me (your

More information

1 2 (3 + x 3) x 2 = 1 3 (3 + x 1 2x 3 ) 1. 3 ( 1 x 2) (3 + x(0) 3 ) = 1 2 (3 + 0) = 3. 2 (3 + x(0) 1 2x (0) ( ) = 1 ( 1 x(0) 2 ) = 1 3 ) = 1 3

1 2 (3 + x 3) x 2 = 1 3 (3 + x 1 2x 3 ) 1. 3 ( 1 x 2) (3 + x(0) 3 ) = 1 2 (3 + 0) = 3. 2 (3 + x(0) 1 2x (0) ( ) = 1 ( 1 x(0) 2 ) = 1 3 ) = 1 3 6 Iterative Solvers Lab Objective: Many real-world problems of the form Ax = b have tens of thousands of parameters Solving such systems with Gaussian elimination or matrix factorizations could require

More information

High Performance Computing: Tools and Applications

High Performance Computing: Tools and Applications High Performance Computing: Tools and Applications Edmond Chow School of Computational Science and Engineering Georgia Institute of Technology Lecture 15 Numerically solve a 2D boundary value problem Example:

More information

The MatriCs. Reloaded. A linear algebra-specific language for the budding C enthusiast. Short name: MaC Extension:.neo

The MatriCs. Reloaded. A linear algebra-specific language for the budding C enthusiast. Short name: MaC Extension:.neo The MatriCs Reloaded A linear algebra-specific language for the budding C enthusiast Short name: MaC Extension:.neo Talal Asem Toukan [tat2132] - Manager Emmanuel Koumandakis [ek2808] - System Architect

More information

Exercise Set Decide whether each matrix below is an elementary matrix. (a) (b) (c) (d) Answer:

Exercise Set Decide whether each matrix below is an elementary matrix. (a) (b) (c) (d) Answer: Understand the relationships between statements that are equivalent to the invertibility of a square matrix (Theorem 1.5.3). Use the inversion algorithm to find the inverse of an invertible matrix. Express

More information

LECTURE 22. Numerical and Scientific Packages

LECTURE 22. Numerical and Scientific Packages LECTURE 22 Numerical and Scientific Packages NUMERIC AND SCIENTIFIC APPLICATIONS As you might expect, there are a number of third-party packages available for numerical and scientific computing that extend

More information

Install RStudio from - use the standard installation.

Install RStudio from   - use the standard installation. Session 1: Reading in Data Before you begin: Install RStudio from http://www.rstudio.com/ide/download/ - use the standard installation. Go to the course website; http://faculty.washington.edu/kenrice/rintro/

More information

Introduction to Matlab. By: Hossein Hamooni Fall 2014

Introduction to Matlab. By: Hossein Hamooni Fall 2014 Introduction to Matlab By: Hossein Hamooni Fall 2014 Why Matlab? Data analytics task Large data processing Multi-platform, Multi Format data importing Graphing Modeling Lots of built-in functions for rapid

More information

Outline. the try-except statement the try-finally statement. exceptions are classes raising exceptions defining exceptions

Outline. the try-except statement the try-finally statement. exceptions are classes raising exceptions defining exceptions Outline 1 Exception Handling the try-except statement the try-finally statement 2 Python s Exception Hierarchy exceptions are classes raising exceptions defining exceptions 3 Anytime Algorithms estimating

More information

Emil Sekerinski, McMaster University, Winter Term 16/17 COMP SCI 1MD3 Introduction to Programming

Emil Sekerinski, McMaster University, Winter Term 16/17 COMP SCI 1MD3 Introduction to Programming Emil Sekerinski, McMaster University, Winter Term 16/17 COMP SCI 1MD3 Introduction to Programming Consider flooding a valley (dam break, tides, spring): what is the water level at specific points in the

More information

CS 177. Lists and Matrices. Week 8

CS 177. Lists and Matrices. Week 8 CS 177 Lists and Matrices Week 8 1 Announcements Project 2 due on 7 th March, 2015 at 11.59 pm Table of Contents Lists Matrices Traversing a Matrix Construction of Matrices 3 Just a list of numbers 1D

More information