Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke-...

27
Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke-Sylvester as an adjunct to the Lecture notes posted on the course web page

Transcript of Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke-...

Page 1: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Exponentials, logarithms and rescaling of data

Math 151

Based upon previous notes by Scott Duke-Sylvester as an adjunct to the Lecture notes posted

on the course web page

Page 2: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Definitions

• f(x) = ax, exponential function with base a

• f(x) = logax, logarithm of x base a

• f(x) = axb, is an allometric function

Page 3: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Motivation• Many biological phenomena are non-linear:

Population growthRelationship between different parts/aspects of an

organism (allometric relationships)The number of species found in a given area (species-area

relationships)Radioactive decay and carbon datingMany others

• Exponentials, logs and allometric functions are useful in understanding these phenomena

Page 4: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• Population growth is a classic exampleAlgae : cell division

Geometric growth

…1

2 48 16

32 64

t = 0 1 2 3 4 5 6

Page 5: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Population Size vs. time

0

10

20

30

40

50

60

70

0 1 2 3 4 5 6 7

Time (t)

Popula

tion S

ize (

N)

Page 6: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Exponentialsf(x) = ax, a > 0

a > 1exponential increase

0 < a < 1exponential decrease

As x becomes very negative, f(x) gets close to zero

As x becomes very positive, f(x) gets close to zero

Page 7: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• Special case, a = 1

Page 8: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• f(x) = ax is one-to-one. For every x value there is a unique value of f(x).

• This implies that f(x) = ax has an inverse.

• f-1(x) = logax, logarithm base a of x.

Page 9: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

-4

-2

0

2

4

6

8

-6 -4 -2 0 2 4 6 8

f(x) = ax

f(x) = logax

Page 10: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• logax is the power to which a must be raised to get x.

• y = logax is equivalent to ay = x• f(f-1(x)) = alogax = x, for x > 0• f-1(f(x)) = logaax = x, for all x.• There are two common forms of the log fn.

a = 10, log10x, commonly written a simply log x

a = e = 2.71828…, logex = ln x, natural log.

• logax does not exist for x ≤ 0.

Page 11: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Laws of logarithms• loga(xy) = logax + logay

• loga(x/y) = logax - logay

• logaxk = k·logax

• logaa = 1

• loga1 = 0

• Example 15.7 :

23x 1.7

log10 23x log10 1.7

3x log10 2 log10 1.7

xlog10 1.7

3log10 2

x0.2304

3* 0.3010.2551

Page 12: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• Example 15.8 : Radioactive decayA radioactive material decays according to the law N(t)=5e-0.4t

0

1

2

3

4

5

6

0 2 4 6 8 10

Time t (months)

Num

ber

of

gra

ms

N

months023.4)4.0/(6909.1t

)4.0)/(2.0(lnt

t4.0)2.0(ln

)(eln)2.0(ln

e5/1

e51

t4.0

t4.0

t4.0

When does N = 1?For what value of t does N = 1?

Page 13: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

loga xlog10 x

log10 a

loga xln x

lna

To compute logax if your calculator doesn’t have loga

log2 64 ln64

ln2

4.1588...

0.6931...6

Example:

or use

Page 14: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• general formula for a simple exponential function:f(x) = x or y = x

Then ln(y) = ln x

ln(y) = ln + ln (x )ln(y) = ln + x ln

Let b = ln , and m = ln , Y=ln (y) then this showsY = b + mx

which is the equation of a straight line.This is an example of transforming (some) non-linear data so that the

transformed data has a linear relationship. An exponential function gives a straight line when you plot the log of y against x (semi-log plot).

Special exponential form : f(x) = emx

Page 15: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Consider the algae growth example again. How do you know when a relationship is exponential?

0

10

20

30

40

Num

ber

of

cells

N

-1 0 1 2 3 4 5 6Time t

-1

0

1

2

3

4

ln(N

)

-1 0 1 2 3 4 5 6Time t

Regular plot Semilog plot

Time t Number of Cells ln(N)0 1 01 2 0.693147182 4 1.386294363 8 2.079441544 16 2.772588725 32 3.4657359

N= t ln(N) = mt+b

Page 16: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

-1

0

1

2

3

4

ln(N

)

-1 0 1 2 3 4 5 6Time t

• Fit a line to the transformed data

• Estimate the slope and intercept using the least squares method.

• Y=mx+b

• b~0, m = 0.693..

• Estimate and .b = ln -> = eb = e0 = 1

m = ln -> = em = e0.693.. = 2.0

N = 2t

0

10

20

30

40

Num

ber

of

cells

N

-1 0 1 2 3 4 5 6Time t

ln(N) = (0.693)t

N=2t

Page 17: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

Example 17.9 : Wound healing rate

Time t (days) Area A (cm^2) ln(A)0 107 4.672828834 88 4.477336818 75 4.31748811

12 62 4.1271343916 51 3.9318256320 42 3.7376696224 34 3.5263605228 27 3.29583687

25

50

75

100

125

are

a A

(cm

^2)

-5 0 5 10 15 20 25 30Time t (days)

Regular plot

3.25

3.5

3.75

4

4.25

4.5

4.75

ln(A

)

-5 0 5 10 15 20 25 30Time t (days)

Semilog plot

Page 18: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• How do you make a semilog plot?

• Use the semilog(x,y) command in Matlab

• Take the log of one column of data and plot the transformed data (here log y) against the untransformed data (here x)

Page 19: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

3.25

3.5

3.75

4

4.25

4.5

4.75

ln(A

)

-5 0 5 10 15 20 25 30Time t (days)

• Estimate slope and intercept using least squares

• Y = b+mx• m = -0.048• b = 4.69• b = ln -> = eb = e4.69 =

108.85• m = ln -> = em = e-

0.048 = 0.953• A = 108.85(0.953)t

25

50

75

100

125

are

a A

(cm

^2)

-5 0 5 10 15 20 25 30Time t (days)

ln(A)=4.96-0.048t

A=108.85(0.953)t

Page 20: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

f(x)=bxa

• Allometric relationships (also called power laws)• Describes many relationships between different aspects of a single

organism:Length and volumeSurface area and volumeBody weight and brain weightBody weight and blood volume

• Typically x > 0, since negative quantities don’t have biological meaning.

Page 21: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

a > 1

a = 1

a < 1

a < 0

Page 22: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

f(x) = bax

f(x) = bxa

Page 23: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• Example : It has been determined that for any elephant, surface area of the body can be expressed as an allometric function of trunk length.

• For African elephants, a=0.74, and a particular elephant has a surface area of 20 ft2 and a trunk length of 1 ft.

• What is the surface area of an elephant with a trunk length of 3.3 ft?

• x = trunk length

• y= surface area

• y = bxa = bx0.74

• 20 = b(1)0.74 20 = b

• y=20x0.74

• y=20(3.3)0.74=48.4 ft2

Page 24: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• How do you know when your data has an allometric relationship?

• Example 17.10

length L (cm) weight W (lbs)70 14.380 21.590 30.8

100 42.5110 56.8120 74.1130 94.7140 119160 179180 256

0

50

100

150

200

250

300

weig

ht

W (

lbs)

50 75 100 125 150 175 200length L (cm)

Page 25: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

2.5

3

3.5

4

4.5

5

5.5

6

ln(W

)

50 75 100 125 150 175 200length L (cm)

2.5

3

3.5

4

4.5

5

5.5

6

ln(W

)

4 4.25 4.5 4.75 5 5.25ln(L)

0

50

100

150

200

250

300

weig

ht

W (

lbs)

50 75 100 125 150 175 200length L (cm)

log-log plotSemilog plot

Regular plot

Page 26: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• How do you make a log-log plot?

• Use the loglog(x,y) command in matlab

• Take the log of both columns of data and plot the transformed columns.

Page 27: Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.

• Y=bxa

• ln(y)=ln(bxa)• ln(y) = ln(b) + ln(xa)• ln(y) = ln(b) + a ln(x)• Let

Y = ln(y)X=ln(x)B=ln(b)Then Y=B + a X

Which is the equation for a straight line. So an allometric function gives a straight line on a loglog plot.