Professional Documents
Culture Documents
EPE821 Lecture2
EPE821 Lecture2
CB C is a subset of B.
( a, b) {x R | a x b} open interval
[ a, b) {x R | a x b} half-open interval
( a, b] {x R | a x b} half-open interval
EPE 821 Lecture 2 5
Set Theory
For real numbers a,b with a<b
[ a, b] {x R | a x b} closed interval
( a, b) {x R | a x b} open interval
[ a, b) {x R | a x b} half-open interval
( a, b] {x R | a x b} half-open interval
Domain: In a set of ordered pairs, (x, y), the domain is the set of all x-
coordinates.
Range: In a set of ordered pairs, (x, y), the range is the set of all y-
coordinates.
Example: f ( x) x 2 5
Domain: All Real
Range: {y: y≥-5}
n n!
C (n, r )
r r !(n r )!
n P(n, r ) n! /( n r )! n!
C (n, r )
r P(r , r ) r! r!(n r )!
EPE 821 Lecture 2 10
Linear Algebra
“Algebra” means, roughly, “relationships”.
“Linear Algebra” means, roughly, “line-like relationships”.
If 3 feet forward has a 1-foot rise, then going 10x as far should give a 10x
rise (30 feet forward is a 10-foot rise)
Think of a vector as a directed line segment y a
in N-dimensions! (has “length” and
“direction”) v v b
Basic idea: convert geometry in higher
dimensions into algebra!
x
c
Once you define a “nice” basis along
each dimension: x-, y-, z-axis …
Vector becomes a 1 x N matrix!
v = [a b c]T
Geometry starts to become linear
algebra on vectors like v!
Matrix operation (Av) can change length, direction and also dimensionality!
v ( x1 , x2 , , xn ) T
n
v x
2
i
(Magnitude or “2-
i 1
norm”)
If v 1, v is a unit vector
||v||
“phase”
x
EPE 821 Lecture 2 14
Linear Algebra
Vector norm
Forann-dimensionalvector x [ x1 x2 ... xn ]
1/ p
p
thevectornorm: x p x p
xi ; p 1, 2,...
i
Specialcase : x max xi
i
3. x y x y
L3 – norm |v|3 361/33.3
L – norm |v| 3
0 1 1 0 (reflection)
1 0 0 1
1 0 1 1 (projection)
0 0 1 0
1 c x x cy (shearing)
0 1 y y
EPE 821 Lecture 2 16
Linear Algebra
Matrices as sets of constraints x y z 1 x
1 1 1 1
y
2 1 1 z 2
Special matrices 2x y z 2
a 0 0 a b c a b 0 0 1 0 0
a 0 0
0 b 0 0 d e c d e 0 0 1 0
0 0 b c 0 0 f g h 0 0 1
0 0 c f d
e f 0
0 i j
Symmetric Matrix: AT = A
Identity Matrix: A square matrix whose diagonal elements are all 1 and off-
diagonal elements are all zero. Denoted by I.
Null Matrix: A matrix whose all elements are zero.
EPE 821 Lecture 2 17
Linear Algebra
Determinants
Example Evaluate the determinant of
3 5 3 5
A det A (3)( 2) (5)(1) 6 5 1
1 2 1 2
Def: Minors
Let A =[aij] be an nxn matrix . The ijth minor of A ( or the minor of
aij) is the determinant Mij of the (n-1)x(n-1) submatrix after you
delete the ith row and the jth column of A.
Example Find M 23 , M 32 , M 33 , 1 0 2
A 4 3 1
3 5 1
AX X
for some scalar λ. In this situation, the scalar λ is called an eigenvalue of
A corresponding to the eigenvector x.
AX IX 0
Solve det(A − λI) = 0.
y dy
Leibniz Notation: f `( x) lim EPE 821Lecture
2 33
h o x
dx
Calculus
1. Differentiate y x 2 sin x
f ( x) x 2 g ( x) sin x dy
f `g g ` f 2 x sin x x 2 cos x
f `( x) 2 x g `( x) cos x dx
d x3
1. Find
dx sin x
f ( x) x3 g ( x) sin x
f `( x) 3 x 2 g `( x) cos x
dy f `g g ` f 3 x 2 sin x x3 cos x
2
dx g sin 2 x
A tangent line is a straight line that touches a function at only one point.
The tangent line represents the instantaneous rate of change of the
function at that one point. The slope of the tangent line at a point on the
function is equal to the derivative of the function at the same point.
x2 2 x 1 3
2
f ( x) x 1 x 2
1 1
x 1 2 x 4
2
– 2 – 1 1 2 3 4 x
– 1
Domain [2, 4) – 2
2 x 2 x 1
f `( x) 1 1 x 2
1
2 x4
2 EPE 821 Lecture 2 38
Calculus
x2 2 x 1 2 x 2 x 1
f ( x) x 1 x 2 f `( x) 1 1 x 2
1 1
x 1 2 x 4 2 x4
2 2
y
Critical points are:
5
– 1
D (2,2) f `(2) does not exist. Left
– 2 derivative = 1, right derivative = 0.5
Local extreme values occur either at the end points of the function, turning
points or critical points within the interval of the domain.
y
x2 2x 3 x 1 4
3
f ( x) x 1 x 1 3
2 x 2 8 x 5 1 x 3 2
1
Domain [3,3)
–3 –2 –1 1 2 3 x
If extrema occurs at end points then they are end point maximums or end
point minimums.
(i) Local maximum / minimum turning points
(ii) End point values
(iii) Critical points
EPE 821 Lecture 2 40
Calculus
The Nature of Stationary Points.
If f `(a) = 0 then a table of values over a suitable interval centred at a
provides evidence of the nature of the stationary point that must exist at a.
A simpler test does exist.
It is the second derivative test.
y
0
-20
-40
-60
x = -2:0.001:4; -80
-2 -1 0 1 2 3 4
y = x.^4 - 4*x.^3 + 5; x
dy = 4 * x.^3 - 12*x.^2;
d2y = 12 * x.^2 - 24*x;
loop loop
G=(V,E)
isolated vertex
adjacent
multiple
edges
incidence: an edge (directed or undirected) is incident to a vertex that is
one of its end points.
degree of a vertex: number of edges incident to it
Nodes of a digraph can also be said to have an indegree and an
outdegree
adjacency: two vertices connected by an edge are adjacent
x y a
path: no vertex can be repeated
example path: a-b-c-d-e e
b
trail: no edge can be repeated
example trail: a-b-c-d-e-b-d
walk: no restriction
example walk: a-b-d-a-b-c d
closed: if starting vertex is also ending c
vertex
length: number of edges in the path, trail,
or walk
Simple graph a
a e
b
e
b
K5
d
c d
Disconnected graph
with two components c
EPE 821 Lecture 2 46
Graph Theory
acyclic graph (forest): a graph with no cycles
tree: a connected, acyclic graph
rooted tree: a tree with a “root” or “distinguished” vertex
leaves: the terminal nodes of a rooted tree
directed acyclic graph (DAG): a digraph with no cycles
weighted graph: any graph with weights associated with the edges
(edge-weighted) and/or the vertices (vertex-weighted)
b 10 a
5
d 8 c
2 -3
e f
6
For example, you can find data that is above a certain limit:
>> r = results(:,1)
>> ind = r > 0.2
Boolean Operators:
AND: &
OR: |
NOT: ~
EPE 821 Lecture 2 56
MATLAB
There are a number of special functions that provide useful
constants
pi = 3.14159265….
i or j = square root of -1
Inf = infinity
NaN = not a number
Passing a vector to a function like sum, mean, std will calculate the property within
the vector
>> sum([1,2,3,4,5])
= 15
>> mean([1,2,3,4,5])
=3
>> max([1,2,3,4,5])
=5
0.8
A basic plot
0.6
0.4
0
>> y = sin(x) -0.2
-0.6
-0.8
-1
0 1 2 3 4 5 6 7
EPE 821 Lecture 2 58
MATLAB
For command
Use a for loop to repeat one or more statements
This uses the colon operator again, so index values do not need
to be integer
For example
>> for i = 1:4
a(i) = i * 2
end