Univariate calculus 1

advertisement
Scientists: Which scientific advance has had the most impact on people’s everyday lives?
#3: Darwin’s theory of evolution
#2: Einstein’s relativity (cold war)
#1: Newton’s Calculus
Calculus: the Science of Change
Sunday Sept. 13
Univariate Calculus 1
• Derivative: the RATE OF CHANGE
• Taylor series approximations
• Differentiating data
Example: Climate change
• Global mean temperature
– Rate of change consistent with natural causes?
?
– OR is human activity implicated?
?
• What else changes due to global warming?
– Sea ice extent
– …?
Think of a quantity you might measure
• How fast is it changing:
– over a decade?
–
a year?
–
a month?
–
a day?
–
a second?
–
right now?
Functions as models
of changing quantities
population growth: P  P0ert
radioactive decay: N  N0e Rt
gravity: h  h0  1 gt 2
2
Univariate function and slope
y
y y
y  mx  b Slope: m  x2  x1  y
2
1 x
slope = change in y
change in x
x
Univariate function and slope
y
y y
y  mx  b Slope: m  x2  x1  y
2
1 x
y  f ( x)
Slope  ?
x
“Slope” of a function:
the tangent line
y
y  f ( x)
x
The derivative as a limit
y  f ( x)
f '( x)  lim f ( x  h)  f ( x)
h0
h
f ( x  h)
f ( x)
x
xh
The derivative as a limit
y  f ( x)
f '( x)  lim f ( x  h)  f ( x)
h0
h
f ( x  h)
f ( x)
x
xh
The derivative as a limit
y  f ( x)
f '( x)  lim f ( x  h)  f ( x)
h0
h
f ( x  h)
f ( x)
x xh
The derivative as a limit
y  f ( x)
f '( x)
f ( x)
x
f '( x)  lim f ( x  h)  f ( x)
h0
h
Alternative symbols
f '( x)  lim f ( x  h)  f ( x)  df
h0
h
dx
d = "little change in"
Examples
f ( x)  x 2 ,
f ( x  h)  f ( x)  ( x2  2hx  h2 )  x 2  2 x  h
h
h
f '( x)  lim 2 x  h  2 x.
h0
f ( x)  x3; f '( x)  ?
f ( x)  x 1; f '( x)  ?
Rules of differentiation
RULE
EXAMPLE
Power rule: d x   x 1
dx
d x3  ?
dx
Sum rule: ( f  g )'  f '  g '
( x3  x4 )'  ?
Product rule: ( fg )'  f ' g  fg '
d (1 2 x) x3  ?

dx 
Multiplication by a constant: (af )'  af '
(2 x2 )'  ?
Linearity: (af  bg )'  af '  bg '
(2 x2  3x7 )'  ?
Application: error analysis
Floodwaters in the Kalama Gap
V  ( gh)1/2; g 10m / s2
e.g.
h 150m : V  ?
h 160m : V  ?
V?
In general ...?
The Chain Rule:
Latitude
  60o
  30o
1o = 110km
Unit conversion
dy  100km
dt
hr
d  d dy  1degree 100km  0.91degrees
dt dy dt 110km hr
hr
The CHAIN RULE
The Chain Rule
y  f ( x); x  g(t)
 dy  dy dx  f '( x) g '(t)
dt dx dt
EXAMPLES:
d (1 x2 )2  ?
dx
d (1 x)1  ?
dx
d (4  x  5x2 )7  ?
dx
Higher-order derivatives
f '( x)  df
dx
f ''( x) 
d2 f
d df

dx2 dx dx
EXAMPLES
f ( x)  x 2
f '( x)  2 x
f ''( x)  2
f ( x)  (1 x)1  ?
f '( x)  ?
f ''( x)  ?
f (3) ( x)  ?
Curvature
y  f ( x)
R
K
f ''
1;

(1 f '2)3/2 R
x
Curvature
y  f ( x)
Gentle turn
R
r
K
f ''
1;

(1 f '2)3/2 R
Sharp turn
x
Extrema
maximum
f '  0; f ''  0
minimum
f '  0; f ''  0
inflection
point
f ''  0
Taylor series
Factorial function: n!  n(n 1)(n  2) 1
1!=1
2!=21=2
3!=3 21=6
4!=4 3 21=24
f ( x)  f ( x0 )  f '( x0 )h  1 f ''( x0 )h2  1 f (3)( x0)h3   1 f (n)( x0)hn 
2!
3!
n!
h  x  x0
f ( x)  f ( x0)  f '( x0)h  1 f ''( x0)h2  1 f (3)( x0)h3 
2!
3!
constant
 1 f (n) ( x0)hn 
n!
power
derivative
of h=x-x0
at x0
Taylor series example
f ( x)  f ( x0)  f '( x0)h  1 f ''( x0)h2  1 f (3)( x0)h3 
2!
3!
 1 f (n)( x0)hn 
n!
Expand: f ( x)  (1 x)1 about x0  0
f '( x)  (1 x)2; f ''( x)  2·(1 x)3; f '''( x)  3·2·(1 x)4
f (0) 1;
f '(0) 1;
f (n) (0)  n!
f (n) (0) 1
n!
 f ( x )  1 x  x 2  x 3 
f ''(0)  2;
f '''(0)  3·2
Taylor series example
Example: f ( x)  1 1 x  x2  x3 
1 x
1 x  x2  x3
1 x  x2
1 x
1
Taylor series example
f ( x)  f ( x0)  f '( x0)h  1 f ''( x0)h2  1 f (3)( x0)h3 
2!
3!
Expand: f ( x)  (1 x)2 about x0  0
f (0) 1
f '( x)  2(1 x);
f '(0)  2
f ''( x)  2;
f ''(0)  2
f '''( x)  0;
f '''(0)  0 etc.
 f ( x )  1 2 x  1 2 x 2  1 0 x 3 
2!
 1 2 x  x2  0 
3!
 1 f (n)( x0)hn 
n!
Negating the argument
f ( x)  f (0)  f '(0) x  1 f ''(0) x 2  1 f (3) (0) x3  1 f (4) (0) x 4 
2!
3!
4!
 1 f (n) (0) x n 
n!
f ( x)  f (0)  f '(0)( x)  1 f ''(0)( x)2  1 f (3) (0)( x)3  1 f (4) (0)( x)4 
2!
3!
4!
f ( x)  f (0)  f '(0) x  1 f ''(0) x 2  1 f (3) (0) x3  1 f (4) (0) x4 
2!
3!
4!
 (1) f (n) (0) x n 
n!
EXAMPLE:
Expand: f ( x)  (1 x)2 about x0  0

f ( x )  1 2 x  x 2
 1 f (n) (0)(1)n x n 
n!
n
Approximating the derivative
Observational data analysis
Numerical modeling
f ( x0  h)  f ( x0)  f '( x0)h  1 f ''( x0)h2  1 f (3)( x0)h3  1 f (4)( x0)h3 
2!
3!
4!
f ( x0  h)  f ( x0 )
 f '( x0 )  1 f ''( x0 )h  1 f (3) ( x0)h2  1 f (4) ( x0)h3 
2!
3!
4!
h
Forward
difference
approximation
Error ~ O(h)
Differentiating data:
Forward difference example
f '( x0) 
f ( x0  h)  f ( x0)

h
x
f
f’
3x2
1
1
(8-1)/1 = 7
3
2
8
(27-8)/1 = 19
12
3
27
(64-27)/1 = 37
27
4
64
(125-64)/1 =61
48
5
125
75
Approximating the derivative
Observational data analysis
Numerical modeling
f ( x0  h)  f ( x0)  f '( x0)h  1 f ''( x0)h2  1 f (3)( x0)h3  1 f (4)( x0)h3 
2!
3!
4!
f ( x0  h)  f ( x0 )
 f '( x0 )  1 f ''( x0 )h  1 f (3) ( x0)h2  1 f (4) ( x0)h3 
2!
3!
4!
h
Forward
difference
approximation
Error ~ O(h)
h  h
f ( x0  h)  f ( x0)

h
f ( x0 )  f ( x0  h)
 f '( x0 )  1 f ''( x0 )h  1 f (3) ( x0 )h2  1 f (4) ( x0)h3 
2!
3!
4!
h
Backward
difference
Forward and backward differences
y
y  f ( x)
FD
actual
BD
x h
x
xh
Approximating the derivative
Forward
difference
f ( x0  h)  f ( x0)
 f '( x0)  1 f ''( x0)h  1 f (3) ( x0)h2  1 f (4) ( x0)h3 
2!
3!
4!
h
Backward
difference
f ( x0)  f ( x0  h)
 f '( x0)  1 f ''( x0)h  1 f (3) ( x0)h2  1 f (4)( x0)h3 
2!
3!
4!
h
SUM
Approximating the derivative
Forward
difference
f ( x0  h)  f ( x0)
 f '( x0)  1 f ''( x0)h  1 f (3) ( x0)h2  1 f (4) ( x0)h3 
2!
3!
4!
h
Backward
difference
f ( x0)  f ( x0  h)
 f '( x0)  1 f ''( x0)h  1 f (3) ( x0)h2  1 f (4)( x0)h3 
2!
3!
4!
h
SUM
/2
f ( x0  h)  f ( x0  h)
 2 f '( x0 )
h
0
 2 f (3) ( x0 )h2  0 
3!
Approximating the derivative
Forward
difference
f ( x0  h)  f ( x0)
 f '( x0)  1 f ''( x0)h  1 f (3) ( x0)h2  1 f (4) ( x0)h3 
2!
3!
4!
h
Backward
difference
f ( x0)  f ( x0  h)
 f '( x0)  1 f ''( x0)h  1 f (3) ( x0)h2  1 f (4)( x0)h3 
2!
3!
4!
h
SUM
f ( x0  h)  f ( x0  h)
 2 f '( x0 )
h
/2
f ( x0  h)  f ( x0  h)
 f '( x0 )
2h
Centered
difference
0
 2 f (3) ( x0 )h2  0 
3!
 1 f (3) ( x0 )h2 
3!
Error ~ O(h2)
Centered difference example
f '( x0 ) 
x
f=x3
1
1
2
f ( x0  h)  f ( x0  h)

2h
f’
3x2
8
(27-1)/2 = 13
12
3
27
(64-8)/2 = 28
27
4
64
(125-27)/2 = 49
48
5
125
(216-64)/2=76
75
6
216
(343-125)/2=109
108
7
343
Approximating the 2nd derivative
Forward
difference
f ( x0  h)  f ( x0)
 f '( x0)  1 f ''( x0)h  1 f (3)( x0)h2  1 f (4) ( x0)h3 
2!
3!
4!
h
Backward
difference
f ( x0)  f ( x0  h)
 f '( x0)  1 f ''( x0)h  1 f (3) ( x0)h2  1 f (4)( x0)h3 
2!
3!
4!
h
SUBTRACT
/h
f ( x0  h)  2 f ( x0 )  f ( x0  h)
 0  2 f ''( x0 )h 
2!
h
0
f ( x0  h)  2 f ( x0)  f ( x0  h)
 f ''( x0)  2 f (4) ( x0)h2 
2
4!
h
Centered
difference
Error ~ O(h2)
2 f (4) ( x )h3 
0
4!
Download