Beruflich Dokumente
Kultur Dokumente
Mathematical background
Douglas
Douglas Wilhelm
Wilhelm Harder,
Harder, M.Math.
M.Math. LEL
LEL
Department
Department of of Electrical
Electrical and
and Computer
Computer Engineering
Engineering
University
University of
of Waterloo
Waterloo
Waterloo,
Waterloo, Ontario,
Ontario, Canada
Canada
ece.uwaterloo.ca
ece.uwaterloo.ca
dwharder@alumni.uwaterloo.ca
dwharder@alumni.uwaterloo.ca
2006-2013
2006-2013 by
by Douglas
Douglas Wilhelm
Wilhelm Harder.
Harder. Some
Some rights
rights reserved.
reserved.
Mathematical background
2
Outline
http://xkcd.com/55/
Mathematical background
4
Justification
Justification
Justification
The floor function maps any real number x onto the greatest integer
less than or equal to x:
3.2 3 3
5.2 6 6
Consider it rounding towards negative infinity
The ceiling function maps x onto the least integer greater than or
equal to x: 3.2 4 4
Necessary because double
5.2
5 5 have a range just under 21024
long can only represent
numbers as large as 263 1
Consider it rounding towards positive infinity
The cmath library implements these as
double floor( double ); double ceil( double );
Mathematical background
8
LHpitals rule
f n f 1 n
lim lim
n g n n
g 1 n
Repeat as necessary
Logarithms
If n = em, we define
m = ln( n )
Logarithms
ln(n)
lim d 0
n n
Mathematical background
11
Logarithms
ln(n)
Mathematical background
12
Logarithms
(93.354, 4.536)
ln(n)
3
n
Mathematical background
13
Logarithms
ln(n)
4
n (5503.66, 8.61)
Mathematical background
14
Logarithms
ln( n )
log b ( n )
ln( b)
All logarithms are scalar multiples of each others
Mathematical background
15
Logarithms
lg(n)
ln(n)
log10(n)
Mathematical background
16
Logarithms
Logarithms
a consequence of n b logb n :
nlog (m) = (blog (n))log (m)
b b b
= mlog (n) b
Mathematical background
18
Logarithms
Arithmetic series
Arithmetic series
Proof 1: write out the series twice and add each column
1 + 2 + 3 + ... + n 2 + n 1 + n
+ n + n 1 + n 2 + ... + 3 + 2 + 1
(n + 1) + (n + 1) + (n + 1) + . . . + (n + 1) + (n + 1) + (n + 1)
= n (n + 1)
Since we added the series twice, we must divide the result by 2
Mathematical background
21
Arithmetic series
Arithmetic series
Arithmetic series
k n 1 k
k 0 i 0
n 1 2 n 1 n
2
n 1 n 2
2
Mathematical background
24
Arithmetic series
k 0
k
2
6 k
3
4
k 0
k 2
2
k 0
k2
6
3
k 0
n 2 n 1
2
n
n4
k 0
k
3
4
4
Mathematical background
26
d 1
Demonstrating with d = 3 and d = 4:
Mathematical background
27
However, there is an
accumulating error:
n2
Mathematical background
28
n2 = 10
Mathematical background
29
The ratio between the error and the actual value goes to zero:
In the limit, as n , the ratio between the sum and the approximation
goes to 1 d 1
n
lim dn 1 1
n
kd
k 0
Geometric series
The next series we will look at is the geometric series with common
ratio r: n 1
n
1 r
k 0
r k
1 r
and if |r| < 1 then it is also true that
1
r k
k 0 1 r
Mathematical background
31
Geometric series
1 r
Elegant proof: multiply by 1
1 r
Telescoping series:
1 r k 0 r k
n
n
r
k 0
k
1 r
all but the first and last terms cancel
k 0 k 0
n n
r
k
r r k
1 r
(1 r r 2 L r n ) (r r 2 L r n r n 1 )
1 r
1 r n 1
1 r
Geometric series
Proof by induction: 0
1 r 01
The formula is correct for n = 0:
k 0
r r 1
k 0
1 r
1 r n 1 n
Assume the formula r is true for an arbitrary n; then
i
i 0 1 r
n 1 n
1 r n 1 (1 r ) r n 1 1 r n 1
r
k 0
k
r n 1
r r
k 0
k n 1
1 r
1 r
r n 1 r n 2 1 r n 1 1 r n 2 1 r ( n 1) 1
1 r 1 r 1 r
Geometric series
i 1
ri i 1
rr i 1 r
i 1
r i 1
Letting j = i 1:
n 1
1 rn
r r r
j 0
1 r
j
Mathematical background
34
Geometric series
1 12
n i n 1 i
1
i 0
2
1 12
2 2 n 1
2
i 0
2
n 1
n
1 2
k 0
2 k
1 2
2 n 1
1
Mathematical background
35
Recurrence relations
Recurrence relations
Recurrence relations
Recurrence relations
Recurrence relations
Recurrence relations
5 1
1.6180
2
Mathematical background
41
Weighted averages
Weighted averages
Examples:
Simpsons method approximates an integral by sampling
the function at three points: f(a), f(b), f(c)
The average value of the function is approximated by
1
6 f a 23 f b 16 f c
is a significant better
a f b than
f approximation
f c
c a
3
Mathematical background
43
Weighted averages
Examples: 2
Using a simple
0 cos
cos average: 1 cos 2 2 0.7494 1
3 13 13 1
3
Mathematical background
44
Combinations
Given n distinct items, in how many ways can you choose k of these?
I.e., In how many ways can you combine k items from n?
For example, given the set {1, 2, 3, 4, 5}, I can choose three of these
in any of the following ways:
{1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5},
{1, 4, 5}, {2, 3, 4}, {2, 3, 5}, {2, 4, 5}, {3, 4, 5},
Combinations
n n! n n 1
2 2! n 2 ! 2
{0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6},
{1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6},
{2, 3}, {2, 4}, {2, 5}, {2, 6},
{3, 4}, {3, 5}, {3, 6},
{4, 5}, {4, 6},
{5, 6}
Mathematical background
46
Combinations
k 0 k
For example,
4
4 k 4 k
x y x y
4
k 0 k
4 4 4 3 4 2 2 4 3 4 4
y xy x y x y x
0 1 2 3 4
y 4 4 xy 3 6 x 2 y 2 4 x 3 y x 4
Mathematical background
47
Combinations
Summary
Reference
Usage Notes
These slides are made publicly available on the web for anyone to
use
If you choose to use them, or a part thereof, for a course at another
institution, I ask only three things:
that you inform me that you are using the slides,
that you acknowledge my work, and
that you alert me of any mistakes which I made or changes which you
make, and allow me the option of incorporating such changes (with an
acknowledgment) in my set of slides
Sincerely,
Douglas Wilhelm Harder, MMath
dwharder@alumni.uwaterloo.ca