Chapter 6: Vectors & Matrices

35
Chapter 6: Vectors & Matrices 1. Introduction to Unit 2 2. (6.1) Vector Structure 3. (6.2) Vector Algebra 4. (6.3) Dynamics: Vectors Changing Over Time

description

Chapter 6: Vectors & Matrices. Introduction to Unit 2 (6.1) Vector Structure (6.2) Vector Algebra (6.3) Dynamics: Vectors Changing Over Time. 1. Introduction to Unit 2. Biological Motivation. - PowerPoint PPT Presentation

Transcript of Chapter 6: Vectors & Matrices

Page 1: Chapter 6: Vectors & Matrices

Chapter 6: Vectors & Matrices

1. Introduction to Unit 22. (6.1) Vector Structure3. (6.2) Vector Algebra4. (6.3) Dynamics: Vectors Changing Over Time

Page 2: Chapter 6: Vectors & Matrices

Biological Motivation

• Biological objects of interest have structure that suggest to us the way those objects should be analyzed, for example:– various components of cells, e.g. chemical composition– cellular composition of tissues– tissue composition of individual organisms– composition of different individuals which make up a population, e.g.

demographic structure (gender, age, location, economic status) or epidemiological structure (susceptible, infected, recovered)

– species which make up a community– types of habitat across a landscape

• In this unit we will discuss mathematical concepts that provide a way to describe the structure/composition of these biological objects and a mechanism to analyze how the composition might change through time or across space (dynamics)

1. Introduction to Unit 2

Page 3: Chapter 6: Vectors & Matrices

A Guiding Example

• A motivating example that we will use regularly in this unit concerns patterns of species across a landscape

• Think of taking aerial photographs of a plot of land once each decade and analyzing the changes in certain patterns across the landscape– Plant composition (deciduous hardwoods, herbaceous, grassland,

etc.)– Land use composition (agricultural, urban, suburban, etc.

• One descriptive summary you might use for the landscape is to describe it by the fraction of the total area which is covered by each of the different land uses

1. Introduction to Unit 2

Page 4: Chapter 6: Vectors & Matrices

A Guiding Example

1. Introduction to Unit 2

Page 5: Chapter 6: Vectors & Matrices

Biological Motivation

• A description of this landscape at a particular time could use a list of numbers giving the fraction of the landscape for each use… in other words a vector of numbers which sum to one

• As time goes on (e.g. we take a picture of the landscape every decade), the vector describing the fraction covered by each type of organism will change

• If we could determine the rules by which this vector changes, we would have a basis for a model of the landscape’s dynamics (called succession in ecology)

• From this model we might then be able to determine from just a few decades of pictures, what the landscape might look like many decades from now (the process we called extrapolation when we were talking about regressions)

1. Introduction to Unit 2

Page 6: Chapter 6: Vectors & Matrices

Definition

• Thus far we have been working with univariate and bivariate data:– The dataset in Example 1.1 was simply a list of recorded pulse rates

(univariate)– If we make two measurements- like the pulse rate and the time of

day- then we have bivariate data and we can represent each pair as a data point; that is, an ordered pair

• Ordered pairs are vectors• Notice the word “order” is important; that is, order is

important. The data point (1,3) is not the same as (3,1)• More generally, a vector is an ordered n-tuple

• Notation:

2. (6.1) Vector Structure

1,3( ) = 1 3[ ] =1

3

⎣ ⎢

⎦ ⎥

Page 7: Chapter 6: Vectors & Matrices

Example 6.1

• Suppose we were asked to construct a vector that would represent the composition of a coastal wetlands landscape… what would that mean?

• First, we would have to decide what classes make up a coastal wetlands– Coastal wetlands are areas near the coast where the soil is submerged or

soaked with moisture either permanently or seasonally– Coastal wetlands are found between areas that are always wet (i.e.

oceans, seas, bays, and estuaries), and areas that are always dry (i.e. grasslands and forests)

– We could divide wetlands up into land that is submerged underwater, and land that is not submerged (two classes)

– However, we might decided that having two classes is not enough to accurately describe the variation in landscape in the wetlands. Thus, it might be appropriate to introduce a third class, land that is not submerged, but heavily saturated with moisture

2. (6.1) Vector Structure

Page 8: Chapter 6: Vectors & Matrices

Example 6.1

• After we decide what the classes are we must decide how to order them: we will use the order: submerged, saturated but not submerged, dry

• If we let:– u = proportion of wetlands that are submerged or under water– s = proportion of wetlands that are not submerged but saturated

with moisture– d = proportion of wetlands that are dry, then the vector v

representing the coastal wetlands composition would be:

If at some particular time t, 65% of the wetlands were submerged, 30%

saturated, and 5% dry, then we’d have:

2. (6.1) Vector Structure

v =r v =

u

s

d

⎢ ⎢ ⎢

⎥ ⎥ ⎥

v t( ) =

u t( )

s t( )

d t( )

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

0.65

0.30

0.05

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 9: Chapter 6: Vectors & Matrices

Example 6.1

• Alternatively, we could divide wetlands up into the types of plants that grow there

• For example, the types of flora that grow in the Queensland coastal wetland in Australia are: mangroves, seagrasses, grasses, sedges/rushes, ferns, wet heaths, trees and shrubs, and saltmarsh plants

• This would give 8 classes. Just as above, we could construct and ordering for these classes and then construct a vector representing the composition of the Queensland coastal wetlands based on the proportion of the total area in which each of the above type of fauna grows

2. (6.1) Vector Structure

Page 10: Chapter 6: Vectors & Matrices

Addition & Scalar Multiplication

Let v, w be n-tuples and c a scalar (number). Then we define: 1. Vector addition:

2. Scalar Multiplication:

3. (6.2) Vector Algebra

v+ w =

v1

v2

M

vn

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

+

w1

w2

M

wn

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

=

v1 + w1

v2 + w2

M

vn + wn

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

cv =

cv1

cv2

M

cvn

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

Page 11: Chapter 6: Vectors & Matrices

Example 6.2

• In Example 6.1 we formed a vector to describe the structure of a coastal wetlands at a particular time t. The elements of the vector were proportions of the total area that were submerged, saturated, and dry. Suppose we knew the total area of the landscape to be 160 hectares. How would we determine how many hectares were in each of the three classes?

• Solution:

3. (6.2) Vector Algebra

160v =160 ⋅

0.65

0.30

0.05

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

104

48

8

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 12: Chapter 6: Vectors & Matrices

Example 6.3

• Suppose we were managing some national park. For the entire park the flora composition is: 8% annual plants, 23% perennial plants and grasses, 26% shrubs, 24% softwood trees and pines, and 19% hardwood trees. The total area of the park is 1,250 hectares. The park is now considering purchasing 300 hectares of farmland located next to the park of which 5% is annual plants, 90% is perennial plants and grasses, and 5% is softwood trees and pines. If the national park acquires this new land, what will be the new flora composition for the park?

• Solution: We are given the classes, so we first need todecide on an order:

3. (6.2) Vector Algebra

p =

% annuals

% perennials

% shrubs

% softwood

% hardwood

⎢ ⎢ ⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥ ⎥ ⎥

Page 13: Chapter 6: Vectors & Matrices

Example 6.3

• We are given the current composition information for the park and the farm:

• Notice that we should not directly add these two vectors. Why?

• We must convert both vectors to hectare units, then it makes sense to add the vectors:

3. (6.2) Vector Algebra

p = 0.08 0.23 0.26 0.24 0.19[ ]T

f = 0.05 0.90 0 0.05 0[ ]T

1250p+ 300f =

100.0

287.5

325.0

300.0

237.5

⎢ ⎢ ⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥ ⎥ ⎥

+

15

270

0

15

0

⎢ ⎢ ⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥ ⎥ ⎥

=

115.0

557.5

325.0

315.0

237.5

⎢ ⎢ ⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥ ⎥ ⎥

⇒ pnew =1

1550

115.0

557.5

325.0

315.0

237.5

⎢ ⎢ ⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥ ⎥ ⎥

=

0.074

0.359

0.210

0.203

0.153

⎢ ⎢ ⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥ ⎥ ⎥

Page 14: Chapter 6: Vectors & Matrices

• Consider again our coastal wetlands example:– u = proportion of wetlands that are submerged or under water– s = proportion of wetlands that are not submerged but saturated

with moisture– d = proportion of wetlands that are dry, then the vector v

representing the coastal wetlands composition would be:

4. (6.3) Dynamics: Vectors Changing Over Time

v =r v =

u

s

d

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 15: Chapter 6: Vectors & Matrices

Example 6.4 (Ecological Succession: Simple Case)

• Suppose we were looking at a total area of 100 hectares which is all currently submerged wetlands

• Every 10 years:– 5% of submerged wetlands become saturated wetland– 12% of saturated wetlands become dry– 100% of dry wetlands remain dry

• After 10 years, how much of the land is submerged, how much is saturated, and how much is dry?

• After 20 years?

4. (6.3) Dynamics: Vectors Changing Over Time

Page 16: Chapter 6: Vectors & Matrices

Example 6.4 (Ecological Succession: Simple Case)

• First we write out the initial composition vector:

• Next, we find the composition vector after 10 years:– Submerged:

– Saturated:

– Dry:

– Hence:

4. (6.3) Dynamics: Vectors Changing Over Time

v 0( ) =

u 0( )

s 0( )

d 0( )

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

1

0

0

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u 10( ) = u 0( ) − 0.05u 0( ) = 0.95u 0( ) = 0.95

s 10( ) = s 0( ) − 0.12s 0( ) + 0.05u 0( ) = 0.88s 0( ) + 0.05u 0( ) = 0.05

d 10( ) = d 0( ) + 0.12s 0( ) = 0.00

v 10( ) =

u 10( )

s 10( )

d 10( )

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

0.95

0.05

0

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 17: Chapter 6: Vectors & Matrices

Example 6.4 (Ecological Succession: Simple Case)

• To find the composition after 20 years, we use v(10):

• Next, we find the composition vector after 20 years:– Submerged:

– Saturated:

– Dry:

– Hence:

4. (6.3) Dynamics: Vectors Changing Over Time

u 20( ) = u 10( ) − 0.05u 10( ) = 0.95u 10( ) = 0.9025

s 20( ) = s 10( ) − 0.12s 10( ) + 0.05u 10( ) = 0.88s 10( ) + 0.05u 10( ) = 0.0915

d 20( ) = d 10( ) + 0.12s 10( ) = 0.006

v 20( ) =

u 20( )

s 20( )

d 20( )

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

0.9025

0.0915

0.006

⎢ ⎢ ⎢

⎥ ⎥ ⎥

v 10( ) =

u 10( )

s 10( )

d 10( )

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

0.95

0.05

0

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 18: Chapter 6: Vectors & Matrices

Example 6.4 version 2.0

• Let’s try to be a bit more economical with this process:

• Rewriting, we have:

4. (6.3) Dynamics: Vectors Changing Over Time

u 10( ) = 0.95u 0( )⇒ u t +1( ) = 0.95u t( )

s 10( ) = 0.88s 0( ) + 0.05u 0( )⇒ s t +1( ) = 0.88s t( ) + 0.05u t( )

d 10( ) = d 0( ) + 0.12s 0( )⇒ d t +1( ) = d t( ) + 0.12s t( )

u t +1( ) = 0.95u t( ) + 0.00s t( ) + 0.00d t( )

s t +1( ) = 0.05u t( ) + 0.88s t( ) + 0.00d t( )

d t +1( ) = 0.00u t( ) + 0.12s t( ) +1.00d t( )

Page 19: Chapter 6: Vectors & Matrices

Example 6.4 version 2.0

• If we form an array of only the numbers, we obtain the coefficient matrix:

• Comments:– This is a matrix; specifically it is a 3x3 matrix– Each column sums to 1– Diagonal entries represent proportions of each class that stay in that

class each time step– Off-diagonal entries represent proportions of each class that move

to other classes each time step:

4. (6.3) Dynamics: Vectors Changing Over Time

0.95 0 0

0.05 0.88 0

0 0.12 1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 20: Chapter 6: Vectors & Matrices

Example 6.4 version 2.0

• One can think of the coefficient matrix in the following way:

moving from

moving into

• For this reason, the coefficient matrix sometimes called a transfer matrix

4. (6.3) Dynamics: Vectors Changing Over Time

0.95 0 0

0.05 0.88 0

0 0.12 1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u t( ) s t( ) d t( )

u t +1( )

s t +1( )

d t +1( )

Page 21: Chapter 6: Vectors & Matrices

Example 6.4 version 2.0

• Rewriting again:

• Comments:– The equation above involves matrix multiplication; to be discussed

in Chapter 7– Transfer matrices can be represented by a flow diagram:

4. (6.3) Dynamics: Vectors Changing Over Time

v t +1( ) =

u t +1( )

s t +1( )

d t +1( )

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

0.95 0 0

0.05 0.88 0

0 0.12 1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u t( )

s t( )

d t( )

⎢ ⎢ ⎢

⎥ ⎥ ⎥=C ⋅v t( )

Page 22: Chapter 6: Vectors & Matrices

Modeling Structural Change in General

• We now write this more generally; suppose we have n classes to our landscape:– Then we can write the vector describing the composition of the

landscape (composition vector) at time step t as:

where the kth entry, vk(t), is the proportion of the landscape that is class k at time t

– Since these are proportions, we have:

4. (6.3) Dynamics: Vectors Changing Over Time

v t( ) =

v1 t( )

v2 t( )

M

vn t( )

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

0 ≤ vk t( ) ≤1 and vk t( )k=1

n

∑ = v1 t( ) + v2 t( ) +L + vn t( ) =1

Page 23: Chapter 6: Vectors & Matrices

Modeling Structural Change in General

• We now write this more generally; suppose we have n classes to our landscape:– Next, we create an array with n rows and n columns, i.e. an n × n

matrix:

where aij is the proportion of class j that becomes or moves into class i (i.e., this is a transfer matrix)

– We must have the entries of each column of matrix A sum to 1:

4. (6.3) Dynamics: Vectors Changing Over Time

A =

a11 a12 L a1n

a21 a22 L a2n

M M O M

an1 an 2 L ann

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

akj

k=1

n

∑ = a1 j + a2 j +L + anj =1, for j =1,2,...,n

Page 24: Chapter 6: Vectors & Matrices

Modeling Structural Change in General

• We now write this more generally; suppose we have n classes to our landscape:– Now we can describe the composition of the landscape at time step

t + 1 as:

– Or very succinctly:

– These are our dynamic equations

4. (6.3) Dynamics: Vectors Changing Over Time

v1 t +1( )

v2 t +1( )

M

vn t +1( )

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

=

a11 a12 L a1n

a21 a22 L a2n

M M O M

an1 an 2 L ann

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

v1 t( )

v2 t( )

M

vn t( )

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

v t +1( ) = Av t( )

Page 25: Chapter 6: Vectors & Matrices

Example 6.5

• Suppose we want to model how the composition of a coastal wetlands changes over time.

• Again, we will structure the wetlands into submerged, saturated, and dry.

• After a couple decades of data collection we know that every 10 years:– 5% of submerged wetlands become saturated– 1% of submerged wetlands become dry– 12% of saturated wetlands become dry– 2% of saturated wetlands become submerged again– 6% of dry wetlands become saturated again– 1% of dry wetlands become submerged again

4. (6.3) Dynamics: Vectors Changing Over Time

Page 26: Chapter 6: Vectors & Matrices

Example 6.5

• It is convenient to summarize this information with a flow diagram:

• We want to find the matrix that describes how the composition of these coastal wetlands change every 10 years.

4. (6.3) Dynamics: Vectors Changing Over Time

Page 27: Chapter 6: Vectors & Matrices

Example 6.5

4. (6.3) Dynamics: Vectors Changing Over Time

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u s du

s

d

Page 28: Chapter 6: Vectors & Matrices

Example 6.5

4. (6.3) Dynamics: Vectors Changing Over Time

0.94

0.05

0.01

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u s du

s

d

Page 29: Chapter 6: Vectors & Matrices

Example 6.5

4. (6.3) Dynamics: Vectors Changing Over Time

0.94 0.02

0.05 0.86

0.01 0.12

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u s du

s

d

Page 30: Chapter 6: Vectors & Matrices

Example 6.5

4. (6.3) Dynamics: Vectors Changing Over Time

0.94 0.02 0.01

0.05 0.86 0.06

0.01 0.12 0.93

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u s du

s

d

Page 31: Chapter 6: Vectors & Matrices

Example 6.5

4. (6.3) Dynamics: Vectors Changing Over Time

0.94 0.02 0.01

0.05 0.86 0.06

0.01 0.12 0.93

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 32: Chapter 6: Vectors & Matrices

Homework Problem: Exercise 6.5

• Construct the transfer matrix that describes the following flow diagrams:(a)

S I

• This flow diagram represents the dynamics of a non-fatal disease with susceptible (S) and infected (I) classes

4. (6.3) Dynamics: Vectors Changing Over Time

0.65 0.82

0.35 0.18

⎣ ⎢

⎦ ⎥

Page 33: Chapter 6: Vectors & Matrices

Homework Problem: Exercise 6.5

• Construct the transfer matrix that describes the following flow diagrams:(b)

• This flow diagram represents the dynamics of ecological succession with classes for grass (G), shrubs (S), and trees (T)

4. (6.3) Dynamics: Vectors Changing Over Time

0.75 0 0.01

0.25 0.8 0.08

0 0.2 0.91

⎢ ⎢ ⎢

⎥ ⎥ ⎥

G S T

Page 34: Chapter 6: Vectors & Matrices

Homework Problem: Exercise 6.5

• Construct the transfer matrix that describes the following flow diagrams:(c)

• This flow diagram represents the dynamics of strontium 90 cycling through an ecosystem. The ecosystem is divided into grasses (G), soil (S), streams (W), and dead organic matter (O).

4. (6.3) Dynamics: Vectors Changing Over Time

.85 .01 0 0

.05 .98 .20 0

.10 0 .80 0

0 .01 0 1

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

G S O W

Page 35: Chapter 6: Vectors & Matrices

Homework

• Chapter 6: 6.2-6.6