review_2

# review_2 - CS 103 J Michael Fitzpatrick Test 2 Review Page...

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

CS 103 J. Michael Fitzpatrick Test 2 Review Page 1 of 6 Review 2: Weeks 1-8 Textbook Coverage = Chapters 1-7 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.

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

View Full Document
CS 103 J. Michael Fitzpatrick Test 2 Review Page 2 of 6 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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

review_2 - CS 103 J Michael Fitzpatrick Test 2 Review Page...

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

View Full Document
Ask a homework question - tutors are online