Matrices and vectors become useful in multi-dimensional

advertisement
community project
mathcentre community project
encouraging academics to share maths support resources
All mccp resources are released under a Creative Commons licence
mcccp-richard-3
For the help you need to support your course
Mathematical Tools
for Physical Sciences
and Systems Biology
This leaet is a summary of common mathematical denitions and properties used in Physical Sciences and Systems
Biology, including matrix algebra, ordinary and partial differential equations, random processes & some numerical
methods for integrating ODEs.
Author: Morgiane Richard
University of Aberdeen
Reviewers: Mamen Romano & Ian Stanseld
University of Aberdeen
www.mathcentre.ac.uk
Matrices and vectors become useful in multi-dimensional of r and c is:
problems, e.g. systems of equations or dierential equations; hence it is important to know their properties.
r·c=
n
X
ai bi
i=1
Multiplication of matrices: you can only multiply a maLinear independence
trix A (l,m) with a matrix B (m,n) and you get a matrix
The span of a set of vectors S = {v˜1 , v˜2 , · · · v˜n } is the of order (l,n). Then the matrix C = A · B has coecients:
m
set of all linear combinations of vectors v˜1 , v˜2 , · · · v˜n , i.e.
X
ci,j =
ai,k bk,j
the set of all the vectors written in the form:
c1 v˜1 + c2 v˜2 + · · · + cn v˜n
with (ci )1≤i≤n real numbers
k=1
Trace of a square matrix A: this is the sum of all elements
on the diagonal of A.
Linear independence: a set of vectors {v˜1 , v˜2 , · · · v˜n } is
linearly dependent if and only if:
Determinant of a square matrix A: this is written |A| or
det
A. The determinant of a matrix A2,2 is
either one of the vectors can be written as a linear
combination of the other vectors;
det A = a1,1 a2,2 − a1,2 a2,1
or: the equation c1 v˜1 + c2 v˜2 + · · · + cn v˜n = 0 has For matrices An,n of higher order:
one non-trivial solution (other than ci = 0 for all i);
n
X
det A =
(−1)i+j Mi,j ai,j
or: the linear system with augmented
matrix
A|
0̃
,
j=1
where A is the matrix v~1 , v~2 · · · , v~n , has a nonwhere Mi,j is the minor, i.e. the determinant of the matrix
trivial solution.
obtained by removing row i and column j from A. The term
(−1)i+j Mi,j is called the cofactor of ai,j .
Matrix algebra
T
0
Denition of a matrix: A matrix of order m × n is a block Transpose of a square matrix A: this is written A or A
and it is obtained by ipping the rows and columns of the
of elements arranged in m rows and n columns:
matrix. The transpose of a row vector becomes a column


vector. Given 2 matrices A and B and a scalar k, we have
a1,1 a1,2 · · · a1,n
the following properties:
 a2,1 a2,2 · · · a2,n 


Am,n =  .

.
.
...
..
.. 
(AT )T
=A
 ..
am,1
am,2
···
am,n
(kA)T
(A + B)T
(AB)T
= kAT
= AT + BT
= BT AT
A square matrix is a matrix which has the same number
of rows and columns, and a diagonal matrix has non-zero
coecients on the diagonal only. Column vectors and row
of a square matrix A (n,n): is a matrix, written
vectors are particular matrices of order (m, 1) and (1, n) Inverse
−1
−1
−1
A
,
such
that
respectively.
 AA = A A = In where In is the iden-
Scalar product: this is the product of a row vector and tity matrix:
a column vector which both have the same number
of elements. Given a row vector r = a1 , a2 , · · · an and a
column vector c = b1 , b2 , · · · bn , then the scalar product inverse.
1
1 0
0 1

 .. ..
. .
0 0
···
···
...
···
0
0

.
.. 
.
1
Not all matrices have an
The inverse A−1 of a matrix A, if it exists, can be calcu1
lated with the following formulae: A−1 =
CT where
det A
C is the matrix of cofactors of A. Therefore, if the determinant of a matrix is 0, then it is not invertible. The
following properties hold:
(A−1 )−1
−1
(kA)
(AB)−1
(AT )−1
=A
1
= A−1
k −1 −1
=B A
= (A−1 )T
dy
First order ODEs of the form + P(t)y = Q(t) can be Solving systems of two linear rst order dierential
dt
equations : we will only consider systems of 2 equations
solved by the method of integrating factor.
in this leaet.
R
Dene the Z
integrating factor IF(t) = e P(u)du then y(t) =
R

Q(u)IF(u)du + C where C is a constant
e− P(u)du

 dx = a11 x + a12 y
dt
of integration.
 dy
Homogeneous second order ODEs are of the form:
dy
d2 y
+ cy = 0.
a 2 +b
dt
dt

dt
x
X =
y
=
a21 x + a22 y
a11 a12
We write
and A = a
. Then the
a22
21
dX
system of ODEs is equivalent to
= AX and the sodt
λ1 t
λ2 t
lutions are: X = c1 V1 e + c2 V2 e , where (λ1 , λ2 ) are
the eigenvalues and (V1 , V2 ) are the eigenvectors of the
Solutions of these ODEs are: y(t) = c1 er1 t + c2 er2 t where
1 , c2 ) are constants of integration and (r1 , r2 ) are the
Rank of a matrix: this is the order of the largest square (c
solutions of the characteristic equation ar2 + br + c = 0.
sub-matrix with non-zero determinant. Alternatively, this
is the number of rows (equivalently columns) which are If the two roots are equal r1 = r2 = r then the solutions of
the ODEs are y(t) = c1 ert + c2 tert .
matrix A. The eigenvalues p
can be found using the followlinearly independent.
β ± β 2 − 4γ
with β = tr(A) and
order ODEs with right hand side are of the form ing formulae: λ1,2 =
Elementary row operations: these are used in the Gaus- Second
2
2
sian elimination method to solve systems of equations. a d y + b dy + cy = f(t). The solutions of these ODEs are γ = det A.
dt2
dt
There are:
of the form y(t) = yH (t) + yP (t) where yH (t) is the solution of the corresponding homogeneous ODE found as An equilibrium solution is a solution for which dy = 0
Interchanging rows;
dt
above and yP (t) is a particular integral of the ODE. The
Multiplying the elements of a row by a scalar;
form of the particular integral will be found using guidelines (for a rst order ODE) or dX = 0 (for a system of
0
dt
on Table 1.
Adding or subtracting to the elements of a row the
ODEs). In the case of a rst order ODE, an equilibrium
corresponding elements of another row.
Table 1: Finding a particular integral to a second order ODE may be attracting (sink) if nearby solutions (i.e. solutions
with right hand side. The constants C and D are found by with initial condition close to the equilibrium) converge to
Eigenvalues and eigenvectors: the eigenvalues λi and `plugging' the particular integral in the ODE, which will lead to the equilibrium or repelling (source) if nearby solutions dieigenvectors Xi are such that AXi = λi Xi . The eigenvalues conditions that dene C and D.
verge from it. For a system of ODEs, the stability of the
are found by solving the polynomial: det(A − λi In ) = 0.
equilibrium may be classied as follows (see Figure 1):
For f(x) of the Try a particular integral
The eigenvectors may then be found by solving AXi =
form:
of the form:
λ i Xi .
If β < 0 and γ > 0, the equilibrium is stable (stable
k
C
node is β 2 > 4γ and stable spiral is β 2 < 4γ );
kx
Cx + D
2
2
Dierential Equations
kx
Cx + Dx + E
k sin x or k cos x
C cos x + D sin x
If γ < 0, the equilibrium is a saddle point;
dy
k sinh x or k cosh x
C cosh x + D sinh x
First order ODEs of the form
= f(y)g(t) can be
dt
ekx
Cekx
solved by the method of separation of variables:
rx
If β = 0 and γ > 0, the equilibrium is a neutral
e , where r is a root Cxerx or Cx2 erx
Z
Z
dy
centre;
of the characteristic
= g(t)dt so H(y) = G(t) + C where C is a conf(y)
equation
stant of integration. It may be possible to rearrange and
If β > 0 and γ > 0, the equilibrium is unstable
get an explicit expression for y. A classic example is the
(unstable node if β 2 > 4γ and unstable spiral if
dy
at
ODE
= ay which has solution y = Ce .
www.mathcentre.ac.uk
β 2 < 4γ ).
dt
2
beta
5
2
beta − 4* gamma= 0
unstable node
saddle node
unstable spiral
saddle node
stable spiral
0
stable node
−5
−2
−1
0
1
2
3
4
gamma 5
Figure 1: β − γ parameter plane: change in the nature of an
equilibrium with the value of the trace (β ) and determinant (γ )
of the system matrix.
Second partial derivatives: are obtained by dierentiat- an exact dierential, i.e., there exists a function f(x, y) so
∂f
∂f
ing
and . There are therefore 4 second derivatives, that ∂f = G(x, y) and ∂f = H(x, y) if ∂G = ∂H .
∂x
∂y
∂x
∂y
∂y
∂x
i.e.:
∂f Partial dierential equations (PDE)
∂2f
(or
f
)
which
is
obtained
by
dierentiating
xx
∂x2
∂x
∂f
with respect to x once more (treating y as a constant Direct integration: if ∂x = u(x, y) then f(x, y) =
Z
again);
u(x, y)dx+v(y) where v(y) is a function of y only which
∂2f
∂f
(or
f
)
which
is
obtained
by
dierentiating
can be determined by the initial conditions.
yy
∂y2
∂y
with respect to y once more (treating x as a constant Separation of variables: this method is used to solve 3
again);
classes of PDEs:
Systems of non-linear equations are usually not solvable analytically but can be linearised around an equilibrium
point. Consider a system with equilibrium (x0 , y0 ):


 dx =
dt
dy


=
dt
∂2f
∂y∂x
∂f
(or fxy ) which is obtained by dierentiating
∂x
with respect to y (now treating x as a constant);
∂2f
∂x∂y
∂f
(or fyx ) which is obtained by dierentiating
∂y
with respect to x (now treating y as a constant);
For most `nice' functions, we have
F(x, y)
∂2f
∂2f
=
∂y∂x
∂x∂y
G(x, y)
Small increments: given a function f(x,y), it is possible
to calculate the increase (or decrease) in f δf if x and y are
Then in the neighbourhood of (x0 , y0 ), the system can be
∂f
∂f
increased (or decreased) by δx and δy: δf = δx + δy.
dX
∂x
∂y
approximated to:
= J(x0 , y0 )X with the Jacobian ma
 dt
Change of variables:
∂F
∂F
(x , y )
(x0 , y0 )
 ∂x 0 0

∂y
case 1: if f = f(x, y) with x = x(t) and y = y(t), then
trix J(x0 , y0 ) =  ∂G

∂G
∂f dx
∂f dy
df
(x0 , y0 )
(x0 , y0 )
(also writen as f'(t) or ḟ(t)) =
+
.
∂x
∂y
dt
Partial derivatives and Partial Dierential Equations
∂x dt
∂y dt
case 2: if f = f(x, y) with y = y(x) then
df
∂f
∂f dy
=
+
.
First partial derivatives: consider a function of two vari- dx ∂x ∂y dx
able f(x, y), then:
case 3: if f = f(x, y), x = x(u, v) and y = y(u, v) then:
∂f

∂f


=
∂u
∂f


=
∂v
∂f ∂x
∂f ∂y
+
∂x ∂u ∂y ∂u
∂f ∂x
∂f ∂y
+
∂x ∂v ∂y ∂v
the rst derivative of f with respect to x,
or fx ,
∂x
is obtained by dierentiating f treating y as a constant;
the rst derivative of f with respect to y,
or fy , Dierential: the dierential of f = f(x, y) is df = ∂f dx +
∂y
∂x
is obtained by dierentiating f treating x as a con- ∂f
dy
.
Inversely,
the
expression
G(x,
y)dx
+
H(x,
y)dy is
stant;
∂y
∂f
3
The heat equation:
The wave equation:
Laplace equation:
∂u
∂2u
= k2 2 ;
∂t
∂x
2
∂2u
2∂ u
=
k
;
∂t2
∂x2
∂2u ∂2u
+ 2 = 0;
∂x2
∂y
The method consists of:
Assuming that the solution has the form u(x, t) =
ϕ(x)ψ(t) (or u(x, y) = ϕ(x)ψ(y) in the case of
Laplace equation);
Putting this into the PDE leads to two independent
ODEs which can be solved using ODEs techniques;
Using the initial (t = 0) and boundary (x = 0 or
x = some number) conditions to determine the constants of integration.
Note that if sine and cosine functions are involved, the initial
X conditions will often lead to a condition like: f(x) =
An cos (nπλx), where f is some function and λ some
n
scalar. Then it is handy to recognise that the coecients
An are the coecients of the Fourier series of the function
f. Most often, a family a function (ϕn , ψn ) will be solution
(usually sine, cosine, sinh or cosh functions), and the principle of superposition states that any linear combination
of all the solutionsX
is a solution. The general solution will
then be u(x, t) =
ϕn (x)ψn (t).
n
www.mathcentre.ac.uk
var(X )
Random Processes
Numerical methods
the average is var(X̄) = i 2 i . If the variance is the
n
dy
Statistical denitions: The mean of a random vari- same for all measurements, i.e., var(Xi ) = var(X) then Given the ODE
= f(x, y) and the initial condition
dx
var(X)
able X which
has
realisations
x
with
probability
p(x
)
is
i
i
X
var(X̄) =
. The coecient of variation is dened y(x0 ) = y0 , we look at methods of integrating the ODE
n
< X >=
xi p(xi ). The moment of order n of X is
numerically.
std(X̄)
i
X
as
and
quanties
the
precision
of
the
measurement.
Euler scheme: we know from Taylor series that:
< X̄ >
< Xn >=
xni p(xi ). It is custom to denote the mean by
P
i
the Greek letter µ.
h2 d2 y
dy
(x) +
(x) + · · ·
dx
2 dx2
y(x + h) ≈ y(x) + hf(x, y)
y(x + h) =
The variance of X is the moment of order 2 about its mean:
var(X) =< (X− < X >)2 >=< X2 > − < X >2 . The
variance describes the variability of X from its mean. The
standard deviation
of X is the square root of its variance:
p
std(X) = var(X). It is custom to denote the variance
and standard deviation respectively by σ2 and σ.
y(x) + h
Poisson process: is a sequence of discrete events taking
place at rate λ which is such that the number of observations N(t) in an interval of length t is Poisson distributed, Therefore we get the recurrence relationship which is the
Euler scheme:
i.e.
P(N(t) = n) =
(λt)n −λt
e
n!
y(x0 ) = y0
yn+1 = y(xn+1 ) = yn + hf(xn , yn )
The error will depend on the value of h chosen, so the
smaller the value of h, the smaller the error.
i
i
Runge-Kutta scheme: The idea is the same as for the
and the number of events in disjoint time intervals are inde- Euler scheme (approximation using Taylor polynomials),
Covariance: For 2 random variables X and Y, the co- pendent of each other. Then, the time to the next event, but the approximation is usually more accurate than with
variance is: cov(X, Y) =< XY > − < X >< Y >. The T (which is a continuous random variable), is exponentially the Euler scheme.
correlation coecient is dened as:
distributed, i.e.:
The formulae for the second-order Runge-Kutta method
cov(X, Y)
.
cor(X, Y) = p
are:
Mean sum
X theorem:
X Given a set of random variables
(Xi ), <
Xi >=
< Xi > .
var(X)var(Y)
P(T ≤ t) = 1 − e−λt
k1 =
hf(xn , yn )
1
1
hf(xn + h, yn + k1 )
2
2
yn + k2
If X and Y are completely correlated, then cor(X, Y) = 1,
k2 =
if X and Y are anti-correlated then cor(X, Y) = −1 and
yn+1 =
if X and Y are independent then cor(X, Y) = 0. For 2 in- This process is memoryless, i.e.: P(T > (t + s)|T > t) =
The formulae for the fourth-order Runge-Kutta method
dependent random variables X and Y: < XY >=< X >< P(T > s).
(which is used most widely) are:
Y >.
Variance sum theorem: Given 2 random variables X and The Poisson process is very important and widely used to
Y: var(X + Y) = var(X) + var(Y) + 2cov(X, Y). If X and model statistical processes in Physics, Chemistry and BiolY are independent: var(X + Y) = var(X) + var(Y)X
, and for ogy.
a set of independent random variables (Xi ), var( Xi ) =
i
k1 =
k2 =
k3 =
k4 =
hf(xn , yn )
1
1
hf(xn + h, yn + k1 )
2
2
1
1
hf(xn + h, yn + k2 )
2
2
hf(xn + h, yn + k3 )
k2
k3
k4
k1
+
+
+
yn +
6
3
3
6
Decay rate and half-life: the half-life T1/2 is the time
var(Xi ).
yn+1 =
N(0)
i
at which the population is halved: N(T1/2 ) =
and
2
is
related
to
the
rate
of
decay
λ
of
the
process
by
the
Combining measurements: If n independent measureln 2
ments (Xi ) are made for a particular
quantity, then the relationship: T1/2 =
.
P
λ
X
i
i
average measurement is X̄ =
and the variance of
www.mathcentre.ac.uk
n
X
4
Download