SEMMA13 Complex Number Material

Download Report

Transcript SEMMA13 Complex Number Material

SEMMA13 Calculus
Differentiation – how function changes
f
Graphically gradient of function
f(t+δt)
f(t) – function varies with time
f(t)
Differentiate with respect to (wrt) time
Its (first) differential is f'(t) or
Formally
df
f(t   t)-f(t)
= lim
dt
t
 t 0
df
dt
The differential of the differential of f is
The n'th differential is
If y is function of x, do
28/04/2020
n
d f
dtn
or f(n) (t)
f(t)
δt
δf=f(t+δt)
- f(t)
t t+δt
d2f
2
dt
or f''(t)
dy
, etc
dx
SEMMA13 Eng Maths and Stats
1
Some Simple Rules
For f(t) and any constant k, d k*f = k* df
dt
df+g
dg
For f(t) and g(t),
= df +
dt
dt
dt
dt
For u(t) and v(t), d u*v = v du + u dv
dt
dt
d u/v =
dt
dt
v du - u dv
dt
For inverse functions dx =
v2
1
dt
dy
dx
If define a function as a function of another variable
dy
eg x = f(z) an d z = g(t)
Use chain rule:
28/04/2020
dx
dx dz
=
dt
dz dt
SEMMA13 Eng Maths and Stats
2
Integration
Inverse of differentiation
Graphically area under curve
Divide area into strips and sum
b
b
lim
 f(r) *  t
 f(t) dt =
t  0r = a
a
If differentiate g(t) get f(t). Then if integrate f(t) get g(t)
For area under curve , have definite integral
b
b
 f(t) dt =  g(t) a = g(b) - g(a)
a
For indefinite integral, get a function, but need to add constant c
 f(t) dt = g(t) + c
28/04/2020
This is because
SEMMA13 Eng Maths and Stats
d(g(t)+c)
d(g(t))
=
dt
dt
3
Integration Rules
Follow from those of differentiation
 k * f(t) dt = k *  f(t) dt
 f(t) + g(t) dt =  f(t) dt +  g(t) dt
dv
du
u
dt
=
uv
v
dt


dt
dt
p dv
p du
p
dt = uv  q -  v
dt
u
q dt
q dt
When integrating u * dv/dt, choose which is u and which dv/dt so
dv
du
is
easier
to
solve
than
dt
u
dt
v
dt
dt
If define a function as a function of another variable
eg x = f(z) an d z = g(t)
Use substitution
28/04/2020
 f(z) dt =  f(z) dz *
SEMMA13 Eng Maths and Stats
dt
dz
4
Standard Differentials Integrals
f(t) =
dg
dt
g(t) =  f(t) dt
f(t) =
dg
dt
0
1
c
t+c
cos(at)
sin(at)
sin(at)/a + c
-cos(at)/a + c
t
t2/2 + c
sec2(at)
tan(at)/a + c
tn (n ≠ 1)
1/t
1
sin-1(at)/a + c
1-a2t2
1
cos-1(at)/a + c
1-a2t2
1
tan-1(at)/a + c
n 1
t
c
n 1
ln(t) + c

eat
1 at
e +c
a
1  a 2t2
sinh(at)
cosh(at)/a + c
cosh(at)
28/04/2020
g(t) =  f(t) dt
SEMMA13 Eng Maths and Stats
sinh(at/a) + c
5
Applications of Differentiation
Finding local maxima/minima of f(t)
Before maximum, f(t) rising, after f(t) falling, at maximum f(t) const
df
d2f
Hence at maximum
= 0 and
0
2
dt
dt
df
d2f
Similarly at minimum
= 0 and
0
2
dt
dt
Newton-Raphson : iterative method of finding t where f(t) = 0
Suppose tn is n’th estimate, then next one is found by
tn 1 = tn 28/04/2020
f(tn )
f'(tn )
SEMMA13 Eng Maths and Stats
6
Applications of Integration
Mean of function f(t) between t = a and t = b is
root mean square of f(t), rms =
b
2
 f (t) dt
a
1 b
 f(t)dt
baa
b-a
If f(t) is a repetitive function of period T : f(t) = f(t+T)
Mean of f(t) is
28/04/2020
1T
 f(t)dt; rms of f(t) =
T0
SEMMA13 Eng Maths and Stats
1T 2
 f (t)dt
T0
7
On Lines and Solids of Revolution
Suppose y = f(x).
Length of f(x) from x = a to b is:
2
b
 dy 
s =  1
dx

 dx 
a
If y = f(x) is rotated about x axis, form solid of revolution
b
2
Volume of solid from x = a to b is V =    f(x)  dx
a
b
Surface area of solid from x = a to b is S =  2 y
a
28/04/2020
SEMMA13 Eng Maths and Stats
2
 dy 
1
dx

 dx 
8
Some Examples
Find surface area when y = x3 rotated about axis x = 0..0.5
0.5
S =  2 x3 1  9x 4 dx;
0
dy
= 3x2 ;
dx
Make the substitution t  x 4 So dt  4x3
dx
or dx 
x=0.5
dt t=0.0625 
3
so S =  2 x 1  9t
=

3
2
4x
x=0
t=0
1  9t dt

= 
18

28/04/2020
1
3  16
1

9t

 2
3
2


0
3


dt
4x3
 1  916 2 
=

27
  25 32  61
=
  16   1  = 1728
27
27


SEMMA13 Eng Maths and Stats
9
Integration by Trig Substitution
x
Force F applied to bar, extension l given by:
L F
l= 
dx
2
04 + x
Let x = 2 tan(a) so
F
dx
= 2 sec2 (a)
da
L
x=L
x=L
F
F
2
l= 
2 sec (a) da = 
2 sec2 (a) da
2
2
x=0 4 + 4tan (a)
x=0 4 sec (a)
F  x=L
F
x  L
F
L


-1

l =  a
=  tan    = tan-1  
2
 2 0
 2  x=0
2
2
28/04/2020
SEMMA13 Eng Maths and Stats
10
Differentiation of Product
The output position x of a computer controlled motor is given by
x = 3 – e -0.5t ( 2sin (2t) + 8 cos (2t) )
What is its velocity?
dx
= 0 - e -0.5t ( 4cos (2t) - 16 sin (2t) )
dt
 0.5 e -0.5t ( 2sin (2t)  8 cos (4t) )
= e -0.5t ( 4 cos (2t)  16 sin (2t)  sin(t)  4 cos(t)
= 17 e -0.5t sin(2t)
28/04/2020
SEMMA13 Eng Maths and Stats
11
Using Integration By Parts
Output position, x
(velocity, v)
Mass Spring System
Let m = 1kg,
F = 4Nsm-1,
k = 4Nm-1
Object, mass m
Dashpot, F
v = 2 t e-2t – 3e-2t. Find x if, at time t = 0, x = 1m
Let u = 2t and
To integrate 2t e-2t
Then

dv
= e 2t
dt
du
= 2 and v =  e -2t dt =  1 e 2t
2
dt

So  2t e-2t dt = 2t  1 e 2t    1 e 2t 2dt =  te 2t - 1 e 2t
2
2
2
So x =  v dt = -t e-2t - 1 e-2t + 3 e-2t + c = e-2t -t e -2t + c
2
2
At t = 0, x = 1; so 1 = 1 - 0 + c;
28/04/2020
c = 0;
x = e-2t - t e-2t
SEMMA13 Eng Maths and Stats
12
Ordinary Differential Equations
An ordinary differential equation (ODE) is one comprising one or
more differentials of a dependent variable.
We solve them to find how that variable changes with time.
The order of the ODE is the degree of the highest derivative
An ODE is linear if the dependent variable and its derivatives
are not raised to a power, are not in products and are not used in
any non-linear function.
A homogeneous ODE is one where the dependent variable and its
derivatives are on one side of the equation, the other being 0.
dx
+ 4x = 0
dt
First order,
linear,
homogenous
28/04/2020
d2x
+4
dx
+ 3x = 4sint
dt
dt2
Second order,
linear,
inhomogenous
SEMMA13 Eng Maths and Stats
13
Solving ODEs
In effect solving an ODE involves integration
There are many ways of solving ODEs, we will concentrate on a few
Note, solutions can have two forms
General solution
like indefinite integral, with constant(s)
Particular solution
where use information to find constant(s)
We can also use computers to solve ODEs numerically
We will see how MatLab does this.
28/04/2020
SEMMA13 Eng Maths and Stats
14
Simple Example
x is position of a moving object, initial velocity 3, constant
acceleration 8. Its velocity is given by the following – what is x?
dx
=3+8t
dt
Can integrate both sides wrt t : as RHS of equation is f(t)

dx
dt = x =  3 + 8 t dt = 3t + 4t2 + c
dt
This is the general solution.
With extra information, such as the position is 5 at t = 0, we get
5 = 0 + 0 + c, so c = 5
Hence the particular solution is
x = 5 + 3t + 4t2
28/04/2020
SEMMA13 Eng Maths and Stats
15
Separable Differential Equation
Here
dy
dy
h(x)
= f(x,y) which can be manipulated into
=
dx
dx
g(y)
This is solved by  g(y)dy =  h(x)dx + c
Previous slide – simple example of this type
Interacting Foxes and Rabbits can be modelled by (F=fox R = rabbit):
dR
dF
dR
R(a-bF)
= R(a-bF) and
= F(cR-d) 
=
dt
dt
dF
F(cR-d)
cR-d
a-bF
dR = 
dF
R
F
cR - dln(R) = aln(F) - bF + k
Hence 
Or
28/04/2020
SEMMA13 Eng Maths and Stats
16
Integrating Factor Method
Suppose
dy
+ P(x)y = Q(x)
dx
Given that,


dy Px
d
yePx =
e + PyePx
dx
dx
If we multiply the original equation by ePx we get
e
Px dy
dx
+ P(x)yePx =


d
yePx = Q(x)ePx
dx
Hence yePx =  Q(x)ePx dx
So y = e-Px * Q(x)ePx dx
ePx is the integrating factor
28/04/2020
SEMMA13 Eng Maths and Stats
17
Example
RC circuit, At time 0, battery E
volts connected, when V = 0
dV
V
E
+
=
dt
RC
RC
t
t
E
Integrating Factor e RC , so e RCV =  e RC dt
RC
t
t
t
e RCV = Ee RC + c
-t
V = E + ce RC
At t = 0, V = 0, so 0 = E + c or c = - E
-t
V = E - Ee RC
28/04/2020
SEMMA13 Eng Maths and Stats
Method also ok if E is
E sin(ωt), but integral
more difficult …
18
Linear Equations
An alternative method, which extends to second order ODEs
And has real engineering application and meaning. Consider
dV
dV
RC
+ V = E or RC
+ V = Esin(t)
dt
dt
The solution to these has two parts … transient and steady state
Vss = Steady state : final function of V
VT = transient : defines how V gets to Vss
Maths call these Particular Integral and Complementary Function
So complete solution is
V = Vss + VT
28/04/2020
SEMMA13 Eng Maths and Stats
19
Transient Solution
To find transient, set RHS of equation to 0 (Homogenous)
dnV
Form auxilliary equation : replace
Get


dtn
by mn .
an mn + an-1mn-1 + ..a1m + a0 V = 0
Each root r of this yields component in transient of the form cert
RC
dV
+ V = 0  RCmV + V = 0 or RCm + 1 = 0
dt
1
t
1
RC
Clearly one root, m = , so Vt = c e
-
RC
28/04/2020
SEMMA13 Eng Maths and Stats
20
Steady State Solution
RC
dV
+ V = E or
dt
RC
dV
+ V = Esin(t)
dt
This depends on form of driving function, in above E or E sin(ωt)
When driving function is a constant, Vss = constant, say Vss = k
This must be a solution of the differential equation, so
dk
RC
+k=E
dt
or
k = E so Vss = E
t
Therefore complete solution is V = E + c e RC

t
If, for instance, V = 0 at time t = 0, V = E - E e RC

28/04/2020
SEMMA13 Eng Maths and Stats
21
Sinusoidal Driving Function
When driving function is a sinusoid, Vss = k sin(ωt+)
This must also be a solution of the differential equation, so
RC
k
k
dksin( t+ )
+ ksin( t+ ) = Esin( t)
dt
RC

cos( t+ ) + ksin( t+ ) = Esin( t)
R2C2 + 2
sin( t+  tan


So  =-tan 1
So V = E
28/04/2020
RC
and k = E
1 
RC
) = Esin( t)

R2C2 + 2
t
 
sin   t-tan 1
 + c e RC


R2C2 + 2

RC 
SEMMA13 Eng Maths and Stats
22
Second Order Diff Eqn
d2O
dO
Note for an equation of the form a
+b
+ cO = f(t)
2
dt
dt
d2O
dO
The transient response found to a
+b
+ ct = 0
2
dt
dt
using the roots of the auxilliary equation am2 + bm + c = 0
Different forms are used if roots are real, imaginary or complex
A suitable Steady State solution for O = g(t) is selected given f(t)
Associated constants found as g(t) is solution a
General Solution is Steady State plus Transient
d2O
dt2
+b
dO
+ cO = g(t)
dt
Constants can be found knowing for instance initial conditions
28/04/2020
SEMMA13 Eng Maths and Stats
23
Real Roots Example
d2O dO
0.01
+
+ 9O = 9
2 dt
dt
Aux Eqn 0.01m2 +m+ 9 = 0
Factorise as (0.1m + 9)(0.1m + 1) = 0
So m = -90 or -10
So Complimentary Function or Transient Response is
OCF = A e-90t + B e-10t
Particular Integral (or Steady State Solution) is of form OPI = C
d2OPI dOPI
0.01
+
+ 9OPI = 0 + 0 + 9C = 9 ... C = 1;
2
dt
dt
 OPI = 1
General Solution is therefore O = 1 + A e-90t + B e-10t
28/04/2020
SEMMA13 Eng Maths and Stats
24
Particular Solution
General Solution is O = 1 + A e -90t + B e-10t
Suppose O and dO/dt = 0 at t = 0
dO
= -90A e-90t -10 B e-10t
dt
So at t = 0
0 = 1 +A+B
0 = -90A -10 B
From 2nd
B = -9 A
Hence 1st 0 = 1 + A - 9A = 1 - 8A, so A = 1/8
Thus B = -9/8
Particular Solution is O = 1 +
28/04/2020
1 -90t 9 -10t
e
e
8
8
SEMMA13 Eng Maths and Stats
25
Example with complex roots
d2O dO
0.25
+
+ 10O = 10
2 dt
dt
Aux Eqn 0.25m2 +m+ 10 = 0
m=
-1 
-1  j 3
1 - 4*0.25*10
=
= -2  j 6
0.5
0.5
OCF = Ae-2t cos(6t) + Be-2t sin(6t)
OPI clearly = 1
So O = 1 + Ae-2t cos(6t) + Be-2t sin(6t)
28/04/2020
SEMMA13 Eng Maths and Stats
26
Particular Solution
O = 1 + Ae-2t cos(6t) + Be-2t sin(6t)
Suppose O and dO/dt = 0 at t = 0
dO
d
= e-2t
(Acos(6t) + Bsin(6t)) -2e-2t (Acos(6t) + Bsin(6t))
dt
dt
dO
= e-2t (-6Asin(6t) + 6Bcos(6t)) -2e-2t (Acos(6t) + Bsin(6t))
dt
= e-2t ((6B-2A)cos(6t)-(6A+2B)sin(6t))
So at t = 0
0 = 1 + A; 0 = 6B-2A;
O = 1 - e-2t cos(6t) 28/04/2020
so A = -1 and B = -1/3
1 -2t
e sin(6t)
3
SEMMA13 Eng Maths and Stats
27
Example with repeated roots
1 d2O dO
+
+ 9O = 9
2
36 dt
dt
1 2
Aux Eqn
m +m+ 9 = 0
36
1
Factorise as ( m + 3)2 = 0
6
So m = -18
So Complimentary Function or Transient Response is
OCF = (A + Bt) e-18t
OPI = 1 as before so general solution is O = 1 + (A + Bt) e-18t
If zero initial conditions can show O = 1 - (1 + 18t) e-18t
28/04/2020
SEMMA13 Eng Maths and Stats
28
Particular Solution
O = 1 + (A + Bt) e-18t
Suppose O and dO/dt = 0 at t = 0
dO
= -18(A + Bt) e-18t + Be-18t
dt
So at t = 0
0 = 1 + A;
so A = -1
0 = -18A + B;
so B = -18
O = 1 - (1 + 18 Bt) e-18t
28/04/2020
SEMMA13 Eng Maths and Stats
29
Graphs showing these
1
0.8
0.6
0.4
0.2
0 0
1
0.8
0.6
0.4
0.2
(a)
0.1 0.2 0.3 0.4 0.5
0 0
Plots of how O varies with time
1.5
Steady state solution O = 1
In effect these are ‘step’ responses
Transient :
a) two exponentials : overdamped
0.1 0.2 0.3 0.4 0.5
1
0.5
b) repeated root : critically damped
c) Complex roots : underdamped
28/04/2020
(b)
SEMMA13 Eng Maths and Stats
0 0
(c)
0.5 1
1.5 2
2.5
30
Exponential Driving Function
d2O dO
0.01
+
+ 9O = 9e-5t
dt2 dt
Complimentary Function will be the same
Steady State Solution is of form OPI = Ce-5t
d2OPI dOPI
0.01
+
+ 9OPI
2
dt
dt
= 0.01 *25Ce-5t - 5Ce-5t + 9Ce-5t = 4.25Ce-5t
9e-5t = 4.25Ce-5t
so C = 9/4.25 = 2.1176
General Solution is therefore O = 2.1176e-5t + A e-90t + B e-10t
28/04/2020
SEMMA13 Eng Maths and Stats
31
Problematic Driving Function
d2O dO
0.01
+
+ 9O = 9e-10t
dt2 dt
Here driving function same power of exp
as comp. function. So if try OPI = Ce-10t
d2OPI dOPI
0.01
+
+ 9OPI = 0.01 * 100Ce -10t -10Ce -10t + 9*Ce -10t = 0Ce -10t
dt
dt2
Cant have 0C = 9. So instead try OPI = Cte-10t
dOPI
= Ce-10t - 10Cte-10t = C(1-10t)e-10t
dt
d2OPI
dt2
= -10Ce-10t -10C(1-10t)e-10t = C(100t-20)e-10t
d2OPI dOPI
0.01
+
+ 9OPI = 0.01C(100t-20)e-10t +C(1-10t)e -10t + 9Cte-10t
dt
dt2
= C(t-0.2+1-10t+9t)e-10t = 0.8Ce-10t
28/04/2020
So 0.8C = 9, or OPI =
SEMMA13 Eng Maths and Stats
45 -10t
e
4
32
Numerical Solution of ODEs
MatLab can be used to provide numerical solution to these
dV
dV
RC
+ V = E or RC
+ V = Esin(t)
dt
dt
It has a function ODE45, utilising 4th order Runge-Kutta method
To use, you generate a m-file which calculates dV/dt
So for battery powered circuit, write Rccircuit.m
function dVbydt = RCcircuit (t, V, flag, E, R, C)
% Function to calculate dV/dt for RC circuit
% t is time, V is output, flag is dummy variable
% E is battery voltage, R and C are resistor and capacitor
dVbydt = (E - V) / RC;
28/04/2020
SEMMA13 Eng Maths and Stats
33
In use
>> [t,v]=ode45(‘RCcircuit', [0 20], 0,[], 2, 1, 5);
call ode45 with name of do/dt file,
[0 20] means run from t = 0 to 20,
0 is initial value of O, [] is dummy
[1 2 5] are the paras used in function, E, R, C
>> plot(t,v);
% to plot who y varies with t
2
1.5
Error
O
10
1
0.5
0
28/04/2020
0
10
20
t
x 10-6
Also shown,
error in
simulation –
very small
5
0
-5
0
10
SEMMA13 Eng Maths and Stats
20
t
34
For sinusoidal input
function dVbydt = RCcircuitsin (t, V, flag, E, R, C, w)
% Function to calculate dV/dt for RC circuit
% t is time, V is output, flag is dummy variable
% Input E sin(wt), R and C are resistor and capacitor
dVbydt = (E*sin(w*t) - V) / RC;
0.3
>> [t,v]=ode45('RCcircuitsin',
[0 20], 0,[], 1, 1, 5, 3);
>> plot(t,v)
0.2
0.1
0
-0.1
-0.20
28/04/2020
SEMMA13 Eng Maths and Stats
5
10
15
20
35
Simulating Second Order Systems
MatLab can also solve second order systems. The second order
differential equation is reorganised into two first order equations
Consider a
d2O
+b
dO
+ cO = f(t)
dt
dt2
dO
d2O
dv
Let v =
so that
=
dt
dt
dt2
d2O
dO
dv
Hence a
+b
+ cO = f(t)  a
+ bv + cO = f(t)
2
dt
dt
dt
v


O
d  


Hence
  v   =  f(t)-cO-bv 
dt    


a
In MatLab, define ov as vector, ov = [O; v] . ov(1) is O, ov(2) is v.
Write m-file to generate the differential of ov and call ODE45
28/04/2020
SEMMA13 Eng Maths and Stats
36
In MatLab
function dovbydt = secondorder (t, ov, flag, I, a, b, c)
% Function to calculate do/dt for second order system
% t is time, ov is vector with current output and velocity
% I = input, a, b and c are parameters
dovbydt = [ov(2); (I - ov(1)*c - ov(2)*b )/ a];
[t,y]=ode45('secondorder', [0 2], [0;0], [], 9, 0.01, 1, 9 );
plot(t,y);
8
6
Plots O and V
6
4
superimposed
4
2
Also shown
2
0
response for
0 0 0.5 1
10, 0.25, 1, 10
1.5 2 -2 0
0.5
28/04/2020
SEMMA13 Eng Maths and Stats
1
1.5
37
2
Another Example Fox and Rabbit
dR
= a*R-b*R*F
dt
dF
= c*R*F-d*F
dt
The plot
of R v F
is of the
‘phase
plane’
28/04/2020
Fox
10
5
0
5
10
Rabbit
15
Rabbit and Fox
function dpbydt = pop (t, p, flag, vals);
% vals is [a b c d], p(1) = R; p(2) = F
dpbydt = [vals(1)*p(1) - vals(2)*p(1)*p(2); ...
vals(3)*p(1)*p(2) - vals(4)*p(2)];
For a = 20, b = 4, c = 3 & d = 27; plot R v F; R and F v time
SEMMA13 Eng Maths and Stats
20
10
0
0
0.5
Time
1
38
Partial Differentiation
Suppose function f depends upon variables x, y, z : f(x,y,z)
Partial differentiation is where differentiate wrt to one
variable, assuming the other variables are constant.
Use ∂ rather than d to indicate partial differentiation
eg f = x2 + x*sin(3y) + y*z
f
= 2x + sin(3y)
x
f
= 3xcos(3y) + z
y
f
=y
z
Note notation on second derivatives
2 f
2
x
28/04/2020
=2
2 f
= 3cos(3y)
xy
SEMMA13 Eng Maths and Stats
2 f
= 3cos(3y)
yx
39
Differentiation of Matrices
If x = [x1, x2 … xn]T and L(x) is a scalar function, then
 L 
 L L
L
L 
 x 
Lx =
= 
,
...
1


x

x

x

x
 1
2
n
 L 
T
L
 x 

L
=
=
x
The gradient of L(x) is a column vector :
 2
x
 : 
 L 



x
 n 
 2 L
The second derivative of L(x) is an n*n
2 L 
..


matrix, called the Hessian matrix
2

x

x
1 n
 x1


Lxx =  :
: 
 2

2

L

L


..
2 
 xn x1

x
n


28/04/2020
SEMMA13 Eng Maths and Stats
40
More On Matrix Calculus
If x = [x1, x2 … xn]T
and f(x) is a differentiable vector function f = [f1, f2 … fm]T
Then the partial differential of f wrt x is an m * n matrix
 f1
f1 
This is called the Jacobean matrix
 x .. x 
n
 1
f
fx =
=  :
: 
x



f

f
If f is a function of an n*m matrix A
m
 m ..
 x1
xn 
 f
f 
..
 a
a1m 
11


f
=  :
: 
A



f

f


..
 an1
anm 
28/04/2020
SEMMA13 Eng Maths and Stats
41
Differentiate matrix w r t scalar
If y is a vector function of t, then
 dy1 
 dt 
 y1 (t) 


dy


y(t) =
:

=  : 


dt
 dy 
 yn (t) 
 n
 dt 
If A is a matrix function of t, then
 da11 da1m 
 dt

 a11 (t) a1m (t) 
dt


dA
A(t) =  : .. :  
=  : .. : 


dt
 da
 an1 (t) anm (t) 
danm 
n1


 dt
dt 
28/04/2020
SEMMA13 Eng Maths and Stats
42
Some Rules
For n×n matrix A, and n-dimensional vectors x and y:

(Ax) = A
x
 T
 T
(x Ay) = (y Ax) = y T A
x
x
 T

(x y) = (yT x) = yT
x
x

 T
(x Ax) = xT A  AT
x

2
x2
(xT Ax) = A + AT
If matrix A is symmetric:
 T
(x Ax) = 2xT A
x
28/04/2020
2
x2
(xT Ax) = 2A
SEMMA13 Eng Maths and Stats
43
Linearisation
Approximating a function by a straight line at a point
For f(t) approx at t = a, the straight line has gradient of f(t) at t = a
Can show that straight line defined by
f(t) ≈ f(a) + (t-a) * f’(a)
An extension of this : approximate a function by a quadratic at t = a
Here approximation has same gradient and second derivative at a.
(t-a)2
f(t)  f(a) + (t-a) f'(a) +
f''(a)
2!
The nth order model, the nth order Taylor’s series, is:
(t-a)2
(t-a)n (n)
f(t)  f(a)  (t-a) f'(a) 
f''(a)  .. 
f (a)
2!
n!
28/04/2020
SEMMA13 Eng Maths and Stats
44
Multi Variable Taylors Series
Suppose f(x) is a differentiable scalar function
where x = [x1, x2 … xn]T then its partial derivative is
 f f
f
f 
= fx = 
,
...

x
 x1 x2 xn 
The gradient vector of f(x) is
 f 
 x 
 1
 f 
f = fxT =  x2 


 : 
 f 


 xn 
The values at which fx = 0 are called stationary points
28/04/2020
SEMMA13 Eng Maths and Stats
45
Continued
The Hessian matrix of f(x) is
 2 f

2
 x1

fxx =  :
 2
  f
 xn x1

2 f 
..

x1xn 

: 

2 f 
..
xn2 
Assuming f has first and second order partial derivatives, the
second order Taylor series expansion of f about some point (in ndimensions) a is approximately
(x-a)T
f(x)  f(a)  fx (x - a) 
fxx (x - a)
2!
Here the partial derivatives fx and fxx are computed at x = a.
28/04/2020
SEMMA13 Eng Maths and Stats
46
Optimisation
Just as the differentiation of a f(x) w r t x can be used to find local
maxima or minima, and hence work out optimum values, the concept
can be extended for functions of many variables.
For some vector x, it is determined where fx is 0.
The function f has a maximum if fxx< 0 and a minimum if fxx > 0.
A minimum occurs, for instance, if fxx is positive definite
That is all its eigenvalues are positive (see matrix material)
If a matrix has positive and negative eigenvalues if is a saddle point
Similar to turning points for functions of one variable
28/04/2020
SEMMA13 Eng Maths and Stats
47
Two Examples
f(x1 ,x2 ) = x12 + x22
f
= fx = 2x1 2x2 
x
A critical point, therefore, is [0, 0]
2 0 
Hessian fxx = 
, whose eigenvalues are 2,2

0 2 
Clearly fxx > 0, fx = 0, so f has a minimum at 0,0 – plot confirms
f(x1 ,x2 ) = x12 - x22
f
= fx = 2x1
x
-2x2 
2 0 
Hessian fxx = 
 , eigenvalues 2,-2
0

2


Hence we have a saddle point
28/04/2020
SEMMA13 Eng Maths and Stats
48