Homework : Data Mining SOLUTIONS

Size: px
Start display at page:

Download "Homework : Data Mining SOLUTIONS"

Transcription

1 Homework : Data Mining SOLUTIONS 1. (a) What is the bag-of-words representation of the sentence to be or not to be? Answer: A vector with one component for each word in our dictionary, all of them zero except for the following: be not or to This is the format given by table(c("to","be","or","not","to","be")) (b) Suppose we search for the above sentence via the keyword be. What is the bag-of-words representation for this query, and what is the Euclidean distance from the sentence? Answer: A vector whose only non-zero component is that for be, where the count is 1. The Euclidean distance is (2 1)2 + (1 0) 2 + (1 0) + (0 2) 2 = 7 (c) Describe how weighting words by inverse-document-frequency (IDF) should help when making a Web query for The Principles of Data Mining. Answer: It keeps us from wasting time on words like the and of, and emphasize the less-common, more-informative words principles, data and mining ; something titled Data Mining Principles is a good match. (d) Describe a simple text search that could not be carried out effectively using a bag-of-words representation (no matter what distance measure is used). Simple means no actual understanding of English is required. Answer: There are many; but a search for the exact phrase to be or not to be is impossible. 1

2 2. (a) What is the Euclidean distance between each of the vectors (1, 0, 0), (1, 4, 5), and (10, 0, 0)? Answer: The distance between the first and second vectors is ; between the first and third is 9; and between the second and third is (b) Divide each vector by its sum. How do the relative distances change? Answer: The first and third vectors become the closest pair. (c) Divide each vector by its Euclidean length. How do the relative distances change? Answer: The first and third vectors again become the closest pair. (d) Suppose we re using the bag-of-words representation for similarity searching with a Euclidean metric. Describe how the previous parts of the question illustrate a potential problem if we do not normalize for document length. Answer: Documents with the same distribution of words but different sizes will appear to be very far apart. (e) Consider the conventional searching scheme where the user picks a set of keywords and the system returns all documents containing those keywords. Describe how the previous parts of the question illustrate a potential problem with this type of search. Answer: The second vector contains the first keyword, but it s a small part of it, and return it because it s a match will lower the precision. 2

3 3. (a) Create document vectors for each of the stories in the music and art folders. Give the commands you used. Answer: I ll use the read.directory function, so I ll comment it first (in somewhat more detail than you would need to). # Read in all the files in a directory as vectors of character strings # Inputs: directory name (dirname), flag for verbose output (verbose) # Calls: read.doc() in 01.R # Output: List of vectors, each containing the words of one file in order read.directory <- function(dirname,verbose=false) { stories = list() # Make a list to store the story-vectors in filenames = dir(dirname,full.names=true) # List the files in the directory # Using the full.names option means we can pass the results to other # commands without worrying about the current working directory, etc. for (i in 1:length(filenames)) { # For each file, if(verbose) { print(filenames[i]) # Print the filename before we try anything with it (if we re verbose) stories[[i]] = read.doc(filenames[i]) # Read in file, stick it in the list # read.doc only works on XML files, should really check that first! return(stories) # Return the list Now I can read in the stories: > library(xml) > source("~/teaching/350/hw/01/01.r") > music <- read.directory("~/teaching/350/hw/01/nyt_corpus/music") > art <- read.directory("~/teaching/350/hw/01/nyt_corpus/art") > length(music) [1] 45 > length(art) [1] 57 > is.list(music) [1] TRUE > is.list(art) [1] TRUE > length(music[[1]]) [1] 413 > is.vector(music[[1]]) [1] TRUE (b) What command would you use to extract the 37 th word of story number in art? (That word is experiencing.) Give a command 3

4 to count the number of times the word the appears in that story. (There are at least two ways to do this. The correct answer is 103.) Answer: The list art contains a vector which has story number , but which? I can either count on a directory listing, or I can have R count for me: > which(dir("~/teaching/350/hw/01/nyt_corpus/art")==" xml") [1] 48 (Note that here I don t use the full.names option to dir(), since I don t want the full path to the files.) So the story I want is art[[48]]. The 37 th word is > art[[48]][37] [1] "experiencing" One way to see how often the appears is to do this: > sum(art[[48]] == "the") [1] 103 The expression inside sum() creates a logical vector, which is TRUE at the words which are equal to the and FALSE elsewhere. The sum of a logical vector is the number of TRUE components, i.e., number of instances of the. Alternately, use table: > table(art[[48]])["the"] the 103 Applied to a vector, table creates an array 1 where the columns are the distinct values from the vector, and entries are how often those values occur. The values themselves become the column names, so we can check how often the occurs without having to know where it comes in the vocabulary list (place 633, as it happens). R will print the column name when you access the column, but it will do arithmetic on it as usual. > table(art[[48]])["the"] + 17 the 120 (c) Give the commands you would use to construct a bag-of-words dataframe from the document vectors for the art and music stories. Hint: consider lapply. Answer: I ll take the hint. > art.bow <- lapply(art,table) > music.bow <- lapply(music,table) > is.list(music.bow) 1 R Pedantry: Really, an object of class table, which inherits from the class array. 4

5 [1] TRUE > length(music.bow) [1] 45 lapply is one of the most useful functions in R: it takes two arguments, a data structure (vector, list, array,...) and a function, and returns a list which it gets by applying the function to each element of the data structure. (It has a variant, sapply, which will try to automatically simplify the result down to a vector, but that s not what s wanted here.) The table command we ve already discussed. The last two commands just check that things are working as they ought to. > nyt.frame <- make.bow.frame(c(art.bow,music.bow)) > dim(nyt.frame) [1] The number of rows should equal the total number of stories, and = 102. (d) Create distance matrices from this data frame for (a) the straight Euclidean distance, (b) the distance with word-count normalization and (c) the distance with vector-length scaling, and then for all three again with inverse-document-frequency weighting. Give the commands you use. Answer: The distances command can be used for all of these, with the right scalings and normalization. There are already functions in 01.R to do these. dist.plain = distances(nyt.frame) dist.wordcount = distances(div.by.sum(nyt.frame)) dist.euclen = distances(div.by.euc.length(nyt.frame)) nyt.frame.idf = idf.weight(nyt.frame) dist.idf.plain = distances(nyt.frame.idf) dist.idf.wordcount = distances(div.by.sum(nyt.frame.idf)) dist.idf.euclen = distances(div.by.euc.length(nyt.frame.idf)) Quick checks that these are acting sensibly: > dim(dist.idf.euclen) [1] > dim(dist.plain) [1] > round(dist.plain[1:5,1:5],2) [,1] [,2] [,3] [,4] [,5] [1,] [2,] [3,] [4,] [5,]

6 So I get matrices which are symmetric and have zeroes down the diagonal looks good. (e) For each of the six different difference measures, what is the average distance between stories in the same category and between stories in different categories? (Include the R command you use to compute this don t do it by hand!) Answer: There are multiple ways to do this. The simplest is to realize that, in this case, the first 57 stories are all art, and the last 45 are all music. So if d is a distance matrix, the within-category entries are d[1:57,1:57] and d[58:102,58:102], and the betweencategory entries are d[1:57,58:102]. So mean(c(d[1:57,1:57],d[58:102,58:102])) would give the average distance between stories in the same category, similarly mean(d[58:102,1:57]) for the between-category average. Of course, that trick relies on the categories forming two solid blocks. Here s another which isn t quite so fragile. First, we create a vector which gives the class labels. class.labels = c(rep("art",57),rep("music",45)) Now create a logical matrix which says whether or not two documents belong to different classes. are.different = outer(class.labels,class.labels,"!=") The outer() function takes three arguments: two data-structures and another function. (Here the function is!=, which I put in quotes so that R realizes I m naming a function, and not asking it to evaluate an expression.) It returns a matrix which it gets from applying the function to each pair of components from its first two arguments. Here those first two arguments are vectors of length 102, so what it gives back is a matrix, where are.different[i,j] shows whether class.label[i]!= class.label[j]. In other words, it s TRUE if documents i and j belong to different classes. And a logical array picks out elements from another array: mean(d[are.different]) is the average distance between classes. To average within classes, mean(d[!are.different]) Not only does this work if the classes are intermingled (we just have to get the class.labels vector right), we can also use this to not include the distance from a document to itself in the within-class average: are.same =!are.different diag(are.same) = FALSE mean(d[are.same]) 6

7 Mean distance without IDF with IDF plain sum-normed length-normed plain sum-normed length-normed within-class, with self within-class, without self between-class This makes for a fairer comparison of the in-class and cross-class averages, but there s no penalty on this homework for not doing this. 7

8 (f) Create multidimensional scaling plots for the different distances, and describe what you see. Include the code you used, the plots, and explanations for the code. Answer: I ll use the basic command cmdscale(), which returns a matrix whose columns give the new coordinates. In fact, I wrote a function which calls cmdscale(), and then plots the points with different colors and/or shapes for the different classes. This exploits the useful graphics trick that if you can control the color and shape of individual points by making the col and pch arguments to the plotting command into vectors. # Multidimensional-scaling plot for labeled points, with color and/or shape # indicating classes # Inputs: Distance matrix (distances) # vector of class labels (labels) # vector of class color names (class.colors) # defaults to red and blue # vector of class point shapes (class.shapes) --- see?pch # defaults to circles and squares # optional plotting parameters # Calls: cmdscale() # Output: invisibly returns matrix of coordinates for the MDS image points my.mds <- function(distances, labels,class.colors=c("red","blue"), class.shapes=c(21,22),...) { # Should really check that: # distances is a matrix of non-negative numbers, size = (length of labels)^2 # class.colors and class.shapes have reasonable lengths label.values = unique(labels) # What are the different labels? names(class.colors) = label.values # Allows access by class value as opposed names(class.shapes) = label.values # to just position num.labels = length(label.values) # Re-cycle the colors if need be # Useful if we want to have only one color but multiple shapes if (length(class.colors) < num.labels) { class.colors = rep(class.colors,length.out=num.labels) # Ditto shapes if (length(class.shapes) < num.labels) { class.shapes = rep(class.shapes,length.out=num.labels) cols.vec = class.colors[labels] # Vector giving class colors in order shapes.vec = class.shapes[labels] # Ditto shapes mds.coords = cmdscale(distances) # Get the MDS coordinates plot(mds.coords,col=cols.vec,pch=shapes.vec,...) # Actual plotting return(invisible(mds.coords)) 8

9 No normalization, no weighting Word-count normalization, no weighting Euclidean length normalization, no weighting mds.coords[,2] mds.coords[,2] mds.coords[,2] mds.coords[,1] mds.coords[,1] mds.coords[,1] No normalization, IDF weighting Word-count normalization, IDF weighting Euclidean length normalization, IDF weighting mds.coords[,2] mds.coords[,2] mds.coords[,2] mds.coords[,1] mds.coords[,1] mds.coords[,1] Figure 1: MDS plots. Top row, without IDF. Bottom row, with IDF. Left column, un-normalized vectors. Middle column, normalized by word-count. Right column, normalized by Euclidean length. Red circles are art, blue squares music. Only with both IDF weights and Euclidean-length normalization do we get anything like a reasonable separate of the two categories though admittedly in some cases the view is obscured by a few outliers, which seem to compress the other points into a single blob. 9

10 4. Comment the sq.euc.dist function that is, go over it and explain, in English, what each line does, and how the lines work together to calculate the function. Answer: The key observation is that x y 2 = x 2 2 x y + y 2 for any vectors x and y. (Exercise: show this!) The function uses this to efficiently compute the squared distance, avoiding explicit iteration loops (which are slow in R) and avoid computing the same x 2 and y 2 terms over and over again. sq.euc.dist <- function(x,y=x) { # Set default value for second argument x <- as.matrix(x) # Convert argument to a matrix to make sure it can be # manipulated as such y <- as.matrix(y) # Ditto nr=nrow(x) # Count the number of rows of the first argument # This is the number of rows in the output matrix nc=nrow(y) # Count number of rows in the second argument # This is the number of COLUMNS in the output x2 <- rowsums(x^2) # Find sum of squares for each x vector xsq = matrix(x2,nrow=nr,ncol=nc) # Make a matrix where each COLUMN is a copy # of x2 --- see help(matrix) for details on # "recycling" of arguments --- matrix is # sized for output y2 <- rowsums(y^2) # Find sum of squares for each y vector # Make a matrix where each ROW is a copy of y2, again sized for output ysq = matrix(y2,nrow=nr,ncol=nc,byrow=true) # Make a matrix whose [i,j] entry is the dot product of x[i,] and y[j,] xy = x %*% t(y) # You should check that this has nr rows and nc columns! d = xsq + ysq - 2*xy # Add partial result matrices # Remember that for vectors x and y # x-y ^2 = x ^2-2x*y + y ^2 # writing * for the dot product. So d has as its [i,j] entry the squared # norm of x[i,] plus the squared norm of y[j,] minus twice their dot product # Make the diagonal EXACTLY zero if the two arguments are the same if(identical(x,y)) diag(d) = 0 # Need to use the identical() function to see if two whole objects are the # same --- using "x==y" here would give a MATRIX of Boolean values # Distances are >= 0, negative values are presumably from numerical errors in # calculating numbers close to zero; fix them d[which(d < 0)] = 0 return(d) # Return the tidied-up matrix of squared distances This is more detailed than it strictly needs to be. 10

11 5. (a) Explain what the cosine distance has to do with cosines. Answer: From vector algebra, we know that for any vectors x and y, x y x i y i = x y cos θ i where θ is the angle between the vectors. The cosine distance is the dot product divided by the product of the norms, so it s that cosine. (b) Calculate, by hand, the cosine distances between the three vectors in question 2. Answer: The cosine distance between the first and the third vector is clearly 1, and between either of them and the second vector is (c) Write a function to calculate the matrix of cosine distances (really, similarities) between all the vectors in a data-frame. Hint: you may want to use the distances function. Check that your function agrees with your answer to the previous part. Answer: The distances function can take an optional argument which is a function to apply to each pair of vectors from the two matrices. So first let s define functions which compute the dot product, Euclidean norm, and the cosine distance for a pair of vectors. dot.product = function(x,y) { return(sum(x*y)) # With vectors, * does component-by-component multiplication euc.norm = function(x) { return(sqrt(dot.product(x,x))) cosine.dist.pair = function(x,y) { return(dot.product(x,y)/(euc.norm(x)*euc.norm(y))) Now our real function is easy: cosine.dist.1 = function(x) { return(distances(x,fun=cosine.dist.pair)) This is not the slickest way to do it, because we calculate the norm of each vector 2n 1 times. (Exercise: Why is it 2n 1?) This is faster, at least when n is large: cosine.dist.2 = function(x) { y = div.by.euc.length(x) return(distances(y,fun=dot.product)) 11

12 Exercise: Why does this work? How does this avoid recomputing the norms of the vectors? Let s check this: > question2vectors <- matrix(c(1,0,0,1,4,5,10,0,0),nrow=3,byrow=true) > question2vectors [,1] [,2] [,3] [1,] [2,] [3,] > round(cosine.dist.1(question2vectors),2) [,1] [,2] [,3] [1,] [2,] [3,] > round(cosine.dist.2(question2vectors),2) [,1] [,2] [,3] [1,] [2,] [3,] so both versions work. 6. Write a function to find the document which best matches a given query string. The function should take two arguments, (1) The query, as a single character string, and (2) the bag-of-words matrix, and return the row number corresponding to the best-matching document. You can pick the distance measurement, but you should include inverse document-frequency weighting. Answer: The easiest way to do this is to use the nearest.points function in the provided code. The one tricky bit is making sure that the query string is turned into a bag-of-words vector using the same dictionary as the documents. The R manipulations here are based on the ones which standardize.ragged, in 01.R, uses to ensure that all the stories have a common lexicon. # Return the index of the document which best matches a given query string # First we convert the query string into a document vector, then into # a bag of words, and then we remove terms not in the lexicon of the data # frame storing the bag-of-words vectors for the documents # Note that these last removed words add the same amount to the (squared) # distance between the query and any document s bag of words, so those words # do not change which document is closest # Inputs: query, as a character vector (query) # data frame of bag-of-word vectors (BoW.frame) # Presumes: a data frame has been created for bag-of-word vectors, column # names being words 12

13 # Calls: strip.text(), get.idf.weight(), nearest.points() # Output: Index of the document, name of the corresponding row in data frame query.by.similarity <- function(query,bow.frame) { # Prepare the query BoW vector for comparison with the target documents query.vec = strip.text(query) # Turn the query into a vector of words query.bow = table(query.vec) # Turn it into a bag of words lexicon = colnames(bow.frame) # PRESUMES: BoW.frame has been made so words are # the column names query.vocab = names(query.bow) # What words appear in the query? # Restrict the query to words in the lexicon query.lex = query.bow[intersect(query.vocab,lexicon)] # Add zero entries for lexicon words not found in the query query.lex[setdiff(lexicon,query.vocab)] = 0 # query.lex now has all the right entries, but the words are out of order! query.lex = query.lex[lexicon] # Why does that work? # Finally, turn it into a one-row matrix q = t(as.matrix(query.lex)) # Do IDF scaling on the targets AND the query # The function idf.weight calculates the weights and re-scales the # data-frame but we need the weights to re-scale the query as well so we # write our own function get.idf.weights() --- see below # Get the weights idf = get.idf.weights(bow.frame) # Scale the columns in BoW.frame BoW = scale.cols(bow.frame,idf) # Scale the columns in q q = q * idf # Scale the rows by Euclidean length BoW = div.by.euc.length(bow) # Ditto the query q = q/sqrt(sum(q^2)) # Find the closest match between q and BoW.idf best.index = nearest.points(q,bow)$which # Use row names from the data for a little extra comprehensibility best.name = rownames(bow)[best.index] return(list(best.index=best.index,best.name=best.name)) # Return the vector of IDF weights from a data frame # The core of idf.weight(), but leaving out the actual re-scaling # Input: data frame # Output: weight vector get.idf.weights <- function(x) { 13

14 doc.freq <- colsums(x>0) doc.freq[doc.freq == 0] <- 1 w <- log(nrow(x)/doc.freq) return(w) Just having the row-number of the matching story is not quite so useful as having a more mnemonic label too, so I ve set the code up to also return row names. Let s make them: rownames(nyt.frame) = c(outer("art",1:57,paste,sep="."), outer("music",1:45,paste,sep=".")) We saw outer() already: the first instance here is going to create a vector reading art.1, art.2,...art.57, which will then be concatenated with music.1, music.2,...music.45, and this vector, of length 102, will become the row-names of the data frame. Testing: > query.by.similarity(art[[5]],nyt.frame) $best.index [1] 5 $best.name [1] "art.5" > query.by.similarity(art[[40]],nyt.frame) $best.index [1] 40 $best.name [1] "art.40" > query.by.similarity(music[[12]],nyt.frame) $best.index [1] 69 $best.name [1] "music.12" > query.by.similarity(music[[31]],nyt.frame) $best.index [1] 88 $best.name [1] "music.31" So it passes the basic check, and gives reasonable results for queries like abstract expressionism and rhythm and blues. 14

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

CS246: Mining Massive Datasets Jure Leskovec, Stanford University CS46: Mining Massive Datasets Jure Leskovec, Stanford University http://cs46.stanford.edu /7/ Jure Leskovec, Stanford C46: Mining Massive Datasets Many real-world problems Web Search and Text Mining Billions

More information

Near Neighbor Search in High Dimensional Data (1) Dr. Anwar Alhenshiri

Near Neighbor Search in High Dimensional Data (1) Dr. Anwar Alhenshiri Near Neighbor Search in High Dimensional Data (1) Dr. Anwar Alhenshiri Scene Completion Problem The Bare Data Approach High Dimensional Data Many real-world problems Web Search and Text Mining Billions

More information

Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ x + 5y + 7z 9x + 3y + 11z

Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ x + 5y + 7z 9x + 3y + 11z Basic Linear Algebra Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ 1 5 ] 7 9 3 11 Often matrices are used to describe in a simpler way a series of linear equations.

More information

MAT 003 Brian Killough s Instructor Notes Saint Leo University

MAT 003 Brian Killough s Instructor Notes Saint Leo University MAT 003 Brian Killough s Instructor Notes Saint Leo University Success in online courses requires self-motivation and discipline. It is anticipated that students will read the textbook and complete sample

More information

Catalan Numbers. Table 1: Balanced Parentheses

Catalan Numbers. Table 1: Balanced Parentheses Catalan Numbers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 00 We begin with a set of problems that will be shown to be completely equivalent. The solution to each problem

More information

Mathematics 308 Geometry. Chapter 9. Drawing three dimensional objects

Mathematics 308 Geometry. Chapter 9. Drawing three dimensional objects Mathematics 308 Geometry Chapter 9. Drawing three dimensional objects In this chapter we will see how to draw three dimensional objects with PostScript. The task will be made easier by a package of routines

More information

Section 4.1: Introduction to Trigonometry

Section 4.1: Introduction to Trigonometry Section 4.1: Introduction to Trigonometry Review of Triangles Recall that the sum of all angles in any triangle is 180. Let s look at what this means for a right triangle: A right angle is an angle which

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

2.3 Algorithms Using Map-Reduce

2.3 Algorithms Using Map-Reduce 28 CHAPTER 2. MAP-REDUCE AND THE NEW SOFTWARE STACK one becomes available. The Master must also inform each Reduce task that the location of its input from that Map task has changed. Dealing with a failure

More information

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

CS246: Mining Massive Datasets Jure Leskovec, Stanford University CS246: Mining Massive Datasets Jure Leskovec, Stanford University http://cs246.stanford.edu /2/8 Jure Leskovec, Stanford CS246: Mining Massive Datasets 2 Task: Given a large number (N in the millions or

More information

Technical Arts 101 Prof. Anupam Saxena Department of Mechanical engineering Indian Institute of Technology, Kanpur. Lecture - 7 Think and Analyze

Technical Arts 101 Prof. Anupam Saxena Department of Mechanical engineering Indian Institute of Technology, Kanpur. Lecture - 7 Think and Analyze Technical Arts 101 Prof. Anupam Saxena Department of Mechanical engineering Indian Institute of Technology, Kanpur Lecture - 7 Think and Analyze Last time I asked you to come up with a single funniest

More information

Hexadecimal Numbers. Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those?

Hexadecimal Numbers. Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those? 9/10/18 1 Binary and Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those? Hexadecimal Numbers Check Homework 3 Binary Numbers A binary (base-two) number

More information

Answers. Chapter 2. 1) Give the coordinates of the following points:

Answers. Chapter 2. 1) Give the coordinates of the following points: Answers Chapter 2 1) Give the coordinates of the following points: a (-2.5, 3) b (1, 2) c (2.5, 2) d (-1, 1) e (0, 0) f (2, -0.5) g (-0.5, -1.5) h (0, -2) j (-3, -2) 1 2) List the 48 different possible

More information

Vector Calculus: Understanding the Cross Product

Vector Calculus: Understanding the Cross Product University of Babylon College of Engineering Mechanical Engineering Dept. Subject : Mathematics III Class : 2 nd year - first semester Date: / 10 / 2016 2016 \ 2017 Vector Calculus: Understanding the Cross

More information

Section 1.1 Definitions and Properties

Section 1.1 Definitions and Properties Section 1.1 Definitions and Properties Objectives In this section, you will learn to: To successfully complete this section, you need to understand: Abbreviate repeated addition using Exponents and Square

More information

Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi.

Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi. Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 18 Tries Today we are going to be talking about another data

More information

Pointers. A pointer is simply a reference to a variable/object. Compilers automatically generate code to store/retrieve variables from memory

Pointers. A pointer is simply a reference to a variable/object. Compilers automatically generate code to store/retrieve variables from memory Pointers A pointer is simply a reference to a variable/object Compilers automatically generate code to store/retrieve variables from memory It is automatically generating internal pointers We don t have

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #16 Loops: Matrix Using Nested for Loop In this section, we will use the, for loop to code of the matrix problem.

More information

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015 SCHEME 7 COMPUTER SCIENCE 61A October 29, 2015 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2012 Lab 3 Matrix Math Introduction Reading In this lab you will write a

More information

Algebraic Specifications

Algebraic Specifications Object-Oriented Design Lecture 2 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 11, 2007 Algebraic Specifications Last time I said a word about the abstraction barrier, separating the clients from the implementors.

More information

Calculus II. Step 1 First, here is a quick sketch of the graph of the region we are interested in.

Calculus II. Step 1 First, here is a quick sketch of the graph of the region we are interested in. Preface Here are the solutions to the practice problems for my Calculus II notes. Some solutions will have more or less detail than other solutions. As the difficulty level of the problems increases less

More information

CSE 547: Machine Learning for Big Data Spring Problem Set 2. Please read the homework submission policies.

CSE 547: Machine Learning for Big Data Spring Problem Set 2. Please read the homework submission policies. CSE 547: Machine Learning for Big Data Spring 2019 Problem Set 2 Please read the homework submission policies. 1 Principal Component Analysis and Reconstruction (25 points) Let s do PCA and reconstruct

More information

Instructor: Stefan Savev

Instructor: Stefan Savev LECTURE 2 What is indexing? Indexing is the process of extracting features (such as word counts) from the documents (in other words: preprocessing the documents). The process ends with putting the information

More information

Section 1.8. Simplifying Expressions

Section 1.8. Simplifying Expressions Section 1.8 Simplifying Expressions But, first Commutative property: a + b = b + a; a * b = b * a Associative property: (a + b) + c = a + (b + c) (a * b) * c = a * (b * c) Distributive property: a * (b

More information

Printing Envelopes in Microsoft Word

Printing Envelopes in Microsoft Word Printing Envelopes in Microsoft Word P 730 / 1 Stop Addressing Envelopes by Hand Let Word Print Them for You! One of the most common uses of Microsoft Word is for writing letters. With very little effort

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #43 Multidimensional Arrays In this video will look at multi-dimensional arrays. (Refer Slide Time: 00:03) In

More information

Topic C. Communicating the Precision of Measured Numbers

Topic C. Communicating the Precision of Measured Numbers Topic C. Communicating the Precision of Measured Numbers C. page 1 of 14 Topic C. Communicating the Precision of Measured Numbers This topic includes Section 1. Reporting measurements Section 2. Rounding

More information

Clustering. Distance Measures Hierarchical Clustering. k -Means Algorithms

Clustering. Distance Measures Hierarchical Clustering. k -Means Algorithms Clustering Distance Measures Hierarchical Clustering k -Means Algorithms 1 The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of

More information

Assignment 6: Ray Tracing

Assignment 6: Ray Tracing Assignment 6: Ray Tracing Programming Lab Due: Monday, April 20 (midnight) 1 Introduction Throughout this semester you have written code that manipulated shapes and cameras to prepare a scene for rendering.

More information

1 Introduction to Matlab

1 Introduction to Matlab 1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,

More information

General Instructions. Questions

General Instructions. Questions CS246: Mining Massive Data Sets Winter 2018 Problem Set 2 Due 11:59pm February 8, 2018 Only one late period is allowed for this homework (11:59pm 2/13). General Instructions Submission instructions: These

More information

: Intro Programming for Scientists and Engineers Final Exam

: Intro Programming for Scientists and Engineers Final Exam Final Exam Page 1 of 6 600.112: Intro Programming for Scientists and Engineers Final Exam Peter H. Fröhlich phf@cs.jhu.edu December 20, 2012 Time: 40 Minutes Start here: Please fill in the following important

More information

Unit 1, Lesson 1: Moving in the Plane

Unit 1, Lesson 1: Moving in the Plane Unit 1, Lesson 1: Moving in the Plane Let s describe ways figures can move in the plane. 1.1: Which One Doesn t Belong: Diagrams Which one doesn t belong? 1.2: Triangle Square Dance m.openup.org/1/8-1-1-2

More information

A GENTLE INTRODUCTION TO THE BASIC CONCEPTS OF SHAPE SPACE AND SHAPE STATISTICS

A GENTLE INTRODUCTION TO THE BASIC CONCEPTS OF SHAPE SPACE AND SHAPE STATISTICS A GENTLE INTRODUCTION TO THE BASIC CONCEPTS OF SHAPE SPACE AND SHAPE STATISTICS HEMANT D. TAGARE. Introduction. Shape is a prominent visual feature in many images. Unfortunately, the mathematical theory

More information

CSE 494: Information Retrieval, Mining and Integration on the Internet

CSE 494: Information Retrieval, Mining and Integration on the Internet CSE 494: Information Retrieval, Mining and Integration on the Internet Midterm. 18 th Oct 2011 (Instructor: Subbarao Kambhampati) In-class Duration: Duration of the class 1hr 15min (75min) Total points:

More information

STAT 113: R/RStudio Intro

STAT 113: R/RStudio Intro STAT 113: R/RStudio Intro Colin Reimer Dawson Last Revised September 1, 2017 1 Starting R/RStudio There are two ways you can run the software we will be using for labs, R and RStudio. Option 1 is to log

More information

Animations that make decisions

Animations that make decisions Chapter 17 Animations that make decisions 17.1 String decisions Worked Exercise 17.1.1 Develop an animation of a simple traffic light. It should initially show a green disk; after 5 seconds, it should

More information

(Refer Slide Time 6:48)

(Refer Slide Time 6:48) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about

More information

Animations involving numbers

Animations involving numbers 136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive

More information

Exercise: Graphing and Least Squares Fitting in Quattro Pro

Exercise: Graphing and Least Squares Fitting in Quattro Pro Chapter 5 Exercise: Graphing and Least Squares Fitting in Quattro Pro 5.1 Purpose The purpose of this experiment is to become familiar with using Quattro Pro to produce graphs and analyze graphical data.

More information

5 R1 The one green in the same place so either of these could be green.

5 R1 The one green in the same place so either of these could be green. Page: 1 of 20 1 R1 Now. Maybe what we should do is write out the cases that work. We wrote out one of them really very clearly here. [R1 takes out some papers.] Right? You did the one here um where you

More information

Polar Coordinates. 2, π and ( )

Polar Coordinates. 2, π and ( ) Polar Coordinates Up to this point we ve dealt exclusively with the Cartesian (or Rectangular, or x-y) coordinate system. However, as we will see, this is not always the easiest coordinate system to work

More information

MITOCW watch?v=4dj1oguwtem

MITOCW watch?v=4dj1oguwtem MITOCW watch?v=4dj1oguwtem PROFESSOR: So it's time to examine uncountable sets. And that's what we're going to do in this segment. So Cantor's question was, are all sets the same size? And he gives a definitive

More information

Meeting 1 Introduction to Functions. Part 1 Graphing Points on a Plane (REVIEW) Part 2 What is a function?

Meeting 1 Introduction to Functions. Part 1 Graphing Points on a Plane (REVIEW) Part 2 What is a function? Meeting 1 Introduction to Functions Part 1 Graphing Points on a Plane (REVIEW) A plane is a flat, two-dimensional surface. We describe particular locations, or points, on a plane relative to two number

More information

Structures of Expressions

Structures of Expressions SECONDARY MATH TWO An Integrated Approach MODULE 2 Structures of Expressions The Scott Hendrickson, Joleigh Honey, Barbara Kuehl, Travis Lemon, Janet Sutorius 2017 Original work 2013 in partnership with

More information

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology Intermediate Algebra Gregg Waterman Oregon Institute of Technology c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license

More information

CS195H Homework 1 Grid homotopies and free groups. Due: February 5, 2015, before class

CS195H Homework 1 Grid homotopies and free groups. Due: February 5, 2015, before class CS195H Homework 1 Grid homotopies and free groups This second homework is almost all about grid homotopies and grid curves, but with a little math in the middle. This homework, last year, took people about

More information

Lecture 6: Arithmetic and Threshold Circuits

Lecture 6: Arithmetic and Threshold Circuits IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 6: Arithmetic and Threshold Circuits David Mix Barrington and Alexis Maciel July

More information

Lecture 7: Arnold s Cat Map

Lecture 7: Arnold s Cat Map Lecture 7: Arnold s Cat Map Reference http://www.chaos.umd.edu/misc/catmap.html https://www.jasondavies.com/catmap/ Chaotic Maps: An Introduction A popular question in mathematics is how to analyze and

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

Lab copy. Do not remove! Mathematics 152 Spring 1999 Notes on the course calculator. 1. The calculator VC. The web page

Lab copy. Do not remove! Mathematics 152 Spring 1999 Notes on the course calculator. 1. The calculator VC. The web page Mathematics 152 Spring 1999 Notes on the course calculator 1. The calculator VC The web page http://gamba.math.ubc.ca/coursedoc/math152/docs/ca.html contains a generic version of the calculator VC and

More information

Teachers Teaching with Technology (Scotland) Teachers Teaching with Technology. Scotland T 3. Matrices. Teachers Teaching with Technology (Scotland)

Teachers Teaching with Technology (Scotland) Teachers Teaching with Technology. Scotland T 3. Matrices. Teachers Teaching with Technology (Scotland) Teachers Teaching with Technology (Scotland) Teachers Teaching with Technology T 3 Scotland Matrices Teachers Teaching with Technology (Scotland) MATRICES Aim To demonstrate how the TI-83 can be used to

More information

Figure 1. Figure 2. The BOOTSTRAP

Figure 1. Figure 2. The BOOTSTRAP The BOOTSTRAP Normal Errors The definition of error of a fitted variable from the variance-covariance method relies on one assumption- that the source of the error is such that the noise measured has a

More information

Deep Learning for Visual Computing Prof. Debdoot Sheet Department of Electrical Engineering Indian Institute of Technology, Kharagpur

Deep Learning for Visual Computing Prof. Debdoot Sheet Department of Electrical Engineering Indian Institute of Technology, Kharagpur Deep Learning for Visual Computing Prof. Debdoot Sheet Department of Electrical Engineering Indian Institute of Technology, Kharagpur Lecture - 05 Classification with Perceptron Model So, welcome to today

More information

Homework 7: Subsets Due: 11:59 PM, Oct 23, 2018

Homework 7: Subsets Due: 11:59 PM, Oct 23, 2018 CS17 Integrated Introduction to Computer Science Klein Contents Homework 7: Subsets Due: 11:59 PM, Oct 23, 2018 1 Bookends (Practice) 2 2 Subsets 3 3 Subset Sum 4 4 k-subsets 5 5 k-subset Sum 5 Objectives

More information

Function f. Function f -1

Function f. Function f -1 Page 1 REVIEW (1.7) What is an inverse function? Do all functions have inverses? An inverse function, f -1, is a kind of undoing function. If the initial function, f, takes the element a to the element

More information

Loop structures and booleans

Loop structures and booleans Loop structures and booleans Michael Mandel Lecture 7 Methods in Computational Linguistics I The City University of New York, Graduate Center https://github.com/ling78100/lectureexamples/blob/master/lecture07final.ipynb

More information

10/10/13. Traditional database system. Information Retrieval. Information Retrieval. Information retrieval system? Information Retrieval Issues

10/10/13. Traditional database system. Information Retrieval. Information Retrieval. Information retrieval system? Information Retrieval Issues COS 597A: Principles of Database and Information Systems Information Retrieval Traditional database system Large integrated collection of data Uniform access/modifcation mechanisms Model of data organization

More information

1 Counting triangles and cliques

1 Counting triangles and cliques ITCSC-INC Winter School 2015 26 January 2014 notes by Andrej Bogdanov Today we will talk about randomness and some of the surprising roles it plays in the theory of computing and in coding theory. Let

More information

Introduction to Prolog

Introduction to Prolog Introduction to Prolog David Woods dwoods@scss.tcd.ie Week 3 - HT Declarative Logic The Prolog programming language is, at its theoretical core, a declarative language. This is unlike more commonly used

More information

2D/3D Geometric Transformations and Scene Graphs

2D/3D Geometric Transformations and Scene Graphs 2D/3D Geometric Transformations and Scene Graphs Week 4 Acknowledgement: The course slides are adapted from the slides prepared by Steve Marschner of Cornell University 1 A little quick math background

More information

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the

More information

Assignment 3 Functions, Graphics, and Decomposition

Assignment 3 Functions, Graphics, and Decomposition Eric Roberts Handout #19 CS106A October 8, 1999 Assignment 3 Functions, Graphics, and Decomposition Due: Friday, October 15 [In] making a quilt, you have to choose your combination carefully. The right

More information

WEEK 8: FUNCTIONS AND LOOPS. 1. Functions

WEEK 8: FUNCTIONS AND LOOPS. 1. Functions WEEK 8: FUNCTIONS AND LOOPS THOMAS ELLIOTT 1. Functions Functions allow you to define a set of instructions and then call the code in a single line. In R, functions are defined much like any other object,

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

Lab 1 Introduction to MATLAB and Scripts

Lab 1 Introduction to MATLAB and Scripts Lab 1 Introduction to MATLAB and Scripts EE 235: Continuous-Time Linear Systems Department of Electrical Engineering University of Washington The development of these labs was originally supported by the

More information

Knowledge Discovery and Data Mining 1 (VO) ( )

Knowledge Discovery and Data Mining 1 (VO) ( ) Knowledge Discovery and Data Mining 1 (VO) (707.003) Data Matrices and Vector Space Model Denis Helic KTI, TU Graz Nov 6, 2014 Denis Helic (KTI, TU Graz) KDDM1 Nov 6, 2014 1 / 55 Big picture: KDDM Probability

More information

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017 SCHEME 8 COMPUTER SCIENCE 61A March 2, 2017 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

Here is the probability distribution of the errors (i.e. the magnitude of the errorbars):

Here is the probability distribution of the errors (i.e. the magnitude of the errorbars): The BOOTSTRAP Normal Errors The definition of error of a fitted variable from the variance-covariance method relies on one assumption- that the source of the error is such that the noise measured has a

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

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

CPSC 340 Assignment 0 (due Friday September 15 ATE)

CPSC 340 Assignment 0 (due Friday September 15 ATE) CPSC 340 Assignment 0 (due Friday September 5 ATE) Rationale for Assignment 0 : CPSC 340 is tough because it combines knowledge and skills across several disciplines. To succeed in the course, you will

More information

% Now, do your feature extraction here and store the features in some matrix / array

% Now, do your feature extraction here and store the features in some matrix / array MIR Course 2010 Page 1 Lab 3 Monday, June 22, 2009 4:50 PM PURPOSE Sometimes, an unsupervised learning technique is preferred. Perhaps you do not have access to adequate training data. Or perhaps the classifications

More information

MATLAB TUTORIAL WORKSHEET

MATLAB TUTORIAL WORKSHEET MATLAB TUTORIAL WORKSHEET What is MATLAB? Software package used for computation High-level programming language with easy to use interactive environment Access MATLAB at Tufts here: https://it.tufts.edu/sw-matlabstudent

More information

Statistics Case Study 2000 M. J. Clancy and M. C. Linn

Statistics Case Study 2000 M. J. Clancy and M. C. Linn Statistics Case Study 2000 M. J. Clancy and M. C. Linn Problem Write and test functions to compute the following statistics for a nonempty list of numeric values: The mean, or average value, is computed

More information

y= sin( x) y= cos( x)

y= sin( x) y= cos( x) . The graphs of sin(x) and cos(x). Now I am going to define the two basic trig functions: sin(x) and cos(x). Study the diagram at the right. The circle has radius. The arm OP starts at the positive horizontal

More information

NURBS: Non-Uniform Rational B-Splines AUI Course Denbigh Starkey

NURBS: Non-Uniform Rational B-Splines AUI Course Denbigh Starkey NURBS: Non-Uniform Rational B-Splines AUI Course Denbigh Starkey 1. Background 2 2. Definitions 3 3. Using NURBS to define a circle 4 4. Homogeneous coordinates & control points at infinity 9 5. Constructing

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

More information

Congruence Arithmetic

Congruence Arithmetic Module 4 Congruence Arithmetic Popper 4 Introduction to what is like Modulus choices Partitions by modulus Mod 5 Mod 7 Mod 30 Modular Arithmetic Addition Subtraction Multiplication INTEGERS! Mod 12 Cayley

More information

Basics of Computational Geometry

Basics of Computational Geometry Basics of Computational Geometry Nadeem Mohsin October 12, 2013 1 Contents This handout covers the basic concepts of computational geometry. Rather than exhaustively covering all the algorithms, it deals

More information

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal. Chapter 8 out of 7 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal 8 Matrices Definitions and Basic Operations Matrix algebra is also known

More information

Maple for Math Majors. 12. Data Structures in Maple

Maple for Math Majors. 12. Data Structures in Maple Maple for Math Majors Roger Kraft Department of Mathematics, Computer Science, and Statistics Purdue University Calumet roger@calumet.purdue.edu 12.1. Introduction 12. Data Structures in Maple We have

More information

Improving the crab: more sophisticated programming

Improving the crab: more sophisticated programming Chapter 3 Improving the crab: more sophisticated programming topics: concepts: random behavior, keyboard control, sound dot notation, random numbers, defining methods, comments In the previous chapter,

More information

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 02 Lecture - 45 Memoization

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 02 Lecture - 45 Memoization Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute Module 02 Lecture - 45 Memoization Let us continue our discussion of inductive definitions. (Refer Slide Time: 00:05)

More information

vector space retrieval many slides courtesy James Amherst

vector space retrieval many slides courtesy James Amherst vector space retrieval many slides courtesy James Allan@umass Amherst 1 what is a retrieval model? Model is an idealization or abstraction of an actual process Mathematical models are used to study the

More information

Chapter 1. Unit 1: Transformations, Congruence and Similarity

Chapter 1. Unit 1: Transformations, Congruence and Similarity www.ck12.org Chapter 1. Unit 1: Transformations, Congruence and Similarity 1.16 Vertical Angles Here you ll learn to identify adjacent and vertical angles formed by intersecting lines and then find missing

More information

Clustering and Visualisation of Data

Clustering and Visualisation of Data Clustering and Visualisation of Data Hiroshi Shimodaira January-March 28 Cluster analysis aims to partition a data set into meaningful or useful groups, based on distances between data points. In some

More information

Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018

Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Contents Overview 2 Generating random numbers 2 rnorm() to generate random numbers from

More information

(Refer Slide Time: 00:04:20)

(Refer Slide Time: 00:04:20) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 8 Three Dimensional Graphics Welcome back all of you to the lectures in Computer

More information

1-D Time-Domain Convolution. for (i=0; i < outputsize; i++) { y[i] = 0; for (j=0; j < kernelsize; j++) { y[i] += x[i - j] * h[j]; } }

1-D Time-Domain Convolution. for (i=0; i < outputsize; i++) { y[i] = 0; for (j=0; j < kernelsize; j++) { y[i] += x[i - j] * h[j]; } } Introduction: Convolution is a common operation in digital signal processing. In this project, you will be creating a custom circuit implemented on the Nallatech board that exploits a significant amount

More information

Drawing curves automatically: procedures as arguments

Drawing curves automatically: procedures as arguments CHAPTER 7 Drawing curves automatically: procedures as arguments moveto lineto stroke fill clip The process of drawing curves by programming each one specially is too complicated to be done easily. In this

More information

CSE/NEUBEH 528 Homework 0: Introduction to Matlab

CSE/NEUBEH 528 Homework 0: Introduction to Matlab CSE/NEUBEH 528 Homework 0: Introduction to Matlab (Practice only: Do not turn in) Okay, let s begin! Open Matlab by double-clicking the Matlab icon (on MS Windows systems) or typing matlab at the prompt

More information

2D and 3D Transformations AUI Course Denbigh Starkey

2D and 3D Transformations AUI Course Denbigh Starkey 2D and 3D Transformations AUI Course Denbigh Starkey. Introduction 2 2. 2D transformations using Cartesian coordinates 3 2. Translation 3 2.2 Rotation 4 2.3 Scaling 6 3. Introduction to homogeneous coordinates

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has.

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has. ASSIGNMENT 0 Introduction to Linear Algebra (Basics of vectors and matrices) Due 3:30 PM, Tuesday, October 10 th. Assignments should be submitted via e-mail to: matlabfun.ucsd@gmail.com You can also submit

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

BEE 235 Continuous-Time Linear Systems

BEE 235 Continuous-Time Linear Systems BEE 235 Continuous-Time Linear Systems Lab 2 Functions in MATLAB and Playing Sounds This work was written by Amittai Axelrod, Jayson Bowen, and Maya Gupta, and is licensed under the Creative Commons Attribution

More information

n! = 1 * 2 * 3 * 4 * * (n-1) * n

n! = 1 * 2 * 3 * 4 * * (n-1) * n The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion Objectives By completing this lab exercise, you should learn to Recognize simple self-similar problems which are

More information