review_3 - CS 103 J. Michael Fitzpatrick Test 3 Review Page...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 103 J. Michael Fitzpatrick Test 3 Review Page 1 of 10 Review 3: All 14 Weeks Textbook Coverage = Chapters 1-12 (entire book) Lecture Coverage ( Purple things were de-emphasized. ) Week 1 Computer science is the study of algorithms for processing information with computers. An algorithm is a precise step-by-step procedure for performing a task. Syntax vs. Semantics Interpret vs. Compile Variables o Rules for naming variables: o The = sign assigns a value to a variable Matrix is a two dimensional rectangular arrangement of numbers o size(M) K x N ~ matrix N x 1 or 1 x N ~ vector or array 1 x 1 ~ scalar o Matrix elements are referenced by their row and column numbers ex: A(2,1) ~ element in the second row, first column. o Matrix Multiplication o Transpose Operators and Functions o Passing input values via arguments o In computer programming, a function doesn’t have to give a unique value. o rand is a “pseudo” random number generator Colon operator o Increments can be negative! C = 10 : -.5 : 1 o Can be combined with arithmetic operations: pi*(2:0.03:7)-8 Week 2 A program is a sequence of symbols that describes an algorithm. Source code vs. executable code Software = set of files containing source, and/or executable Colon operator (continued) Complex numbers Subarray operations: example, A(2:4,4:end-1) 3D arrays: example, color image representation Matrix multiplication : Z=X*Y : end 1 ( , ) ( , ) ( , ) k Z m n X m k Y k n = = o “Inner matrix dimensions” must be equal.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 103 J. Michael Fitzpatrick Test 3 Review Page 2 of 10 o “Outer matrix dimensions” determine shape of result. o Not commutative: A*B usually not = B*A o Is associative: A*(B*C) = (A*B)*C Problems involving manufacturing materials Addition: Z=X+Y X, Y , and Z have same shape, and ( , ) ( , ) ( , ) Z m n X m n Y m n = + Subtraction: Z=X-Y X, Y , and Z have same shape, and ( , ) ( , ) ( , ) Z m n X m n Y m n = - Array multiplication: Z = X.*Y X, Y , and Z have same shape, and ( , ) ( , ) ( , ) Z m n X m n Y m n = Array division : Z = X./Y or X.\Y X, Y , and Z have same shape, and ( , ) ( , )/ ( , ) Z m n X m n Y m n = or ( , ) ( , ) \ ( , ) Z m n X m n Y m n = Dot product Distributivity: o Multiplication distributes over addition: example, A*(B+C) = A*B + A*C example, (B+C). *A = B.*A + C.*A o Array division distributes over addition one way example, A./(B+C) not equal to A./B + A./C example, (B+C)./A = B./A + C./A Array exponentiation : Z=X.^Y (also called “array power”) X, Y , and Z have same shape, and ( , ) ( , ) ( , ) Y m n Z m n X m n = Matrix exponentiation : Z=X^p ( we don’t cover p^X ) X is square and p is a scalar (if X and p are matrices, error !) Diagonal matrix Identity matrix: eye(N) Inverse of a matrix: X^(-1) or inv(X) o inverseX*X = X*inverseX = identity matrix Operators (e,g, +, -, *, /, .*, ./, ^, ‘ ) o
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

review_3 - CS 103 J. Michael Fitzpatrick Test 3 Review Page...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online