Models in Biology Modelling Biology Basic Applications of Mathematics and Statistics in the Biological Sciences Part I: Mathematics Script A Introductory Course for Students of Biology, Biotechnology and Environmental Protection Werner Ulrich UMK Toruń 2007 2 Models in Biology Contents Introduction.................................................................................................................................................. 3 1: Some basic mathematics .......................................................................................................................... 4 2: Why nature loves logarithms .................................................................................................................. 9 3: Proportionalities..................................................................................................................................... 15 4: Basic functions and their application in biology.................................................................................... 23 5. Handling a changing world .................................................................................................................... 32 6: Summing up........................................................................................................................................... 41 6.1: The Newton approximation ................................................................................................................ 48 7: The sum of infinities .............................................................................................................................. 49 Literature.................................................................................................................................................... 58 Online archives and textbooks ................................................................................................................... 59 Mathematical software............................................................................................................................... 60 Latest update: 22.09.2007 Models in Biology 3 Introduction “The book of nature is written in the language of mathematics”, Galileo wrote 400 years ago. Still 15 years ago the mathematical skills of most biology students ended with school mathematics enriched with a little basic statistics. The third industrial revolution with its powerful mathematics and statistics packages changed this situation dramatically. The mathematization of our world did not leave out biology departments and the rapid transformation of biology from a merely descriptive to an explanatory science set new standards with regard to data analysis and modelling skills. Today, a sound mathematical education (together with the knowledge of at least one computer language) becomes more and more a necessity to find a job after study. The following text is the first part of a lecture in basic mathematics and statistics for biologists. The lecture contains what might be considered an international standard of basic knowledge although many readers will surely miss important branches. However, a one year course that has to deal with mathematics modelling must be to a certain extent eclectic. Emphasis was especially paid to basic mathematical techniques and principles of biological modelling. Many examples are included that show how to program simple tasks with a spreadsheet program and how to use advanced mathematics software. The text does not repeat school mathematics. Therefore, basic algebra and especially geometry are as well missing as approximation techniques and integral solving. Today, math programs do such jobs for us and the aim of this introductory course is more to teach how to interpret their results. The following text in not a textbook. It is intended as a script to present the contents of the lecture in a condensed form. There is no need to write a textbook again. Today, the internet took over many former tasks textbooks had. The end of this text contains therefore a small overview over important internet pages where students can find mathematics glossaries, textbooks, and program collections. 4 Models in Biology 1. Some basic mathematics All mathematics begins with counting. Then natural numbers 1, 2, 3, … have an intuitive appeal and every child begins calculating with counting and simple adding. Natural numbers appear natural to us because of the intuitive way of learning them. Even some animals like parrots, ravens, or chimps are able to count or even to do some simple calculations. Mathematicians denote the natural numbers with the symbol N. N is defined in the reange of 0 to infinity. Everybody knows of course a first extension of N. It is the set of whole numbers Z (…, -3, -2, -1, 0, 1, 2, 3, 4, …), defined in the range from -∞ to +∞ . Hence, mathematicians write ⊂ that means the set of the natural numbers is contained in the set of the whole numbers. Note that N is defined by the most elemetary operation, by adding. The operation of substracting is also possible within N but with an important limtation, 5 - 3 is defined but not 3 - 5. If we want to overcome this limitation we need Z. In the same way we can multiply within Z but for the next operation, division, we have again a limitation because 3 / 4 is not defined within Z. Hence we need the next extension, the set of the rationale numbers and note ⊂ ⊂ Again, another operation is fully defined within Q, the power. You can compute 3.35.1 within Q. But taking the root is not fully defined. From school we know that √2 is a so-called irrationale number because it cannot be written in the form a / b where a and b are both elements of Z. To define operations like √2 we need again a new class of numbers, the real numbers Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω α β γ δ ε ζ η ϑ θ ι κ λ μ ν ξ ο π ρ σ ς τ υ φ χ ψ ω ⊂ Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Jota Kappa Lambda My Ny Xi Omikron Pi Rho Sigma Tau Ypsilon Phi Chi Psi Omega ⊂ ⊂ Hence 5 is an element of N, of Z, of Q, and of R. 5∈ Set theory ∈ is element of ∉ is not element of ⊂ is part of from school. It shows us two important Logic and things. First, mathematicians use a ∧ or symbolic language to denote their objects. ∨ Of course, all of this should be known ¬ started with an intuitive approach by → N, Z, Q, and R are symbols. Second, we not if ... then ↔ exactly if... then operations, adding, substracting, taking Algebra defing objects via basic mathematical the power and roots. The number of symbols is limited. Therefore, mathematicians have to use different sign sets and alphabets to handle with their objects. Most often used is the greek alphabet given in Box 1. Box 2 = ≈ equals approximately equals < > less than larger than ∝, ∼ proportional to a absolute value of a Models in Biology 5 shows some often used operators. The intuitive way is not the only approach to start. Another approach is to start with a set of suppositions, so-called axioms. These are sentences of a formal language that contain basic relations between mathematical objects. These relations implicitely define these objects. The first mathematician who based a part of the mathematical science, the geometry, on a set of axioms, was the Greek mathematician Euclid (about 365?-300? Ad). His textbook Elements was used in schools until the 19th century. The German mathematician David Hilbert (1862-1943) intended to base all parts of mathematics on axiomatic systems, a project that had an imense influence on todays way of making science and that is called metamathematic. Our natural numbers can also be introduced via axioms. The system of the natural numbers of the Italian mathematician Giuseppe Peano (1858 - 1932) and der German Richard Dedekind (1831 - 1916) looks as follows 1. Zero is a natural number 2. Every natural number n has a follower n' defined as n+1. 3. Zero does not follow any natural number 4. If n' follows n and m' follows n and m = n then n' = m'. 5. Every set that contains zero, and with a number n also his follower n' contains the whole set of natural numbers (the principle of exhaustive induction). We see that axioms need not to be intuitively clear or even self evident. On first look the Peano Dedekind axioms appear quite odd. However, these five axioms allow to derive basic rules of calculations which are defined within the natural numbers. What is for instance 2 + 2? Axioms 2 and 4 define a series of elements related by a strict larger or smaller relation. These elements are termed by us 0, 1, 2, 3, etc. Hence numbers are in our axiomatic system only the names for those elements defined by the axioms. Axiom 2 tells that 2 is 1' hence 0''. Therefore, 2 + 2 is 2'' of 0'', the second follower of the second follower of zero. This is 0''''. We name the fourth follower of zero four. This looks very abstract but shows us important features every scientific axiomatic system must have. First of all axioms must be consistent (they must not lead to contradictions). All axioms must be independent of each other. Axioms must implicitly define basic objects and relations. For instance, the above axioms of the natural numbers define as a whole the natural numbers, but they do not define the exact meaning of follower. However, no axiometic system is complete, it est it contains all axioms being necessary to derive all mathematical theorems that can be formulated with the language used to formulate the axioms. The metamathematical investigations during the last century, especially the famous theorem of Kurt Gödel (German mathematician, 1906-1978), showed that every axiomatic system can be extended by new axioms, that are independent of the former, to define a new set of objects of which the former objects are part. Beside axioms, mathematicans need something else, rules that make it possible to derive mathematical sentences, theorems, from others. These rules allow us to proof theorems. A proof is therefore in our context nothing else than deriving a theorem from the set of axioms using this set of rules. Hence, axioms themselves cannot be proven. Mathematics knows four such rules of derivation (maybe there are even more) 1. The modus ponens: If a theorem A is true and from A follows B than B is also true. A; A→B;B. 6 Models in Biology 2. The modus tollens: If B follows from A and B is not true, than A is also not true. A→B;⌐B;⌐A. 3. Tertium non datur: Either A is true or A is false, a third possibility is impossible. A ∨ ⌐A 4. The principle of complete induction: Assume a theorem is true for a natural number n. If it is true for any number m larger than n and with necessity also for the follower m' of m than it is true for all natural numbers equal or larger than n. A(k),A(n≥k)→A(n+1);A(i≥k) It is not necessary to apply all four rules. In particular the third rule, the tertium non datur, has provoked much discussion, and it is still an open question whether this rule is at all necessary (although its acceptance makes things much easier). A series of theories in logic and natural sciences (quantum theory for istance) explicitely negate the tertium non datur leaving the majority of elementary theorems still valid. Mathematical objects are connected via operators, which are implicitely defined by axioms. Such connections are called terms. 5 + 7 is a term. √2 is also a term. Through comparing operators (+, <, or >) we can combine terms to form equations or comparisons. In essence, mathematics is a formal science that deals with objects that can be combined by operations. By this structures are formed. Mathematics is the science of structures. In this interpretation these structures need not to be real. Even more, nothing is said about any relation to reality. How can we then describe reality with the aim of mathematics? Because we always simplify. Our senses and our brain see the world outside and inside us according to inherent rules (emerged during evolution as a representation of external structures through internal ones). These a priori rules identify therefore external structures that can be described by mathematics. In doing science (for instance biology) we seek such structures. And we have to describe them. In most cases we will do this in a technical language. By this we build a model. We construct models in order to deal with complex processes. Models allow us to understand these processes and to infer the variables, the so called drivers, that influence them. Models also allow us to predict future states. This predicting power is important for instance in models of climate change, ecosystem functioning, population growth, or enzymatic activity and genetics, fields were appropriate direct observations or experiments are often impossible. Biology changed from a mainly descriptic science to an explanatory science. To explain things means to be able to model them. A very simple example. Only a few insects have reproductive cycles longer than one year. In a series of cicads however imagines are produced every 7, 13, or even 17 years (in the American cikade Magicicada septendecim). How can we explain such odd numbers? It was found that these species live in very predictable habitats with rather constant amounts of resources. Their main predators are vertebrates, birds or reptiles with reproductive cycles of two, four or six years. Now we make a very simple (and of course simplified) model. We set predator abundances in reproductive years to values being two times as high as in non-reproductive years (Fig. 1.1). The sum of all predator abundances is then the Magicicada septendecim Photo by USA National Arboretum predation pressure on our cidads. This can be modelled by a Models in Biology 7 Predator abundance 6 5 4 3 2 1 0 0 5 10 15 20 25 30 35 40 45 50 55 60 65 T im e Fig. 1.1 simple Ecxel spreadsheet. Now look at the Figure 1.1. Low total predator abundances 1 Generation Predator A Predator B Predator C occur every 3, 5, 7, 9, 11, 13, 17, 19, etc. 2 3 4 5 6 7 8 0 1 2 3 4 5 +A7+1 1 0.5 1 0.5 1 0.5 +B6 1.5 0.75 0.75 1.5 0.75 0.75 +C5 2 1 1 1 2 1 +D4 E Sum of predator densities 4.5 2.25 2.75 3 3.75 2.25 +SUMA(B8:D8) C Predator B =3*LOS() =C2*LOS() =C2*LOS() =3*LOS() =C2*LOS() D Predator C =4*LOS() =D2*LOS() =D2*LOS() =D2*LOS() =4*LOS() E Sum =SUMA(M34:O34) =SUMA(M35:O35) =SUMA(M36:O36) =SUMA(M37:O37) =SUMA(M38:O38) years. Of course, predators do not have stable abundances and cicdads have more A B C D A 1 Generation 2 1 3 =A2+1 4 =A3+1 5 =A4+1 6 =A5+1 than two predators. We have to improve our model. For instance, we could introduce more predators or even variable numbers of B Predator A =2*LOS() =B2*LOS() =2*LOS() =B2*LOS() =2*LOS() predators assigned by the model. We can also assign variable abundances. By this we make our model more realistic but also more complicated. Fig. 1.2 shows an example of such a simulation. Three predator species with 1, 2, and 4 year cycles were assigned abundances generated by the Excel build in random number generator. We see low predator abundances at prime numbers like 7, 13, 17, or 19. These are exactly the cycles found in nature and we simulated (modelled) this pattern. Above we used a simulation and a graphical representation of our model. More often it is necessary to Predator abundance state our models explicitely. We have to use sets of mathematical equations. For instance, a very simple model 3 2 1 0 0 Fig. 1.2 5 10 15 20 25 30 35 Time 40 45 50 55 60 65 8 Models in Biology describes the increase of bacterial populations in a constant environment. ΔN = rN − r N2 K where ΔN is the increase, N the actual population size and r the species specific rate of increase (fecundity). K denotes the upper limit in population size caused by resource limitation. We are interested in the population size at a given (measured) rate of increase ΔN. Hence, we have to solve this equation for N. This should be known from school although providing the general solution might be quite time consuming for mathematically unskilled people. Fortunately, such technical things are today done by specialised mathematics programs. These are able to provide not only numerical solutions but they can also handle symbolic expressions and solve various types of equations, compute derivatives and integrals. They are also able to simplify complex terms. Three important pro- grams are Mathematica, and Maple, Matlab. In statistics Statistica, SAS, Systat, or SPSS are very popular. Recently the R– project also gained popularity particularly among biologists. In this lecture we will mainly use the programs Mathematica and the Excel add ins Matrix and PopTools. Above a Mathematica solution of our quadratic function is shown. In our model we still would be able to solve the equation by hand. However, most biological models are more complex and in these cases math programs like Maple or Mathematica are indispensable even for trained mathematicians. Fortunately, they are now available in all university departments and larger corporations. Hence, the knowledge how to apply them is today an integrate part of any mathematics lecture. Additionally, mathematical education has also to include knowledge how to develop at least simple models using classical spreadsheet programs like Excel. Models in Biology 9 2. Why nature loves logarithms Assume a snail is 10 m apart from its feeding plant and creeps with a constant speed of 0.5 m / hour. Of course, after 1 hour it will be only 9.5 m apart, 12 Intercept Distance 10 8 after 4 hours 8 m and so on. When does the snail Δ x = x2 - x1 reach the plant? Of course, after 20 hours. Surely, (x 1 ;y 1 ) 6 this is a very silly example but it provides us with Δ y = y2 - y1 very important possibilities how to describe and to Slope = Δ y / Δ x 4 visualize such a process. (x2 ;y 2 ) Look at the Figure beside (Fig. 2.1). We use a so- 2 y-axis 0 0 called Cartesian coordinate system with two x-axis 5 10 15 Time Fig. 2.1 rectangular axes, a y- and a x-axis (after the French philosopher and mathematician Rene Des- cartes; 1596-1650). Now we plot the distance on the y-axis and the time on the x axis (a scatter plot) . The result is linear relationship between distance and time. Such a simple linear relationship is called a proportional relationship, in this special case an inverse proportional relationship. Distance is inverse proportional to time. At time 0 we have the initial distance, this point is called the intercept. However, for a mathematical description of the whole process we need another value, the slope. The slope describes how fast the snail will reach the plant. The steeper the slope is, the faster the snail will reach the plant. A convenient definition of the slope is to use the quotient Δy / Δx of two data points (denoted as (x1;y1) and (x2;y2)) because simple geometry tells us that in this case of proportionality this quotient will be constant (why?). So, we can describe the whole process as follows: At time 0 the distance is 10 m. At time 1 the distance is 10 m—0.5*1 m, because the snail creeps 0.5 m / hour. At time 2 the distance is 10 m—0.5*2 m, because the snail creeps 1 m in 2 hours. And so on. In general, we have distance = initial distance – speed * time or in a more mathematical language y = intercept + slope*x y = a + mx (2.1) If m is negative (as in our case) the proportionality is inverse or indirect, for a positive slope y and x are directly proportional. Our slope definition gives us immediately another relationship Slope = y2 − y1 y2 − y = x2 − x1 x2 − x (2.2) If we now want to infer the intercept we have to set x to 0. y gives then the intercept. We get Intercept = y = y 2 − y 2 − y1 x2 − x1 * x2 = y 2 − mx2 (2.3) The latter equation is a convenient way to infer slope and intercept of a linear function from two data points. Of course, our example is a very simple one. But it acquainted us with a very natural and intuitive way to describe the relation between two variables x and y, the time and the distance. Unfortunately, such simple pro- 10 Models in Biology portional relationships are quite uncommon in nature. Much more common are (seemingly) more complicated relationships like the following. The volume of a cube equals the cube’s length taken to the third power: V ∝ L3 (read V is proportional to the third power of L). The volume of an area scales to its diameter by A ∝ L2. For most animals and plants a similar relationship holds but the exponents are lower. For instance, insect body weights scale to body length with W ∝ L2.6. In other words, the body weight is only roughly proportional to the third power of body length; mathematically speaking V ∝ L2.6 (2.4) Such a relationship is shown in the Figure below (Fig. 2.2). Now we can’t define an intercept or a slope of this function. The slope continuously changes and setting L to 0 is impossible. What to do? We have to transform our equation in order to linearize it. Then we can treat it like our linear function before. In Excel axes can be rescaled logarithmically as shown below. Body weight For this task we have to remember what a logarithm is. A logarithm is that number with which we have 12000 to take another number (the base) to the power to get 10000 a third number. Hence, the logarithm of body weight 8000 V to base 10 is that number that fulfils the equation V 6000 = 10x. In general 4000 y = a x → x = loga y 2000 x = aloga ( x) 0 0 5 10 15 (2.5) 20 Now, we have to remember some simple rules for Body length calculations with exponents: a x + y = a x * a y ; ( ab ) x = a x b x ; a 0 = 1 100000 Body weight 10000 Slope = Δ y / Δ x a 1000 Δ y = log(y 2 )-log (y 1 ) 100 1 Fig. 2.2 10 Body length x a =a 1 x a ( x ) ≠ (a x ) y y Intercept 1 1 = x ; a ( xy ) = ( a x ) y ; a but Δ x = log(x2 )-log (x1 ) 10 −x 100 From our definitions we get some simple computation rules x ∗ y = a log a ( x ) ∗ a log a ( y ) = a log a ( x ) + log a ( y ) therefore log( x ∗ y ) = log( x ) + log( y ) (2.6) With the same logic we get log( x / y ) = log( x) − log( y ) and log( x y ) = y log( x) (2.7) Models in Biology 11 We also notice two special cases log(1) = 0 and log a ( a ) = 1 Most often used are logarithms to base 10 (called decimal logarithms), to base 2 (called binary logarithms, log2(x) = lb(x)), and to base e (called natural or Neper logarithms, loge(x) = ln(x)). In particular the latter are of major importance in the natural sciences and have become a standard in the scientific literature. What is e? e is a curious number that once Neper defined from the following sum ex = 1+ x x 2 x3 + + ... = 1! 2! 3! ∞ ∑ i=0 xi i! (2.8) For x = 1 we get e = 1+ ∞ 1 1 1 1 + + ... = ∑ 1! 2! 3! i =0 i ! (2.9) N! (read n factorial) is for natural numbers defined as the product of all numbers i from i = 1 to n. The Greek sign Σ (Sigma) is the mathematical shortage for a sum from i = 1 to n. n n ∑ ln(i ) n ! = ∏ i = e i=1 i =1 (2.10) So, 5! =1*2*3*4*5=120; 0! = 1 and 1! = 1. The Greek sign Π (Pi) is the mathematical shortage for a product from i = 1 to n. The factorial leads very fast to high numbers, for instance 10! = 3628800, but 20! is already 2432902008176640000. For many applications and for analytical computation it is often convenient to use an approximation to the factorial. Such an approximation gives Stirling’s equation that states ε (n) n ! = nn e− n 2nπ e 12n (2.11) In this equation ε is a number between 0 and 1. Note that ε(n) (read epsilon of n) defines a function that depends on n and is not a product. For larger n the last term eε(n)/12n is nearly 1 and we may approximate n! ≈ nne−n 2nπ Stirling’s approximation leads very fast to good approximations. For instance 10! = 3628800 The approximation gives 3598693. The error is therefore only 0.8%. Later we will see that the above definition of e is equivalent to another form to construct e: 3 e y 2.5 ⎛ 1⎞ e = limn→∞ ⎜1 + ⎟ ⎝ n⎠ 2 ⎛ 1⎞ e = lim n→∞ ⎜1 + ⎟ ⎝ n⎠ 1.5 1 0 Fig. 2.3 5 10 n 15 n n (2.12) This definition uses a so-called limes, a boundary to which a function or series goes as some variable 20 goes to some defined value or - as in this case - to 12 Models in Biology infinity. Figure 2.3 shows a plot of equation 2.12. We see that the curve slowly and asymptotically approaches but never reaches e. e is an irrational number, a number like π that cannot be given by a rationale of the form a / b with a and b being rationale numbers. From eq. 2.12 we easily compute e e ≈ 2.71828183…. Often (especially in computer programs) ex is written as exp(x). You must not confuse this with the program notation a e00n (exponent n) that is equivalent to a10n. Sometimes, we have to transform one type of logarithm into another type. This can easily be done from the following scheme: x = a log a ( x ) = blogb ( a )*log a ( x ) = blogb ( x ) hence logb ( x) = logb (a)*log a ( x) (2.13) Example: ln (100) is approximately 4.605. Log10 (100) is therefore log10(e)*4.605 = 0.434*4.605 = 3 1.999 ≈ 2. 2 The next Figure 2.4 shows a plot of y = ln(x) against x. 1 We see that if x reaches 0 y goes to -∞. Mathemati- y 0 -1 0 1 2 3 4 5 6 7 cally speaking limn→0 ln( x) = −∞ -2 -3 For x = 1 y is 0. This is called the root of the func- -4 tion. The root of y = ln(x) is therefore x = 1. The func- -5 x Fig. 2.4 tion has no upper boundary. For x → ∞ goes y = ln(x) → ∞. Above we saw that rescaling a variable results in a power function relationship (Eq. 2.4). There are many other ways to generate such non-linear relationships. Look at the next Figure (Fig. 2.5). The numbers of individuals of species (their abundances) are most often unforeseeable because of the many independent factors acting on the populations. The left part of the Figure shows such abundances per unit of area (the densities) of 100 species, which were adjusted to a range of 0 to 1. We are interested in the fraction of species that had very low densities to estimate how many species are at the risk of going extinct. Let this fraction be p. In the next generation, these species have again random density fluctuations independent of the foregoing generations. Again, a fraction of p species will have low densities. In the next generations this process repeats. Therefore, in the second generation the fraction of species expected to 1 1 0.8 0.8 0.8 0.6 0.4 0.2 D ensity 1 D ensity D ensity have again low densities is p*p, in the third generation this fraction will be p*p*p and so on. The fraction of 0.6 0.4 0.2 p p 0 Fig. 2.5 0 S pecies 0.6 0.4 0.2 0 S pecies S pecies Models in Biology 13 species having low abundances remains therefore constant, but we can’t foresee which species will have low densities. The whole process does not depend on any previous state. Such processes are very common in biology. For instance mutation events, radioactive decay, events of species extinctions, or hormone concentrations can be described by them. In general, the proportion of species having constantly low densities is Si = S0 p i where S0 denotes the initial number of species. Using again natural logarithms and defining a value k = -ln(p) gives Si = S0 e − ki We can linearize the equation by taking the logarithms 10 Si (2.14) Intercept = S0 and get Si = S0e-ki ln( S i ) = ln( S 0 ) − k * i a k=a/b b 1 0 5 The next Figure (Fig. 2.6) shows a plot of Si against i us10 15 20 ing a semi-logarithmic coordinate system. The y-axis has a logarithmic scale. Now the exponential function appears to be a straight line and the intercept at the y-axis gives us 0.1 i Fig. 2.6 the value of S0. The slope of the line equals the factor k. Of major importance is the value of i when Si is exactly S0/2, the so-called half-time value. We get 0.5 S 0 1 = = e − ki S0 2 therefore ln(2) i= k ln(2) ≈ 0.693. A the end, we consider a more complicated example. Assume a tissue which cells are randomly affected by mutations. Every cell genome has an equal chance to mutate. If we wait some time most cells will get more than one mutation. They start to accumulate. Now, we take a spreadsheet program and simulate the process. We compute 10 time intervals each for 1000 of our model cells simply by assigning a random number between 0 and 1 to each time interval. For random numbers above 0.5 a mutation strikes for values below 0.5 not. The Table below shows an example for 5 cells and two time intervals programmed with Excel. Now we plot the number of mutation events for each cell against the number of cells hit by this number. This is shown by the blue data points in the Figure below (Fig. 2.7). The result is quite complicated. Most often were 6 to 7 mutations, seldom 1 or 10 mutations per cell. However, in reality cells differ. They also differ in susceptibility to mutation events. We model this simply by assigning them random numbers that control how often they will be A 1 2 3 4 5 6 7 Cell 1 =+A3+1 =+A4+1 =+A5+1 =+A6+1 B C Time intervals 1 =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) 2 =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) =+JEŻELI(LOS()<0.5;0;1) D E Sum =+SUMA(B3:C3) =+SUMA(B4:C4) =+SUMA(B5:C5) =+SUMA(B6:C6) =+SUMA(B7:C7) Counter =+LICZ.JEŻELI(D3:D7;2) 14 Models in Biology A 1 2 3 4 5 6 7 B C Time intervals Cell 1 =+A3+1 =+A4+1 =+A5+1 =+A6+1 1 =+JEŻELI(LOS()*$D3<0.5;0;1) =+JEŻELI(LOS()*$D4<0.5;0;1) =+JEŻELI(LOS()*$D5<0.5;0;1) =+JEŻELI(LOS()*$D6<0.5;0;1) =+JEŻELI(LOS()*$D7<0.5;0;1) 2 =+JEŻELI(LOS()*$D3<0.5;0;1) =+JEŻELI(LOS()*$D4<0.5;0;1) =+JEŻELI(LOS()*$D5<0.5;0;1) =+JEŻELI(LOS()*$D6<0.5;0;1) =+JEŻELI(LOS()*$D7<0.5;0;1) D Affectability E Sum +los() +los() +los() +los() +los() =+SUMA(B3:C3) =+SUMA(B4:C4) =+SUMA(B5:C5) =+SUMA(B6:C6) =+SUMA(B7:C7) F Counter =+LICZ.JEŻELI(E3:E7;2) affected by a mutation. In essence, we model the process by a multiplication of two random numbers. Again we take 10 time intervals and look how many mutations each of the cells got. Suddenly the picture changed dramatically. Now, cell number and mutation number are related in a much simpler way, a way that can be described by an exponential function of the form y = aebx. Our spreadsheet program gives us automatically the associated parameters a and b, but it is easy to compute them manually by linearizing the equation using logarithms (ln(y) = ln(a) + bx). This is of course a very simple example, but it shows us two important things. We modelled mutation events by assigning random numbers to assumed cells (simply the cells of the spreadsheet) and looked what kind of distribution appears. This modelling ap- Number of cells 600 y = 1.4e0.58x 500 that identical cell properties resulted in a more 400 complicated pattern than different ones. In other 300 words, cell heterogeneity produced a pattern eas- 200 ier to analyse than a seemingly simpler homoge- 100 neous pattern. This is a very often found feature 0 0 Fig. 2.7 proach is called a Monte Carlo process. We saw 2 4 6 8 Number of mutations 10 12 in nature. Heterogeneity, irregularity, or even chaos are not things that only complicate all. Very often, they simplify and lead to more tractable relationships. This feature of heterogeneity makes it worth to study heterogeneity or even chaos in detail and the branch of mathematics dealing with this is the chaos theory. Models in Biology 15 3. Proportionalities In an old German schoolbook I found the following exercise. 4 1/2 hens lay 15 3/4 eggs in 2 1/3 days. How many hens lay 27 2/5 eggs in 3 2/3 days? This is probably a typical every day problem in rural areas. So, how do peasants solve it? 15 3/4 eggs are laid in 2 1/3 days. Hence 15 3/4 / 2 1/3 = 6 / 3/4 eggs per day per 4 1/2 hens, hence 6 3/4 / 4 1/2 = 1 1/2 eggs per hen and day. We need 27 2/5 eggs in 3 2/3 days, this is (27 2/5 / 3 2/3) / 1 1/2 = 5 times the daily rate of a hen. We need 5 hens. However, our solution is quite complicated and case specific. Using an appropriate mathematical formulation solutions of such ‘simple’ proportionalities are much easier. H hens lay E eggs in D days. Hence the daily rate is calculated to E = Eggs per hen and day H *D This must hold for all other values of E, H, and D. Therefore E1 E2 = H 1 * D1 H 2 * D2 (3.1) and 15.75 27.4 27.4* 4.5* 2.333 = →x= =5 4.5* 2.333 x *3.667 15.75*3.667 In general solutions of tasks that deal with proportionalities can be solved by introducing proportionality equations that are constructed by referring to some standard value, in our case eggs per hen and days. Let’s consider more realistic examples. Ideal gases can be described by kinetic gas theory. Robert Boyle (1627 - 1691) first realized that the volume of gases V is inversely proportional to the pressure upon it. We write V∝ 1/P or V P = constant Joseph Gay-Lussac (1778—1850) found that under constant pressure a simple proportionality between volume and temperature T holds V∝ T or V / T = constant. Now we have two simple equations that describe proportionalities. Such equations can be combined by multiplying them. Now we introduce a constant to transform into an ordinary equation V P = const T Because gases are made of molecules or atoms we refer to a standard. We define one mol as the weight of NA = 6.022169 * 1023 chemical units (atoms or molecules). NA is the famous Avogadro constant. We refer to one mol and assume a third proportionality. We assume that the volume needed by an ideal gas is proportional to the number of molecules or atoms it contains, hence to the number of mols. Denoting n for this number of mols we can now define a constant R R= PV nT (3.2) 16 Models in Biology This is Lorenzo Avogadro’s (1776 - 1858) law of ideal gases, a combination of simple proportionalities. R has a value of 8.3143 JK-1mol-1. This has to be read as Joule per Kelvin and mol with one Joule being 1 Pascal*m3. The typical scientific notation for dimensions is the use of exponents In chemistry we often need so-called stoichiometric calculations. For instance, Iron oxide has the general form FexOy. The analysis of such an oxide gave 40.95 g Iron and 15.6 g Oxygen. Determine the values of x and y. We need two things. First, the mol weight of iron (56 g / mol) and Oxygen (16 g / mol). O = 16, and C = 12. Second, we need a relationship that connects measured weights with mol weights. The quotient between the weights measured (having N molecules) should equal the quotient using only one molecule. The latter is provided by the reaction equation. 40.95 x * 56 x 3 = → = 15.6 y *16 y 4 This result can be generalized. Sugars have the general form HXCYOZ. Assume you got a probe that contains a grams hydrogen, b grams carbon, and c grams oxygen. We need again the mol weights (H = 1; C = 12; O = 16). Hence the proportion in the whole probe must be the same than in one molecule. Hence a : b : c = 1x :12 y :16 z a x b 12 y a x = ; = ; = b 12 y c 16 z c 16 z Or even more general a : b : c = xW1 : yW2 : zW3 a xW1 b yW2 a xW1 = ; = ; = b yW2 c zW3 c zW3 (3.3) where W1, W2, and W3 denote the mol weights of each element. Equation 3.3 can of course be used in the opposite direction. How many carbon dioxide originates if we burn 120 g carbon? The chemical equation is C+O2→CO2. Hence 120 12 = → b = 320 b 2*16 We need 120 g carbon and 320 g oxygen to form 440 g CO2. The above equations however are valid only if we need one mol of each reactant to get one mol of the reagent. Consider the next reaction 2KClO3→KCl+3O2 How many Kaliumchlorate do we need to get 637 ml Oxygen? Under normal conditions (273.15º K and 101325 Pa) 1 mol takes 22.4 litre (V = 8,3143 * 273.15 / 101325 m3 = 22.4 l). Hence 637 ml oxygen are equivalent to 0.637 / 22.4 = 0.0284 mol. These are 0.0284*2*16 g. Now we apply equation 3.3. But we have to modify it. The left side gives the weights in the probe. This is the mol weight multiplied with the number of mols. Therefore a (39.102 + 35.453 + 3*16) 2 *(39.102 + 35.453 + 3*16) = → a = 0.01893 0.0284 * 2*16 3* 2*16 We need 0.01893*(39.102+35.453+3*16)g = 2.32g At the end we get a general form of a stoichiometric equation. If we have a chemical reaction of the Models in Biology 17 form n1 A + n2 B → n3C + n4 D where A, B, C, and D are the reactants and n1 to n4 the number of atoms (or molecules or mols) we need , the relation between weights in the probe and mol weights of the reaction are given by n Molweight ( A) n Molweight ( A) weight A (probe) = 1 (probe) = 1 (chemical equation) weight C n2 Molweight (C ) n2 Molweight (C ) (3.4) Identical equations hold for the other combinations of reactants. In the simplest case all reactants are known. For instance Butane reacts with oxygen to form carbon dioxide and water. First establish the reaction equation. The general form of this equation is uC4 H10 + vO2 → xCO2 + yH 2O We need u, v, x, and y. This can be done by applying the simple scheme of the great German mathematician Carl Friedrich Gauß (princeps mathematicorum, 1777 - 1855). 4u = x 10u = 2 y 2v = 2 x + y Now we have three possibilities. We can try to solve this system by hand. I this case this is simple but in other cases this might be quite complicated. We can use the internet for solving. ScienceSoft (www.sciencesoft.at/) provides a nice small internet service for solving stoichiometric equations. We can also apply a math program. A Mathematica solution looks as follows. Now we have to seek for the smallest y giving natural u, v, and x. This is apparently y = 10. u becomes 2, v, 13, and x 8. Therefore 2C4 H10 + 13O2 → 8CO2 + 10H2O But now compare our result with that of the internet service. In our case you count on both sides 26 O, ScienceSoft computes 12 O on the left but 13 O on the right side. This result is obviously erroneous. Don’t trust every result of a seemingly well introduced and nice looking program! Let’s consider a more complicated example. How many carbon dioxide do you need to get 50 g glucose. First, you need the reaction formula. 6CO2 + 6 H 2 O → C 6 H 12 O6 + 6O2 Hence x 6(12 + 2*16) = → x = 73.33 50 6*12 + 12*1 + 6*16 By the same logic we get the amount of water and oxygen 18 Models in Biology y 6(2 *1 + 16) = → y = 30 50 6 *12 + 12 *1 + 6 *16 z 6 * 2 *16 = → z = 53.33 50 6 *12 + 12 *1 + 6 *16 Of course, the amounts of reactants of both side of the chemical equation are the same: 73.33g+30g=50g +53.33g=103.33g. Equation 3.2 is a general description of a stoichiometric reaction between two reactants. It describes the proportionalities with regard to weight. But it can also be used to infer the chemical equations. For instance the oxidation of 20g ironsulfide (FeS2) gave 21.36g SO2 and an unknown ironoxide. We needed 10.28 l oxygen. Determine the chemical formula of this oxide and the reaction equation. First, the reaction equation must have the general form n1 FeS 2 + n2O2 → n3 FexOy + n4 SO2 Second one mol oxygen = 32 g takes under normal conditions 22.4 l. Hence 10.28 l are 0.459 mol. These are 14.685g. Let the weight of Ironoxide be IO. The sum of weights at both sides must be equal. 20 + 14.685 = IO + 21.36. Hence IO = 13.325g. Now we apply equation 3.2 n (55.85 + 2 * 32) n 20 1 = 1 → 1 = n4 (32 + 2 *16) n4 2 21.36 n1 (55.85 + 2 * 32) n 20 = → 1 = 0.0125(55.85 x + 16 y ) 13.325 n3 ( x * 55.85 + y *16) n3 20 n (55.85 + 2 * 32) n = 1 → 1 = 0.364 14.685 n2 (2 *16) n2 n 21.36 39.925 n4 (32 + 2 *16) = → 3 = 13.325 n3 ( x * 55.85 + y *16) n4 (55 .85 x + 16 y ) 21.36 n4 (32 + 2 *16) n = → 2 = 1.375 14.685 n2 (2 *16) n4 n 13.325 n3 ( x * 55.85 + y *16) = → 2 = 0.0344(55.85 x + 16 y ) n2 (2 *16) n3 14.685 We have six equations and seven unknown variables. But we know even more. We apply again the Gauß scheme n1 = n3 x 2n1 = n4 2n2 = n3 y + 2n4 Now we have nine linear equations with six unknown variables. Such a system can be Data given bers solving these relations are n1 = 4, n2 = 11, and n4 = 8. Now it is easy to solve the other Molsgiven Mass in gramms solved. From equation 1, 3 and 5 we infer that n1:n2:n4 =1:2.75:2. The smallest natural num- Data asked Molsasked Mols = ngiven Mass in gramms nasked Mols Volume Volume Use the Avogadro equation to refer to normal conditions and determine Mols Use the Avogadro equation to refer to normal conditions and determine Volume Fig. 3.1 Models in Biology 19 equations for x and y. We get 4 FeS 2 + 11O2 → n3 Fex O y + 8 SO2 We took 22 O and got 16 O in SO2. Hence n3*y = 6. Additionally, n3*x = 4. The smallest three natural numbers fulfilling this equation are n3 = 2, x = 2, and y = 3. At the end we get 4 FeS 2 + 11O2 → 2 Fe2O3 + 8SO2 Fig. 3.1 gives a general scheme how to solve stoichiometric equations. First, you have to refer to mols as the most suitable measure. Then you apply a proportional equation (Equation 3.2) in which n stands for the coefficient. Now we consider another form of a chemical proportion equation. You need 50ml of 70% solution of ethanol in water. You have 90% ethanol. What to do? This is also a problem that is best solved using a systematic approach. You need a series of linear equations containing volumes (or weighs) and concentrations. The first equation contain volumes x (ml water) + y (ml ethanol) = 50 (ml solution) The second equation gives concentrations. The total amount of ethanol remains constant. Hence 0 .9 y (m l e th a n o l) = 0 .7 * 5 0 ( m l s o lu tio n ) This second equation contains 1.0, 0.9, and 0.7. Mathematicians avoid using percents. Instead it is most often easier to use a range from 0 to 1. Hence 1.0 stands for 100%, 0.7 for 70%, and 0.9 for 90%. Both equations can easily be solved y = 0.7*50 / 0.9 = 38.89 ml 90% ethanol. Therefore x = 50 - 38.89 = 11.11 ml water. The same task in a different way. You need 50 ml 70% ethanol solution. You have solutions of 30% and 90%. Again x (m l 30% ) + y (m l 90% ) = 50 (m l 70% ) and now 0.3x (ml 30%) + 0.9 y (ml 90%) = 0.7*50 (ml 70% ) . Hence x = 16.67ml an y = 33.33 ml. Note that standard math programs are able to solve algebraic equations like above. Such a solution looks as follows. Note that in the example before with six equation it was not possible to apply the math program (at least not in a simple way) because we had proportional equations and the simplest solution the program proposes is the trivial solution that all variables n equal zero. An example of a nonlinear proportionality is the Weber-Fechner law of physiology. The perception intensity P of a stimulus is proportional to the logarithm of the physical intensity I of the stimulus P = k ln( I )+c I0 where I0 is most often an arbitrary set baseline and c a constant. (3.5) 20 Models in Biology Hence, signal perception increases with the logarithm of signal intensity. Such a law holds for instance for photoreception, acoustics or olfactorical stimuli. Of major importance is the Weber Fechner law in acoustics. Perceived loudness L follows equation 3.5 and is defined in db (DeziBel) by the following equation L x = 10 log10 p I = 20 log10 x [ dB ] I0 p0 (3.6) -5 p0 is an arbitrarily predefined lower sound pressure level of 2 * 10 Pascal. px is the sound pressure we measured. For instance a sound pressure of 4 * 10-2 Nm-2 is equivalent to L = 20 *log10 ( 2 * 103) = 66 dB. With equation 3.4 we can compare different sound pressures and compute the difference in loudness we perceive. Therefore, if we compare two sources of loudness the difference ΔL is I I I L1 − L2 = ΔL = 10 log10 ( 1 ) − 10 log10 ( 2 ) = 10 log10 ( 1 )[dB ] I0 I0 I2 Hence, a hundredfold increase in intensity causes an increase of 20dB. Signal transmission and regulation In physiology we deal with signal transmission and regulation. Examples are the in- Fig. 3.2 Demanded value duction or inhibition of biochemical processes, Central nervous system regulates thermoregulation, secretion, gene activation, or enzyme regulation. The mathematical theory of regulation (the science of cybernetic) is Receptor (measuring) Nerves Hormones very complex, but is based on some very simple assumptions. Fig. 3.1 shows a simple regu- Effectors (Muscles, secretion,metabolism) latory system. The demand value (fixed) is compared with an actual value (measured by receptors). The is done by the central nervous system. The difference between both values is the output signal to the effectors. If this difference is zero, no further change of the effectors state is needed. Hence, the basic mechanism of regulation is a difference between demand and actual value. These values can be measured and incorporated into a model of the regulatory system under study. A I B I F(I) O Fig. 3.2 shows four basic models of signal transmitting and regulation. We have an input signal I F1(I) XI C F1(I) O F2(I) I XI XI + XF2 F1(I) XO XI + X2 O two handling operations F1 and F2 that are in line. O is now proportional to both functions. Hence XF2 XF1 that is handled by a function F to give the output signal O. Mathematically O ∝ F((I). In B we have XF1 I XI D F2(I) O ∝ F1((I) F2((I). M XO O In C we have again two function that operate in parallel. The input signal XI goes to F1 and F2. O is XF2 Fig. 3.3 F2(I) XF1 – XO Xr the output of the sum of F1 and F2. Hence Models in Biology 21 O ∝ F1((I) + F2((I). Xr 0.12 0.1 In D the output signal is regulated. XF1 is measured by M. 0.08 M gives a signal of value O - XF1 to F2 that produces the 0.06 output signal XF2. This adds to XI. Hence if XF1 is too 0.04 small XF2 acts to enhance it, if it is too large, XF2 dampens 0.02 it. Mathematically: After regulation XF1 should equal XO 0 0 20 40 60 80 Time Fig. 3.4 100 XO = F1(XI + XF2) - Xr XF2 = F2(XF1 - X0). We solve these equations for XO and get XO = F1 F F − xr XI + 1 2 1 + F1 F2 1 + F1 F2 At perfect regulation xr becomes zero and the last term is a constant. Hence XO = F1 XI +c 1 + F1 F2 (3.7) This is the signal equation of a simple self regulatory system. We can now plot Xr against time (the number of cycles) after an initial disturbance of ΔI. This is shown in Figure 3.4. After an initial peak Xr slowly returns to zero that mean XF1 again equals XO. How much information is transmitted by the output signal? To answer this question we have to define what we mean by information. The whole output signal O contains two elements O=H +R (3.8) where H is called the entropy of a system, the amount of information it contains. R denotes the redundancy, the amount of noise the output contains. Now suppose a digital signal transmission. The maximum value of H is the number of interpretable (0,1) switches. The maximum information content is then defined as the binary logarithm (logarithm to base 2) of the number of switches n. H max = lb(n) (3.9) To define the meaning of information Claude Shannon (the American founder of information theory, 1903-1969) referred in 1949 to the concept of chemical entropy S as derived by the German chemist Ludwig Boltzmann (1844 - 1906). Assume a state of two atoms (or signs) take a certain state with probability p1 and p2. The probability that both atoms have this state S(p1p2) is then p1*p2 (this is the multiplication law of probabilities we will deal with in the second part of this lecture). Now assume that entropy (a function of probability) is an additive concept. The total amount of entropy is the sum of all entropies of the atoms. Hence S(p) = S(p1) + S(p2) and S(p1p2) = S(p1) * S(p2) Both equations only have a solution if entropy is a logarithmic function of probability. S(p) = a * log (p1p2) = a log(p1) + a log (p2) = S(p1) + S(p2). 22 Models in Biology Boltzmann used this concept, referred to natural logarithms and defined the entropy by a fundamental equation S = k ln( p ) (3.10) The entropy is proportional to the natural logarithm of the probability of its occurrence. k is the Boltzmann constant and equals R / Na. p is a measure of the probability of occurrence. The lower this probability the more unstructured is the system. The Austrian chemist Erwin Schrödinger (1887 - 1961) defined the inverse of p (D = 1 /p) as a measure of uncertainty or irregularity and got S = k ln( p) = k ln(1/ D) = −k ln( D) Shannon, dealing with digital signal transmission now referred to binary logarithms and defined the information content of a signal as H i = −lb( pi ) (3.11) Where pi denotes the frequency of occurrence (its probability) of a signal i. H is measured in bits (binary information units needed to define a signal). The information content of this particle with respect to others is Hi multiplied with its relative frequency. However, this is nothing more than its probability to occur, hence pi. If we deal with a whole system of n atoms (elements) we get the mean information content of a signal. This is the sum of all entropies. n H = − ∑ pi lb ( pi ) i =1 (3.12) This is the most often used definition of information. H is generally used as a measure of diversity in its broadest sense. It treats information solely under a concept of probability of occurrence. It does not refer to any content. Hence it does not discriminate between information that has sense and information without any sense. If we have two signals we can measure information from the divergence of signal A from signal B. If signal B is a theoretical expectation, the information content of signal A is given by the divergence of A from B. This measure of information is known as the Kullback-Leibler information and finds much application n biological modelling. It is defined as n H = −∑p(Ai )ln i =1 p(Ai ) p(Bi ) (3.13) The maximum information content is reached if all signals have equal probability of occurrence. Hence H = -n * p * lb(p) = n * 1 / n * lb(1 /n) = lb(n). From this we get an additional measure how even the information content is distributed among the signals E= H lb(n) This measure is called evenness. (3.13) Models in Biology 23 4. Some basic functions and their application in biology What is a function? This fourth lecture deals with several important functions; functions that are often used in many branches of biology. First of all, what is a function? A function is a mathematical term that combines two or more variables in one or more equations. Normally, a function contains one so-called dependent variable y and a set of independent variables xi. Typical functions with only two variables are denoted by y = f(x). Examples are y = ax + b y = ln( x ) + b n y = a0 + a1 x + a2 x 2 + a3 x 3 ... = ∑ ai x i i =0 In the latter example we used a summation sign to shorten the function, the large Greek Sigma = Σ. The first of these examples is of course a linear and the second a logarithmic relationship. Especially important is the last example. This is the general form of a so-called algebraic function. This is a function with only one independent variable x that is set to powers from 0 to n. The constants ai are most often real numbers. A special feature of a true function is that the set of independent variables xi determine the value of y in such a way, that for any set of values xi there is one and only one value y. The above three cases fulfil this prerequisite. However, there are examples where for one x-value several y-values exist. For instance, if we want to describe a circle (Fig. 4.1) we have to use the following equation x2 + y 2 = r 2 that follows immediately from the law of Pythagoras. Fig. 4.1 shows us that now every value of x gives two values of y. These are y1 = + r 2 − x 2 and y 2 = − r 2 − x 2 In this case we speak of relations. Fig. 2.2 shows a plot of the algebraic function y = 5x −0.8x2 +1 in the boundary –5<x<10. We detect two important points where y = 0, the so-called roots or zeroes of the function. Computing them is easy. We use the binomial relationship 20 y 10 r a α −α b Fig. 4.1 0 r γ b a -10 y b x -5 -10 0 5 -20 -30 r -40 a2 + b2 = r2 -50 Fig. 4.2 x 10 15 24 Models in Biology (a+b)2 = a2 + 2ab + b2 −0.8x2 + 5x +1 = 0 ↓ 2 x2 − 2 5 ⎛1 5 ⎞ ⎛1 5 ⎞ 1 x +⎜ ⎟ =⎜ ⎟ + 0.8 ⎝ 2 0.8 ⎠ ⎝ 2 0.8 ⎠ 0.8 ↓ 2 2 2 5⎞ ⎛ 5⎞ 1 5 ⎛ ⎛ 5⎞ 1 → x=± ⎜ ⎟ + + ⎜x− ⎟ =⎜ ⎟ + ⎝ 1.6 ⎠ ⎝ 1.6 ⎠ 0.8 ⎝ 1.6 ⎠ 0.8 1.6 x1 ≈ 6.44; x2 ≈ −0.19 Below the solution of a math program is shown. In general, algebraic functions have analytical solutions only up to the fourth order (that means up to the fourth power), although these are quite complicated. For functions of higher order most often only approximate solutions exist. Functions are characterized by ranges over which the function is defined. This range (or domain) is an ordered set of the y and x-variables that defines where the function is valid. Often, functions have boundaries. Consider the logarithmic function y = ln(x). This function is not defined for values of x less than or equal 0. In this case we denote 25 y = ln( x ); for x > 0 20 values are bounded. Look at the function y = 1/ 15 2 y = x -x + 1 2 y = (x - 2) -(x - 2) + 1 y More important are cases where the yx+b. If x goes to infinity 1/x goes to 0 and y to 10 b. Mathematically speaking, y asymptotically 5 reaches b. But y will never be equal to b. Be- 0 -4 low we will discuss this point in more detail. Important are shifts of functions along -3 -2 -1 0 1 2 3 4 x Fig. 4.3 the x– and y-axes. Fig. 4.3 shows the function y = x2 - x + 1. Using x – 2 instead of x shifts the whole function two units to the right without changing the shape of the function. This is an important feature. In general the transformation y = f ( x) → y − y0 = f ( x − x0 ) shifts a function x0 units to the right and y0 units up. Fig. 4.4 The exponential function Look at Fig. 4.4. A industrial plant produces C0/2 some sort of air pollution. If we assume a C0/2 C1/2 day without wind this pollution has its highest concentration near the plant. The farer C1/2 C2/2 C2/2 away we are the lower the concentration Models in Biology 25 will be. We can model this process by a simple assumption. We assume that the particles have at every distance an equal chance to be drifted either to the left or to the right sight as shown in the Figure. The concentration after an imaginary first step is 1/2C0, with C0 being the initial concentration at the chimney. This process is identical at every step. Hence at step two the concentration is 1/2(1/2C0). A step x we get x ⎛1⎞ C x = C 0 ⎜ ⎟ = C 0 e − ln( 2) x = C 0 e −0.693 x ⎝2⎠ This is the first biologically important function we consider, the exponential function. It has the general form y = ae kx where a and k are constants. One of the most important processes of this type is the radioactive decay. Assume a fraction of p atoms decaying in a certain time range t1. 1-p atoms remain. This process is absolutely independent of the initial number of atoms and the time already spent for decaying. Therefore, the fraction of atoms Nx that decayed after x time windows is N x = N 0 p x = N 0 e ln( p ) x = N 0 e ax Because p was the fraction that decayed it is a value between 0 and 1. The logarithm of p is therefore negative. We can now define a value k = -a = -ln(p) and get the general relationship N x = N 0 e − kx (4.1) We heard already in the previous lecture that this exponential function is a general description of the number of entities having a certain property in a multiplicative process. It refers to such different processes like radioactive decay, species extinction, substrate concentrations, or diffusion. Nx has a lower boundary of 0. In mathematical language we denote N →0. The number of entities not having this property is of course N ¬ x = N 0 (1 − e − kx ) (4.2) In our case, this would be the number of atoms that did not decay. Of especial importance is again the value of x where Nx is exactly N0 / 2, the half time. We saw already that this value is N1/2 = ln(2)/k. The logarithmic function species occupies a fraction of p of this area. The of the remaining area and so on. This is again a process that can be described by an exponential function (why?) and the abundance of the i-th species is N i = N 0 e − ai Rel. abundance second abundant species takes again a fraction of p 1 ln (Area) S = ln(A) / a +S0 0.1 15 0.01 10 0.001 log-series or geometric series 0.0001 (4.3) 20 Fig. 4.5 5 0 Rank order of species Number of species Let’s assume a community of plant species that live together in a certain area A. The most abundant 26 Models in Biology In this function N0 is the total abundance (the total number of individuals) of all species combined. Rear- ranging this equation gives ⎛ N ln ⎜ ⎝ N i 0 ⎞ ⎟ = −ai ⎠ The term Ni / N0 is called the relative abundance of a species i. If we plot the relative abundances on a logarithmic scale against the species number i we get therefore a straight line as shown in Figure 4.5. Such a relationship is called a geometric series. More than 60 years ago the Japanese ecologist I. Motomura proposed it for the first time to describe relative abundances of animals. Now we might be interested in the question how many species we would find in a certain part Ai of the total area A in which our community lives. If the least abundant species has a density of 0.01 per unit area, we would expect one individual and therefore also this species to be found at 100 units of area. For a density of 0.0001 we already need an area of 10000 units of area. In general, the area needed to find a species is the reciprocal of its density. It follows therefore − ln( Ai ) = − ai + ln( A0 ) and 1 1 i = ln( Ai ) + ln( A0 ) a a This is a general form of a logarithmic function y = a ln(x) + b. We find the constant b if we set Ai to one, in other words we consider the number of species i at one unit of area. This number is ln(A0) / a and is frequently denoted as S0. A plot of i against ln (A) should give a straight line with the slope 1/a. Setting i = S we have S= 1 ln( A) + S0 a (4.4) We got an important relationship. If the relative abundances of the species in a community follow a geometric series (or the very similar log-series) the associated species – area relationship should follow a logarithmic function. This type of species—area relationship was once proposed by the American botanist Henry Gleason (1882 - 1975) and is of major importance in plant ecology as a tool for estimating species numbers at the local scale. Logarithmic functions are of course only defined for values of x above 0. The power function Surely the most important function in biol- 100000 ogy is the power function. In morphology these 10000 following Figure 4.6. Given are mean body weights of some mammal species and their respective brain weights. A plot of brain weight against Brain weight [g] are often called allometric functions. Look at the 0.75 1000 line where the data points scatter around an as- Man 100 10 x0=0.0625 body weight on a double log scale (both the x- and the y-axis are log transformed) results in a straight y = 8x 0.001 1 0.1 y0=8 slope = -y0 / x0 = -ln(8)/ln(0.0625)=0.75 10 0.1 Fig. 4.6 Body weight [kg] 1000 100000 Models in Biology 27 sumed so-called regression line, a curve that is chosen in such a way that the data points are nearest to this curve. Only Man is outstanding with its high brain weight. Our spreadsheet programs automatically compute such curves from predefined functions and give these functions. In the statistics lecture we will see how to compute such functions and what has to be considered when using them. We might therefore describe the dependence of brain weight on body weight in mammals by the following function ln y = a ln( x) + ln(b) or y = bx a (4.5) This is the general form of a power or allometric function. a is the slope of the function, often termed the scaling factor. b gives the y-value at x = 1. ln(b) is therefore the intercept on a double log scale. For a = 1 we get y = bx and this form of a linear dependence (simple proportionality) appears to be a special form of a power function (where the function goes through the origin). However, we immediately notice an important difference between a linear dependence and a power function. The latter is defined only for values x above 0. The next Figure 4.7 shows a power function with a 3 y negative slope. These special types of power func- -0.5 2.5 y = 2x +0.5 2 tions are often called hyperbola. We notice that 1.5 this function has a noticeable curvature only at small values of x. It seems that for x ≈ 20 some- 1 0.44 0.5 0.28 0 0 10 Fig. 4.7 20 x 30 40 50 thing like a threshold appears. For x values larger than about 20 the y-values are very small in relation to the initial ones. The absolute difference between y50 and y20 is only 0.16, whereas the dif- ference between y20 and y1 is 2.06. Above x ≈ 20 the curve appears to be nearly straight. If, for instance, this would be a plot of reproduction rate (the total number of offspring of a species ) against body weight (a relation that is well described by a power function) we would conclude, that for larger animals the above relationship is of little value. At higher body weights total offspring number is roughly constant and relatively small. Such a pattern is quite often found in nature. We speak of a heavy tail or a heavy tail pattern. Power functions are of major importance in biology and we have to know about some important features. One important feature is that the slope of a power function is independent of the way we measured x and y. For instance in our example above, we measured body weight in kg and brain weight in g. What is if we change into grams? We get B[ g ] = aW z [ kg ] → B[ g ] = a (1000W ) z [ g ] = a (1000 z )W z [ g ] = kW z [ g ] where k contains the constants and is the new intercept. In other words, the intercept of a power function contains the units of measurements, but the exponential term is independent of how we measured our data. Additionally, constant a and slope z should be independent. But be careful, this relationship is only valid if we deal with an infinite universe. But most often, we have data from experiments or observations. In these cases, the data points have a limited range of allowed values. Now a and z are not longer independent and it depends on the data structure how they are related. 28 Models in Biology Above, we heard about relative abundance or species—rank order distributions. We dealt with a log- series as an important example for this. What is if the species rank order can be described by a power function? ⎛N ⎞ N i = N 0i − a → ln ⎜ i ⎟ = − a ln(i ) ⎝ N0 ⎠ Again, the area needed to find a species is the reciprocal of its abundance. It follows therefore ln(i ) = − 1 ⎛ A0 ⎞ − 1/ a 1/ a ln ⎜ ⎟ → i = A0 Ai a ⎝ Ai ⎠ In this case we get an allometric species—area relationship that is generally written as S = S0 A z (4.6) This is the most often found type of species—area relationship and frequently serves as a general starting point for ecological modelling. It is easy to combine allometric functions to reach in new dependencies. Consider the next example. 60 years ago Max Kleiber found that metabolic rates of animals scale to body weight to the power of 0.75 . M ∝ W 0.75 We use this form to describe a power function because the intercept is for us of minor importance. Body weight scales to body length to the power of about 2.6 (see equation 2.4 above) to 3. The latter value 3 is of course the theoretical (geometric) expectation. Therefore W ∝ L 2 .6 to 3 .0 and M ∝ L0 .7 5* ( 2 .5 to 3 .0 ) ∝ L1 .8 7 5 to 2 .2 5 Additionally, body weight and mean abundance of species are connected by a power function with a negative slope (D ∝ W-z). We now simply multiply both scaling laws and get MD ∝ W 0.75W − z ∝ W 0.75 − z ∝ L2 − z (4.7) In 4.7 I rounded 1.875 to 2.25 to a value of 2. Now, we don’t deal with an individual species but with all individuals of a species, the population. The product MD is the total metabolic rate of all species of the community considered. For mammals, the British ecologist J. Damuth found that z takes values between 0.5 and about 1 with a mean close to 0.75. Hence he got MD = B ∝ W 0.75−0.75 = const (4.8) We conclude that total metabolism (often approxi- 2.5 2 of all organisms in a population of a given species) is 1.5 roughly constant for species with different body weight. 1 We obtained this result by a simple combination of two 0.5 independent scaling laws. This is known as the equal bio- 0 mass or energy equivalence rule, firstly formulated in y=2/x y mated by population biomass, the sum of all body weights 0 Fig. 4.8 10 20 x 30 40 50 Models in Biology 29 1981 by Damuth. However, if z differs from 0.75, total population biomass, and therefore population energy turnover, is a function of mean individual (species) body weight. For arthropods, for instance, z-values > 1 have been reported. That means that smaller organisms would have a much higher total metabolic rate (energy turnover) than larger ones. The hyperbolic function Consider a power function with a slope of –1. That means y = ax −1 or xy = a = constant (4.9) This is a function that is shown in Fig. 4.8. It is called a hyperbola. For instance, reproductive output (the number of offspring) scales to body weight at R ∝ W-x. But at the same time reproductive costs (the energy needed to produce offspring) scales to body weight at C ∝ Wz. The product of costs and reproductive output should therefore be CR ∝ W z − x If we now compare different species of animals of the same mean body weight we expect that CR = const For species of similar body weight the relation between C and R should therefore be a hyperbola. We notice that a hyperbola is symmetrical to both axes and has no intercepts. Sometimes the smallest distance from the origin is of interest. From the symmetry condition follows that this smallest distance is exactly dmin = √(2a). The inverse hyperbola More important than the true hyperbola is the inverse hyperbola. Well known is this function in the form of the so-called Michaelis – Menten equation. Consider an enzyme E that binds to a substrate S: E + S ↔ ES. Now consider that moment where this process reaches a stationary or equilibrium state. Let E0 be the initial enzyme concentration. Then, the speed to produce ES V1 will equal the decay rate of ES V0 through dissociation. V1 is approximately proportional to Vmax The latter is (E0 –ES). This gives the following equation V0 the substrate concentration and to the concentration of E. k1S ( E0 − ES ) = k2 ES Vmax / 2 Now we solve this equation for ES and get ES = k1E0 S k2 + k1S Fig. 4.9 K S The speed of the enzymatic reaction is highest at the initial enzyme concentration E0: Vmax ∝ E0. Additionally we divide the above equation through k1 and subsume the constants k1 ad k2 in one constant K. We get 30 Models in Biology Vmax S K +S (4.10) This is the Michaelis-Menten equation that describes the kinetics of an enzyme. If we plot V0 against the substrate concentration S a hyperbola appears as shown in Fig. 4.9. This hyperbola is limited. Asymptotically, it approaches (but never reaches) a maximum value. This maximum is of y V0 = 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 n=1 n=2 n=3 n=4 0 Fig. 4.10 0.2 0.4 0.6 0.8 1 p(O2) course Vmax. In other words limV0S →∞ = Vmax Another interesting value to describe the whole process is K. Assume a rreaction speed V0 that is half of Vmax. We get Vmax Vmax S = → K + S = 2S → K = S 2 K +S K is exactly that concentration of S where V0 = Vmax / 2. The Michaelis-Menten equation is one very important example for a whole class of functions (the Monod functions) described by the equation y= af (x) b+ f (x) (4.11) They all have their limes at a. The equation may also be linearized. We take the inverse of both variables x and y and get 1 b 1 1 = + y a f (x) a A plot of 1/y against 1/f(x) is therefore a straight line with slope b/a and intercept 1/a. This method is called the Lineweaver - Burk transformation. An extension of the hyperbola model has other applications. For instance haemoglobin and myoglobin bind oxygen according to the partial pressure of O2. According to the law of masses there exists an equilibrium between, for instance, the concentrations of myoglobin (M) and oxygen (O) on one side and the MbO complex on the other side K= [ MbO] [ Mb][O] Denoting y for [MbO], p(O2) for the partial pressure of oxygen and using [MbO] + [Mb] = const we get K= K p(O2 ) y →y= const + K p(O2 ) (const − y ) p(O2 ) Myoglobin is monomer. For di-, tri, or tetramer Molecules we have to modify the latter equation and get the so-called Hill equation of oxygen binding Models in Biology K= 31 y K p(O2 ) n → y = (const − y ) p (O2 ) n const + K p(O2 ) n that describes the concentration of the MbO complex in dependence of oxygen partial pressure. Fig. 4.10 shows plots of this equation for various n. For n =1 the Hill equation is equivalent to the Michaelis - Menten model of enzyme kinetics. Indeed both processes are functionally similar because they describe the binding of a substrate to a protein. For n > 1 the plots approach a sigmoidal shape. The Hill equation can be seen as an extension of the Michaelis - Menten model. 32 Models in Biology 5. Handling a changing world One of the most often met mathematical problems in biology is to measure changes for instance in time or in nutrient concentration or in blood pressure or or…. 100 Consider a car that drives with a constant speed of 50 km / hour. We may formalize this by writing point f(t) reached after time t+Δ t is the distance after 0 y -50 -100 y2 time t plus the way driven during the time interval Δ t. -150 The latter is the product of speed v and Δ t. We can rear- -200 range the above equation and get tangent y1 f(t+ Δ t)=f(t)+vΔ t In other words, the distance from the starting y=-(x+5)2+50 50 -15 Fig. 5.1 -10 x1 -5 0 5 x2 10 15 x f (t + Δt ) − f (t ) =v Δt The term at the left side of the equation describes the change of a function that depends on a variable t when t also changes at a small amount Δ t. What is f(t)? It is of course a way. Because speed is defined as way per time interval (v = distance / time) we can introduce this into our above equation and get v(t + Δt ) − vt Δd = = v = const Δt Δt Note that in the latter equation the term v(t+Δ t) is a product, but in the function above f(t+Δ t) a function. The brackets enclose therefore once a term to be multiplied (for simplicity the multiplication sign was left out) and once denotes a list of variables of a function. The latter equation may be generalized. If we have any function y = f(x) we can look at the difference between two y-values y2 – y1 depending on the respective difference of the independent variable x2 - x1. This is graphically shown in the first Figure (Fig. 5.1). We may describe the change of a function f(x) by the quotient Δ y / Δ x. This is the slope of the straight line through the two data points (x1,y1) and (x2,y2). y2 − y1 Δy f (x1 +Δx) − f (x1) = = Δx x2 − x1 Δx (5.1) Often, changes of our function depend on the actual value of the function. Consider the population growth of a bacterium and assume that the bacterium divides at a constant rate r of very 20 min. In this case the total number of bacteria at time t+Δ t depends directly on the total number at time t. N(t+Δ t) = rN(t). The change in time is proportional to N: N(t +Δt) − N(t) = rN(t) Δt To compute the population size of a bacterium at time t+Δ t we are therefore interested in the tangent at point N(t). We can compute this if we take x1 as t and x2 as a value that is only very very very slightly larger Models in Biology 33 than x1. Our Δ t should therefore be very small. In effect it should be nearly 0. It can’t be equal to zero because a division through 0 is not defined but we may assume that Δ t goes to 0. We define lim Δ t→0 Δ t = 0. Now we can define a derivative of a function (that is the slope of the tangent through the point (x,y) ) and therefore the change of the function at point (x,y) as follows lim Δx → 0 f ( x + Δx ) − f ( x ) Δ y dy = lim Δx → 0 = ( x + Δx ) − x Δx dx (5.2) The latter quotient is often also written as dy df ( x) = = f '( x ) = y dx dx (5.3) If dy/dx (the slope of the function) is positive, the function increases, if dy/dx is negative the function decreases. For dy/dx = 0 at point a no change occurs at a. Now look at the next Figure 5.2. It shows a modi- 2 fied Dirac function. This is a simple function with two 1.5 x + Δx › 0.5 y not difference whether I come from the right side and -10 have a positive Δ x or whether I come from the left side -5 0 -0.5 0 5 10 -1 (with a negative Δ x) . But in the case of the Dirac function the direction matters. Below x = -1 the function has at x ‹ x + Δx 1 thresholds. For computing the derivative it should make -1.5 -2 Fig. 5.2 x every point the derivative 0 (the slope of the function is 0). The same holds for values above 1. But between –1 and +1 the slope has a constant value of 1, the derivative of the function y = x is exactly 1. So at the points –1 and +1 we would be able to compute two derivatives with values 0 and 1. This makes no sense and we modify our above definition in such a way that we exclude that points where none or more than 1 derivative values would be possible. These are points were our function is not continuous. Look back to the tangent function. This function has an discontinuity at α = 90° = π/2. At these points the derivative of the tangent would not be defined. We are now able to compute some simple derivatives. Consider the function y = f(x) + g(x). The functions f(x) and g(x) are two functions that depend on x. We want to compute the derivative dy/dx. dy f ( x + Δx) − f ( x) + g ( x + Δx) − g ( x) = lim Δx →0 dx Δx f ( x + Δx) − f ( x) g ( x + Δx ) − g ( x ) = lim Δx →0 + lim Δx →0 Δx Δx Therefore d [ f ( x) + g ( x)] dy df ( x) dg ( x) = = + dx dx dx dx (5.4) This is the summation rule for derivatives. In other words, the derivative of a sum is the sum of both derivatives if both depend on the same variable. Consider next a product y=f(x)*g(x). We get 34 Models in Biology dy f ( x + Δx ) ∗ g ( x + Δx) − f ( x) ∗ g ( x) = lim Δ x → 0 dx Δx Now, denote f(x) as u and g(x) as v. That gives dy (u + Δu )(v + Δv ) − uv uv + vΔu + u Δ v + Δ u Δ v − uv = lim Δx → 0 = lim Δx → 0 dx Δx Δx Δu Δv Δu Δv = lim Δx → 0 v + lim Δx → 0 u + lim Δx → 0 Δx Δx Δx lim Δ x→0 Δ u/Δ x is du/dx, the derivative of u and for the function v holds the same. Additionally, it can be proven (and is intuitively obvious) that the last summand Δ u Δ v/Δ x goes against 0. From this we get dy du dv =v +u dx dx dx (5.5) Or, if we go back to our first notation y = f ( x) g ( x) dy dg ( x) df ( x) = f ( x) + g ( x) dx dx dx → (5.6) This is a simple rule (called product rule of differentiation) that tells us how to compute the derivative of a product. If we have a quotient of two functions y = f(x) / g(x) we get with the same logic the quotient rule of differentiation f ( x) y= g ( x) dy = dx → g ( x) df ( x ) dg ( x ) − f ( x) dx dx g 2 ( x) (5.7) If we set in 5.7 f(x) = 1 we get d 1 −1 dg ( x ) g ( x) = 2 dx g ( x ) dx (5.8) We have also to consider the case were two functions are nested. This is a function of the type y = f[g (x)]. To get the derivative we denote g(x) = u. Then we have dy/du and du/dx. For simplicity we multiply the right side of the derivative with du and get y = f [ g ( x )] → dy dy du = ∗ dx du dx dy df (u ) dg ( x ) = ∗ dx du dx (5.9) In other words, the derivative of a nested function is the product of the derivates of all included functions. This is the chain rule of differentiation. At last, we have to consider the inverse of a function. A function y = f(x) has the inverse x = g(y). We can simply denote Models in Biology 35 dy df ( x ) = = dx dx 12 y=x y 10 8 Δy=Δx 6 Δy/Δx=1 4 Δy Δx (5.10) and see that the derivative of an inverse function is the inverse derivative of 2 the original function. 0 0 Fig. 5.3 2 4 6 x 8 10 12 Now we have six simple rules to compute derivatives. With these rules it is possible to get derivatives from all functions that allow these derivatives at 12 y 1 1 1 = = dx dg ( y ) dx df ( x ) dy dy least at some points to be computed. Derivatives are again functions and we 10 y=3 8 Δy=0 may derivate them too. Then we get derivatives of higher orders denoted as 6 Δy/Δx=0 f’’, f’’’ or f 2(x) / dx, f3(x) / dx and so on. 4 2 Now we are ready to compute derivatives. Two simple cases can immedi- 0 0 Fig. 5.4 2 4 6 x 8 10 12 ately be inferred from the respective plots. The function y = mx is linear and has a constant slope m (Fig. 5.3). dy / dx = m. For y = x holds that dy / dx = 1. Fig. 5.4 instead shows that the derivative of a constant is zero. A constant has no change on the y-axis. Let’s consider other important examples. We know already the number e, Euler’s number, as the base of the natural logarithm. e has the value 2.718282… Why is e so important and why has this number such a complicated value? Because of a very nice feature. e is chosen in that way that de x = ex dx (5.11) x In other words the function e gives in every point for that this function is defined its own derivative (Fig. 5.5). This makes many things very easy. With this definition we can compute other derivatives too. What is dln(x) / dx? Our rules about inverse functions tell us that dy/dx = 1/(dx/dy). Therefore d ln( x ) 1 1 1 = = y = y dx x de e dy 60 50 Our rule gave us immediately the derivative of a logarithm (Fig. 5.6). 40 y (5.12) We also get y = ax dy/dx=ex 30 20 dy d (e = dx dx ) Δx 0 = b b ax = abx ( b −1) x 0 (5.13) 2 4 6 x Fig. 5.5 and 2 dy d ( e ln a + x ln b ) = = a b x ln b dx dx y=ln(x) 1.5 x y y = ab Δy 10 b ln a + b ln x (5.14) Additionally, eq. 5.12 provides us with another important rule for differentiation. y=ex dy/dx=1/x 1 0.5 0 0 Fig. 5.6 2 4 x 6 36 Models in Biology Suppose we need y’ = d[u(x)v(x)] / dx. The chain rule tells us that d ln( y ) 1 dy 1 dy 1 du 1 dv dy 1 du 1 dv = → = + → = uv( + ) dx y dx y dx u dx v dx dx u dx v dx Of course today differentiation is often done by math programs. There are also some internet pages that offer calculus. The next Figure shows some simple examples of functions that would surly take some time to be evaluated by hand. With Mathematica it takes a few seconds. Differential calculus runs into difficulties if we want to differentiate a function that is not defined or is zero or becomes infinite at a certain point . Consider the important function y= e x − e− x x This function is not defined for x = 0. We would get 0 / 0 and we would be able to compute two derivative values depending on the side from which we come. But the Figure 5.7 (a plot of the function) indicates that the function should have a lower boundary at this point. We are frequently interested in such boundaries. From the plot we expect a value of 2. Can we compute the boundary of the function at this point? For such tasks the rule of Guillaume de l’Hospital (a French mathematician who wrote the first textbook on calculus, 1661-1704) helps. It states that if two tions f(x) and g (x) vanish at a certain point a the following equation 2.4 holds: 2.3 limx→a 2.2 2.1 y f (x) f '(x) = limx→a g(x) g '(x) 2 (5.14) 1.9 To show this we need f(a) = g(a) = 0 -1.5 Therefore lim x →a y = [exp(x)-exp(-x)] / x; x ≠ 0 1.8 Fig.5.7 -1 -0.5 0 x 0.5 1 1.5 f (a + h) − f (a) f (x) f (a + h) f (a + h) − f (a) f '(a) h = lim h →0 = lim h →0 = lim h →0 = g(a + h) − f (a) g(x) g(a + h) g(a + h) − f (a) g '(a) h For the above example we get lim x→0 f '( x) e x + e− x 1 + 1 = lim x→0 = =2 g '( x) 1 1 The rule of de l’Hospital gives the expected value of the function at x = 0. Of course, math programs are also able to compute limits. Another example of this important rule. What is 1⎞ ⎛ lim x → ∞ ⎜ 1 + ⎟ x⎠ ⎝ x Models in Biology 37 This is not a quotient necessary to apply the rule of de l‘ Hospital. So, we have to transform the function into an appropriate form. We take 1 x lim x →∞ x ln (1+ ) 1⎞ ⎛ x A = lim x → ∞ ⎜ 1 + ⎟ → A = e x⎠ ⎝ Now, we have to transform the exponent in that way that it matches the requirements of the above rule. Functions that go to infinity have to be transformed by taking 1 / f(x). We transform ⎛ 1⎞ ln ⎜1 + ⎟ ln(1 + y) x⎠ ⎛ 1⎞ = lim y→0 ln( A) = limx→∞ x ln ⎜1 + ⎟ = limx→∞ ⎝ ; for y = 1/x 1 y ⎝ x⎠ x We differentiate and get lim y→0 f '( y) 1/1 = lim y→0 =1 g '( y) 1 Therefore 1 lim x→∞ xln (1+ ) 1⎞ 1⎞ ⎛ ⎛ x = e1 = e = lim x →∞ ⎜ 1 + ⎟ A = lim x →∞ ⎜ 1 + ⎟ → A = e x⎠ x⎠ ⎝ ⎝ x x (5.16) This is another remarkable feature of the number e. Now consider y=(en-1)/n. We apply the rule of de l’Hospital and get lim n → 0 en − 1 e0 = lim n → 0 =1 n 1 (5.17) We get the next important limit again using the de l’Hospital rule. lim n →0 ln(1 + n) 1/(1 + 1) = lim n →0 =1 n 1 (5.18) The above examples all dealt with explicit functions, functions that could be written in the explicit form y = f(x). Unfortunately, this is quite often not possible and we have to use functions in an implicit form where it is not possible to solve for y. For instance the function x 2 + y 2 = ln( x + y ) cannot be solved for y. Is it possible do compute the derivative dy / dx? It is and we have to use the chain rule to reach in an implicit differentiation. We take d dx ( ) x 2 + y 2 − ln( x + y) = The chain rule gives us dy dy dx − dx = 0 2 x+ y x + y2 4x + 4 y and from this we compute d (0) =0 dx 38 Models in Biology 4 x( x + y ) + 4 y ( x + y ) dy dy 2 − x + y2 = 0 dx dx and dy = dx 4 x( x + y ) x + y 2 − 4 y( x + y) 2 This was of course a quite complicated example but it trained us a little bit how to use the chain rule. Let’s try an easy example. Consider the implicit function xy = 1? We get d dy dx d (1) dy − y ( xy ) = x + y = =0 → = dx dx dx dx dx x In this case we can check our result. y = 1 / x and we infer dy / dx = -1 / x2. The quotient rule gives the same result. Now we have to deal with minima and maxima and points of inflection. Fig. 5.8 shows a simple algebraic function. We need the points y = f(x) where a local y y = a + b(x-c)2 + d(x-c)3 -6 -4 5 4 3 2 1 occurs. Hence by setting the first derivative of a function to zero we can compute local maxima and minima. 2 4 6 y -4 y -4 mum? Fig. 5.10 shows that a maximum occurs if the mum the second derivative has to be larger than zero. This is intuitively logical because the derivative gives the 4 slope of a function at all points x. If this slope is zero, the 3 derivative should also be 0. Setting the derivative to zero 2 is therefore a convenient method to obtain minimum and 1 maximum values of a function. On the other hand, we 0 saw that if we already deal with a derivative, that means -2 -1 0 2 4 x d2y/dx = 2b+ 6d(x-c) How to differentiate between a maximum and a minisecond derivative is negative. For a point to be a mini- 5 Fig.5.9 Fig.5.10 zero. This is clear because at these two points no change x d1y/dx = 2b(x-c)+ 3d(x-c)2 -6 shows that at these points the first derivative is exactly 0 -2 -1 0 -2 Fig.5.8 -6 maximum and minimum occurs. Fig. 5.9 immediately 6 with a function that describes changes of a variable we have to set the function to zero to obtain that points were no further changes occur. We call them stationary 5 4 3 points. These are often points of equilibrium. From Figs. 5.8. to 5.10 we got a method to determine 2 1 0 -2 -1 0 -2 x maxima and minima of functions. Compute the first and second derivative (if they exist) and look where the first derivative is zero and whether the second derivative is at 2 4 6 this point below or above 0. Of course, this is not a mathematical proof in a strict sense. It is more a sketch Models in Biology 39 of a proof where each step has to be worked out in detail. 4 However, our aim is not to make strict mathematics, our 3 aim is only to understand basic relations and for this task B 2.5 y simplified ‘proofs’ are much better suited. A 3.5 C 2 D 1.5 Now look at Fig. 5.11. We consider the function E 1 0.5 y = sin( x)(1 + cos( x)) + 2 0 The plot reveals a local maximum at point A and a local 0 minimum at point E. The function decreases at B. Hence more slowly. Hence y’(C) > y’(B). In total y’(A) > y’(B) derivative y’ becomes maximal. This is the point where the function changes its direction. At these points the function decreases or increases maximal. For biological dy / dx 2 1.5 Therefore between A and C must be a point where the 4 6 4 6 x 2.5 y’(B) < y’(A) = 0. At C however y still decreases but < y’(C). At D the function again decreases more than at C. 2 Fig. 5.11 1 0.5 0 -0.5 0 2 -1 -1.5 Fig 5.12 X1 X2 X3 X4 X5 x processes these points for instance might denote changes in temporal patterns. We find these points by studying the first and second derivative. At inflection points the first derivative has a local maximum or minimum, the second derivative becomes therefore zero. (Fig. 5.12). In our case we get y ' = cos( x)(1 + cos( x)) − sin 2 ( x) and y '' = −4 cos( x) sin( x) − sin( x) This function is zero at cos(x) = -1/4. By setting y’’ = 0 Mathematica finds the first four solutions and solves arc cos (-1/4) numerically. Other points of inflections would be at n π + arccos(-1/4). Fig. 5.12 shows local maxima and minima of y’ at these points. Fig. 5.13 A simple, but well known example, α how to solve the minimum problem in biology (I took this example from Portenier, Gromes, Mathematik für Biologen und Humanbiologen, Mar- h burg 2003). Bee combs have a hexagonal shape. Is this shape optimal? We can reformulate this problem by asking at what shape honey combs take the s least amount of wax. Hence the prob- 40 Models in Biology lem is to find a hexagonal comb shape of which the surface is minimal. Because of the symmetrical shape, the surface can be described by one angle α (Fig. 5.13). The surface of a comb is given by S (α ) = 6hs + 3s 2 2 3 − cos(α ) sin(α ) Hence, to find the maximum, the first derivate has to be zero. We apply a math program and solve for α ( instead of α we use x). First, we compute the derivative of the last term. Then we solve for x. At last, we compute the numerical solution. This is 0.955. These are radians, the standard output of math programs. Hence 0.955 / 2 π = α / 360º; α = 54.7º. This is the angle at which the amount of wax would be minimal. Indeed, real bee caves have an angle that is very similar to this solution. Models in Biology 41 6. Summing up Up to now we looked at functions that could be written in precise equations. However, this is often not possible. We have instead to deal with a series of single equations that together model a whole process. Look at the following simplified example i (Fig. 6.1). Assume in a certain habitat occur S0 species of animals in one year t0. At time t1 a number of species immigrated from the so-called general regional species pool P and some species emigrated or went locally e Si p = i-e extinct. Assume further the annual local species turnover p (the proportion of new species) is the sum of emigration and immigration rates and is proportional to the mean number of annual species. The latter is of course S0. P Fig. 6.1 S immigration ∝ S i = iS 0 S emigration ∝ S i = − eS 0 Now we are interested in the total number of different species in our habitat. If we have S0 species at time 0 the number of species after a certain time step (for instance one generation) is S1 = S 0 + iS 0 Note that we only need the immigration rate I because only immigrations provide new species. Additionally, p depends on the regional species pool. If S0 would be large in relation to P the number of new species able to immigrate would be small. This can be modeled by a multiplicative term iS 0 ∝ P − Si P From these assumptions we can model the cumulative number of species S1 (= S0 + the new species) by the following equation S1 = S 0 + iS 0 P − S0 P For the next generation we get S 2 = S1 + iS 0 P − S1 P For time n we have therefore S n = S n −1 + iS 0 P − S n −1 P This is a so-called recursive equation because the outcome for step n depends on the outcome for step n-1 and it is not immediately possible to reduce this process so that the outcome at step n can be derived only from the initial settings. Such processes are very common in biology and we have to look a little bit closer to them. Our process is a so-called first order recursive process because in the term of the right side of the equation occurs only Sn-1. If also Sn-2 would occur we would speak of a second order recursive process and so on. Additionally, there are situations where recursive equations are nested. In these cases the elements E(n-k) are itself functions of previous elements E(n-m) (m>k). 42 Models in Biology Our recursive process is difficult to solve, but if the local species numbers Si would be small in relation to the regional species pool the quotient (P-Si)/P would be nearly 1 and the last equation would reduce to S n ≈ S n − 1 + iS 0 ≈ S n − 2 + iS 0 + iS 0 .... ≈ S 0 + n iS 0 ≈ S 0 (1 + n i ) Unfortunately, most often recursive processes do not allow a reduction to be made and we have to solve them numerically. This is not difficult with modern spreadsheet programs. The Table beside shows, for instance, a solution of the above process using an Excel spreadsheet. 1 2 3 4 5 6 7 8 (6.1) A B C D E Equlilibrium species number S0 100 Regional species pool 1000 Immigration rate i 0.1 Time 0 =+D1 =+B4+1 =+D4+$D$3*$D$1*($D$2-D4)/$D$2 =+B5+1 =+D5+$D$3*$D$1*($D$2-D5)/$D$2 =+B6+1 =+D6+$D$3*$D$1*($D$2-D6)/$D$2 =+B7+1 =+D7+$D$3*$D$1*($D$2-D7)/$D$2 Next we look at mathematical series. Consider, for instance the following, so-called geometric series n N = a + ax + ax 2 + ax 3 + ax 4 ...∑ ax i i =1 (6.2) Is it possible to infer the sum? We multiply both sides with x and get n n i =0 i=0 xN = x ∑ ax i = ( ax + ax 2 + ...ax n ) + ax n +1 = ∑ ax i − a + ax n +1 = N − a + ax n +1 Fortunately, our series reduces to an equation that can easily be solved n N = ∑ ax i = i=0 a − ax n +1 1− x (6.3) Of course, our function is not defined for x = 1. If x < -1 or x > 1 the above series goes to infinity if n goes to infinity. But what is if –1 < x < 1? If n goes to infinity, the term xn becomes smaller and smaller. Therefore the summands become also smaller and smaller as n raises. Is there a limit? Look n N = limn→∞ ∑ axi = i =1 ( a 1 − xn+1 1− x ) If n goes to infinity the term xn+1 goes to 0 and (1-xn+1) goes to 1. Therefore N= a 1− x (6.4) We see that our infinite series has a finite sum. Mathematica gives the same result. Many such series have finite sums and sometimes it is important to determine whether there is such a sum or not. There are many criteria for this which involve the partial sums of the series We denote Sn = n ∑ i =1 ai with ai being the elements of the series. Our aim is now to look whether all elements Sn are below a certain Models in Biology 43 value a. This is equivalent with the convergence of the whole series. Otherwise the series diverges. The most important rule is the following: If a series contains only positive summands a the series converges to a finite sum if there is a positive number q < 1 for what all quotients Sn+1 / Sn < q. This is the co-called rule of d’Alembert (a French mathematician, 1717-1783). For instance the quotient Sn+1 / Sn of the series 1+1/2+1/3+1/4... lim n→∞ ∑ 1/(n + 1) → 1 ∑ 1/ n goes for large n to 1. Hence the series does not converge, it diverges. The next important criterion is that of Cauchy. A series a is convergent if for all n and i, j > n an ε exists for which S j − Si < ε (6.5) Applied again to the harmonic series gives 2n 1 n 1 2n 1 1 1 S2n − Sn = ∑ − ∑ = ∑ > n > 2n 2 i =1 i i =1 i i = n +1 i Because this holds for all n the harmonic series diverges. However the series 1+1/4+1/9+1/16… converges 2n S2n − Sn = ∑ i =1 n 2n 1 1 1 1 1 − = >n 2 < ∑ ∑ 2 2 2 i n n i =1 i i = n +1 i Another criterion of Cauchy is the following. If lim n → ∞ a n 1 n <1 (6.6) the respective series converges. Again, we test this rule with an example. We take the series ∞ n2 ⎛ n −1 ⎞ ∑⎜⎝ n ⎟⎠ i =1 Therefore, we determine whether n ⎛ n −1 ⎞ limn→∞ ⎜ ⎟ <1 ⎝ n ⎠ We get n n n ⎛ n −1 ⎞ ⎛ n ⎞ ⎛ 1 ⎞ 1 limn→∞ ⎜ ⎟ = limn→∞ ⎜ ⎟ = limn→∞ ⎜ ⎟ = <1 ⎝ n ⎠ ⎝ n +1⎠ ⎝ 1+1/ n ⎠ e Therefore, our series converges A last criterion is that of Leibniz. A series of elements with alternating signs converges if the absolute values steadily converge to zero. For instance 1-x+x2-x3… gives lim n → ∞ x n = 0; 0 < x < 1 The series converges for 0 < x < 1. Our criteria don’t tell us the sum of our series. It is often very difficult to find the sum of an infinite N 44 Models in Biology 3.5 series. In these cases we have to approximate the sum by a computer 3 2.5 simulation. Sometimes it is of interest how fast a series converges. For instance, 2 in statistics this problem is closely related to the problem how many 1.5 1 probes we have to take or experiments to make (in general how large 0.5 the sample size has to be). This is a problem of the so-called power 0 0 10 Relative error Fig. 6.2 20 n 30 analysis with which we will deal in the statistics lecture. Look at Fig. 6.2. It shows the elements of y = 1 / (1.5)n and the sum of the 0.5 elements. Our above equation 6.3 predicts for this series a sum of 1 / 0.4 (1-2/3) = 3. We see that our series very quickly converges to this 0.3 limit. It goes asymptotically to 3. Such asymptotes are very often 0.2 found in nature. Fig. 6.3 shows the relative error we make when we 0.1 deal only with a limited number of summands as an approximation of the real value. This relative error is the following quotient 0 0 10 Fig. 6.3 20 n 30 Error = real value − approximation real alue = 1− approximation real value (6.7) In our example we need only 12 summands for our relative error to fall below 1%. But even if we would take only 8 summands, our relative error would already be below 5%. We say that the series converges fast. Another example. One of the most often used series in statistics (but also otherwise) is the Newton series (a + b)n. For n = 2 it is easy to solve (a + b)(a + b) = a2 + 2ab + b2 Let’s add another factor (a + b)(a + b)(a + b) = (a2 + 2ab + b2)(a + b) = a3 + 3a2b + 3ab2 + b3 If we try out a large number of n we will find a nice regularity. We see that the exponents of b continuously rise from 0 to n, that of a continuously decrease from n to 0. The constants follow a regularity called the Pascal triangle (after the French mathematician and philosopher Blaise Pascal, 1623-1662, although this triangle already appeared in a Chinese textbook from about 1100 b. c.) that is shown in Fig. 6.4. The elements of each row are the sums of the elements above. In the statistics lec1 1 1 1 1 1 5 N 1 6 2 3 4 1 3 6 10 15 1 10 20 5 15 ture we will see that we also can compute these constants from the number of combinations of elements. In general the 1 4 9 8 7 6 5 4 3 2 1 0 above function is the sum of the series 1 6 1 n (a + b)n = ∑ i=0 (1 + 0.1)20 n! a i b n −i i !( n − i )! (6.8) n! is again the product of all i from i = 1 to n. This is the socalled binomial function and later we will deal with it in detail. How fast this series converges against (a + b)n depends of course on the values of a, b and n. For a special case where a = 1 and x is well below 1 the series converges very fast and we 0 Fig. 6.5 Fig.4.4 1 10 n 20 30 can reduce it to the first elements. The Figure above (Fig. 6.5) Models in Biology 45 shows that in the case of x = 0.1 the first four elements are sufficient for the relative error to become less than 1%. The last examples tried to develop a given function into a series of functions of which it is the sum. N f ( x ) = f1 ( x ) + f 2 ( x ) + f 3 ( x )...∑ f n ( x ) n =0 At first sight this seems not to be a clever and easy method to handle functions. But in reality it is of great importance. Often, it is impossible to deal with complicated functions, for instance, to obtain their roots or to integrate them. In such cases we may try to approximate the function by a series. We deal with two important general methods that allow a large number of functions to be developed into series. Firstly, we assume that we deal only with such functions that can be developed into an algebraic function of the form ∞ f ( x) = a0 + a1 x + a2 x 2 + a3 x 3 ... = ∑ ai x i i =0 (6.9) This is a very general form of an algebraic function. Our task is now to determine the constants ai. This algebraic function and therefore f(x) is also assumed to have derivatives of all orders at point 0. For x = 0 follows of course that f(0) = a0, the first constant. Consider now the first derivative of f(x) = f1(x). This is f 1 ( x ) = 0 + a1 + 2 a 2 x + 3 a 3 x 2 ... + ia i x i −1 ... = ∞ ∑ iai x i −1 i=0 Now, we consider only the point x=0. This results immediately in a1 = f1(0). a2 is of course f2(0) / 2, a3 = f3(0) / (3*2), a4 = f4(0) / (4*3*2), and an = fn(0) / n!. We now introduce these values of an into the original algebraic function and get f ( x ) = f (0) + ∞ f 1 (0) f 2 (0) 2 f 3 (0) 3 f i (0) i x+ x + x ... = ∑ x 1! 2! 3! i! i =0 (6.10) 0 Note that in this latter series 0! occurs. By definition is 0! = 1. f (0) = f(0). Now, we know a first very important way to develop any appropriate function (a function for which the above assumptions hold) into an infinite series. This series is called Mac Laurin series. Let’s look what this series gives for certain important functions. Consider our already well known function y = ex. Remember that d(ex) / dx = ex. e x = e0 + e0 e0 2 x 2 x3 + ... = x+ x .... = 1 + x + 1! 2! 2! 3! ∞ ∑ i=0 xi i! (6.11) For x = 1 we get e = e0 + e0 e0 1 1 .... = 1 + 1 + ... = + + 1! 2! 2! 3! ∞ ∑ i=0 1 i! (6.12) We can generalize our result for other values of x. This is done by a so-called Taylor series (after the British mathematician Brook Taylor, 1685-1731;although others like Leibniz and Newton used similar series prior). Assume that we generalize the way our function may be developed into an algebraic function 46 Models in Biology ∞ f ( x ) = a0 + a1 ( x − b ) + a2 ( x − b ) 2 + a3 ( x − b ) 3 ... = ∑ a i ( x − b )i i =0 Now, we apply the same logic as above and use fn(x-b). We do this by setting x = b and get immediately f ( x ) = f (b ) + ∞ f 1 (b ) f 2 (b ) f 3 (b ) f i (b ) ( x − b) + ( x − b)2 + ( x − b ) 3 ... = ∑ (x − b ) i 1! 2! 3! ! i i =0 (6.13) n Let’s look at two examples how to use Taylor and Mac Laurin series. What about y = (a + x) , the Newtonian or binomial equation? We take a Mac Laurin series and get ( a + x ) n = f (0) + f 1 (0) f 2 (0) 2 n ( a ) n −1 x n ( n − 1)( a ) n − 2 x 2 + ... = x+ x ... = a n + 1! 2! 1! 2! n ⎛n⎞ ∑ ⎜ i ⎟a i=0 n −i ⎝ ⎠ xi The above function uses an important shortage that is defined in the following way ⎛n⎞ n! ⎜ ⎟= ⎝ i ⎠ i !(n − i )! (6.14) Our Mac Laurin expansion gives us an elegant (sketch of a ) prove of the binomial function. One special case of this is very interesting. Consider y = (1 + x)-1. The above equation gives immediately ∞ 1 = 1 − x + x2 − x3 + x4 .... = ∑ (−1)i xi (1 + x) i =0 (6.15) An interesting special case occurs when a and x are both 1/2. Then we get n n n n ⎛ ⎞⎛ 1 ⎞ ⎛1 1⎞ ⎜ + ⎟ = ∑⎜ i ⎟ ⎜ ⎟ = 1 ⎝ 2 2 ⎠ i=0 ⎝ ⎠ ⎝ 2 ⎠ For x and a = 1 we get (1 + 1) n ⎛n⎞ n = ∑ ⎜ ⎟ (1) = 2n i =0 ⎝ i ⎠ n Taylor series have an immense importance in calculus because they are the basis for many approximations of complicated terms. At the end we come back to recursive processes. We had already first order recursive processes. An important class of second order recursive functions are Fibonacci series (after Leonardo de Pisa known as Fibonacci, 1175? - 1240?, his Liber Abaci introduced the Indic decimal system and the Arabian numbers in Europe). A Fibonacci order has the following general structure f ( x) = f ( x − 1) + f ( x − 2) Applied to natural numbers this gives 1=1+0 2=1+1 3=2+1 5=3+2 (6.16) Models in Biology 47 8=5+3 Fig. 6.7 13=8+5 … 13 Eq. 6.16 can be rewritten in differential notation. For a sufficiently small ε we get f (x) − f (x − ε) df (x) = = f (x − 2ε) ≈ f (x) x − (x − ε) dx Fig. 6.6, Photo by US Agricultural plant database 8 2 1 3 5 This is a so-called differential equation (parts 9 and 10). The rate of change is proportional to its own value. Be- x x cause f(e ) = e we get a solution f(x) = ceax = c(ea )x = cλx Introducing into 6.16 we have for x = 2 λ 2 = λ + 1 → λ1,2 = 1± 5 2 Hence for large x the ratio f(x)/f(x-1) converges to Fig. 6.8, Photo by T. Baril f (x + 1) cλ x +1 1+ 5 = =λ= x f (x) cλ 2 The ratio is well known as the golden mean or golden number. There are some nice examples of (approximate) Fibonacci orders in nature. Best known is surely the geometric ordering of leafs on many plant stalks or the rosette ordering of crown leafs in flowers stands (Fig. 6.6). The reason for this is that the leafs are arranged in such a way to get a maximum amount of light. This is shown in the Figure 6.7. The side length of areas arranged as a spiral follow the Fibonacci series. Hence ammonites and nautilus following logarithmic spirals also follow Fibonacci series as shown in Fig. 6.8 for a nautilus. There are many other optimization problems in nature that can be described by generalized Fibonacci orders. A nice collection of them contains R. Knotts Fibonacci site at http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/ fibnat.html. 48 Models in Biology 6. 1 The Newton approximation Often it is not possible to solve a function b0 for its roots: f(x) = 0. The task can be solved numerically by the Newton approximation. Assume we have an initial guess about x0 = a0. At a0 f(x) has the new root a1 and from f(a1) we get a new b1. y has a value of b0. The derivative of f(x) at x = b0 b1 b2 After four steps the example of Fig. 6.1.1 gives an intercept of the x-axis very close to the root of f(x). a1 a0 a2 f(a1) = 0. We get x Fig.6.1.1 f (a1 ) − f (a 0 ) f (a 0 ) = f '(a 0 ) → a1 = a 0 − a1 − a 0 f '(a 0 ) The same holds for all other points and we get the general Newton approximation a n = a n −1 − f (a n −1 ) f '(a n −1 ) (6.1.1) -2x For instance find the root of y = e 2 - x . We have f '(e −2x − x 2 ) = −2e −2x − 2x With a0 = 0.1 and b0 = 0.81 we get the following sequence a1 = 0.54, b1 = 0.05, a2 = 0.5673, b2 = -0.00025, and a3 = 0.5671, b3 = 0. We needed only three steps to obtain a nearly perfect result. The Newton approximation heavily depends 2 on the starting point. For instance we have to solve 1.5 -x the equation xe = -1 (Fig. 6.1.2). We use two 1 starting points, a0 = 0.5 and a0 =1.5. Hence a n −1e − a n−1 + 1 e − a n−1 − a n −1e − a n−1 For a0 = 0.5 we get the series a1 = -3.80, a5 = 0.5 0 y a n = a n −1 − -5 -0.5 0 -1.07, a10 = -0.567, For a0 = 1.5 we get the series a1 -1 = 13.50, a2 = 56435, a3 = n.d. The crucial point is -1.5 that a starting point above 1 is behind the local -2 maximum at x = 1. Therefore for the Newton method to succeed we need starting points within the region defined by the nearest local maximum or minimum (if these occur). 5 x 10 Fig.6.1.2 Models in Biology 49 7. The sums of infinities We know already how to differentiate functions. Every mathematical operation has its counter operation to reverse it. The counter operation of addition is subtraction, of multiplication is division of derivation is what? We don’t know. The simplest way to change this is to define such an operation. We define the antiderivative or the indefinite integral of a derivative f(x) as F ( x ) = ∫ f ( x ) dx (7.1) It is the operation that reverses the derivation. From this definition we get immediately some indefinite integrals ∫ dx = x + c x n +1 +c n +1 e ax ax ∫ e dx = a + c n ∫ x dx = (7.2) Especially is true ∫ af ( x)dx = a ∫ f ( x)dx ∫ f ( x) + g ( x)dx = ∫ f ( x)dx + ∫ g ( x)dx (7.3) To proof these equations you simply have to derivate them. But what is c in the above three equations? c is a constant, the so-called integration constant. We have to add this constant because derivating the right sides of the equations gives always the left side irrespective of the value of c. The integration gives therefore not an unequivocal result. Derivating a function was a simple task. The integration is not so simple. There is not a fixed set of rules with which you can integrate all functions and you need a lot of experience and skill to find the solution of many problems. Fortunately, today mathematical computer programs like Maple, Mathematica or Maxima help us, but sometimes they also capitulate. Later, we come back to these programs. One very important rule is the integration by parts. This rule follows from the product rule of differentiation d (uv) dv du = u( x) + v( x) dx dx dx Integrating both side gives ∫ d (uv) dx = ∫ u ( x) dv + ∫ v( x) du dx u ( x)v( x) = ∫ u ( x) dv + ∫ v( x) du This is most often written in the following way 50 Models in Biology ∫ udv = uv − ∫ vdu (7.4) What does it mean? If we can’t solve an integral but can transform it into a product (even by multiplication with 1) we can try to integrate the second multiplicand of the product. We will exemplify this rule with a simple example. We want to integrate y = ln(x). For this task we define two new functions u = ln(x) and v = x. Therefore y = u and dv = dx. We also get du / dx = 1/x or du = (1/x)dx. Now we have all to solve the integral. 1 ∫ ln( x)dx = ∫ udv = uv − ∫ vdu = x ln( x) − ∫ x x dx = x ln( x) − x + c (7.5) Don’t forget the integration constant. Beside the Mathematica solution of this problem is shown. Note that math programs use natural logs as the default, hence Log[x] = ln(x). Additionally, they don't give the integration constant. Don’t forget it! A second simple example. We want to evaluate y = x ex. In this case we have to choose u = x. This gives du = dx. We assume also v = ex. This results in dv = exdx. Now we get ∫ xe x dx = ∫ udv = xe x − ∫ e x dx = xe x − e x + c (7.6) Let’s turn to another problem. Look at the next Figure (Fig. 7.1). It shows the change in population size of a typical bacterium. The change in size is proportional to the number of bacteria present. If we have 10000 bacteria they can produce, say, 10000 new bacteria, if we have 1000000 they will produce 1000000 new. Therefore Nt+1 = rNt. The population raises proportional to the present population size. We can model the process by a difference or by a differential equation of the form ΔN(t) = rN(t) Δt dN(t) = rN(t) dt b? To compute the total number of bacteria Ntotal we first have to solve the so-called differential equation dN(t) = rN(t) dt 5 dN(t) / dt What is the total number of bacteria after time 6 derivative of rt = r. We get 2 1 0 2 4 6 N(t) 160 140 120 100 80 60 40 20 0 a 0 Fig. 7.2 8 10 12 10 12 N Fig. 7.1 N(t) and integrate We know already that d[ln(x)] / dx = 1 / x. The 3 0 We multiply both sides with dt, divide through 1 ∫ N dN = ∫ rdt 4 2 4 b 6 t 8 Models in Biology 51 ln( N ) + c1 = rt + c2 y = f(x) N = Ce rt b Area = ∑ f (t )Δt C contains both integrating constants. What is C? If we y t =a a Δt b set t to zero we get N0 = C. That leads to N = N 0 e rt 1 23 4 t Fig. 7.3 Figure 7.2 shows a plot of Nt against t from t0 = a (our starting point) to time b. Now we ask about the total number of bacteria that appeared during the time interval from a to b. At time t0 the number of bacteria was N0 = f(t0) = c, after some time interval Δt this number is obviously N 1 = f ( t 0 ) + f ( t1 ) = f ( t 0 ) + f ( t 0 + Δ t ) After two time intervals the number will be N 2 = f (t0 ) + f (t1 ) + f (t2 ) = f (t0 ) + f (t0 + Δt ) + f (t0 + 2Δt ) If we divide the whole time interval from a to b into n time intervals Δt we see that the total number of bacteria will be n N total = ∑ f (i ) Δ t i =1 This is shown in the next Figure 7.3. We compute the sum of all small rectangles f(i)Δt. Now we consider very small time differences Δt and use limΔt→0. The Fig. 7.3 shows graphically that the area under the function is the sum of all products f(t)Δt. At this stage we remember our indefinite integral. It was F (t ) = ∫ f (t ) dt In other words dF F (t + Δ t ) − F (t ) d ∫ f (t )dt = lim Δ t → 0 = = f (t ) Δt dt dt (7.7) or F (t + Δ t ) − F (t ) ≈ f (t ) Δ t (7.8) We introduce this into our above equation and get n −1 n −1 n −1 i =1 i =1 i =1 N total = ∑ [ F (i + Δi ) − F (i )] = ∑ F (i + Δi ) − ∑ F (i ) Now look again at the Figure 7.3. We denote the time intervals with 1, 2, 3, 4, … and evaluate the last equation N total = F (2) − F (1) + F (3) − F (2) + F (4) − F (3)... + ..F ( n) − F ( n − 1) = F ( n ) − F (1) We are able to reduce the whole sum to only two summands, the first and the last. Now we can rewrite our result and reach in 52 Models in Biology N total = F (b ) − F ( a ) = ∫ f (b ) dt − ∫ f ( a ) dt (7.9) This is a remarkable result. It tells us that the area under the curve between x = a and x = b is the difference of the integral F(b) – F(a). This is often written in the form b ∫ f (t ) dt = F (t ) a = F (b ) − F ( a ) b a (7.10) 1.2 and called the definite integral from a to b. The 0.6 values dx. In fact, historically it stems from an elongated 0.4 S for denoting a sum. Ntotal is of course equivalent to the 0.2 -4 Fig. 7.4 b t=a a 2 y = ax n e − b ( x ) a = 2, b = 1, n = 3 0 area under the curve from a to b. We can write b Area = lim Δt → 0 ∑ f (t ) Δ t = ∫ f (t ) dt -3 y = ax e n -2 Ntotal = ∫ N0 ert dt = a 2 3 4 1 (7.11) 0.8 y 0.6 0.4 0.2 0 ( N0 rt N e = 0 erb − era r r a -4 ) -2 0 2 4 2 4 x Fig. 7.5 1 (7.12) 0.5 This is the total number of bacteria produced be- 0 y tween time a and time b. -4 -2 0 Integrating functions is often a difficult task. How- -0.5 ever, most commonly used integrals are tabulated and today very powerful computer programs like Mathe- -1 1.2 grals for us. But this makes things not necessarily easier. 1 0.8 Very often, complicated integrals do not have exact solu- 0.6 y We have to interpret the results these programs give us. e−t π 2 0.2 often met approximation is the so-called error function. 0 -4 -3 -2 -1 − g ( x)2 y y = f (x)e 0 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 y= -4 Fig. 7.8 1 2 3 4 t Fig. 7.7 grate functions of the following general type (Fig. 7.4) Let’s consider a simple example. The following 2 y= 0.4 tions and the programs give approximations. One very The error function frequently occurs when we try to inte- x Fig. 7.6 matica, Maple or Maxima are available that solve inte- function has to be evaluated 1 1.2 the boundaries from a to b. Therefore b 0 t of bacteria is the integral of the accumulation function in b -1 −b ( x2 ) a = 2, b = 1, n = 4 Now we can solve our initial answer. The number 2 0.8 y integral sign is in effect a summation sign over very small y = e−t 1 -3 -2 -1 0 t 1 1 −(t2 /2) e 2π 2 3 4 Models in Biology 53 1.2 y = ∫ ax n e − bx dx 2 1 0.8 with different values of a, b, and n. Mathematica gives us the following output. y Beside (Figs. 7.5 and 7.6) are shown two plots 0.6 +∞ 0.4 Y= 0.2 −∞ 0 a π x Erf [ b ]L og(e) 2 bL og(e) n ∫ -4 -2 Fig. 7.9 0 1 −(t 2 / 2) e dt 2π 2 4 t What does this mean? First of all, we can simplify the result by using natural logarithms. Log (e) becomes 1. Next we detect a general solution and the error function. Separating them gives a π xn F ( x) = Erf [ b] 2 b What if Erf (b1/2)? The error function is defined for all x by 2 E rf ( x ) = π x ∫e −t2 dt 0 (7.13) It is the solution of the so-called Gaussian integral with which we later deal in detail. This integral has the general form (Fig. 7.7) y= 2 π e−t 2 (7.14) and plays a very important role in statistics. It is often given in a slightly different form (Fig. 7.8) y= 1 −(t2 /2) e 2π (7.15) It has to be solved numerically or again by an approximation. Figures 7.4, 7.7, and 7.8 show the Gaussian function in three different ways. This function has some important properties. The maximum of the function has the value 1 (or 1 / (2π)0.5 or 2 / π0.5 dependent of the form you choose) at point t = 0. Two other important points are the points of inflection. There, the slope of the function has its maximum or minimum. These points are at t = ±1 (or t = ±√(1/2)). How to compute them? To compute the points of inflection we need the second derivative. This has to be zero. The second derivative of the Gaussian function is ⎛ 2 −t2 y '' = ⎜ e ⎝ π ⎞ ⎛ − 4t − t 2 e ⎟ '' = ⎜ ⎠ ⎝ π 2 − 4 − t 2 8t 2 − t 2 ⎞ −t2 ⎛ t − 1 ⎞ = + = ' e e 4 e ⎜ ⎟ ⎟ π π ⎠ ⎝ π ⎠ This function is zero at t = -1 and t = 1 as shown in the Figures 7.4 and 7.7 . However, we are more interested in the integral of this function because this is the error function we needed. The next Figure 7.9 shows this function in its most often used form. It shows that the value of Y goes asymptotically to 1. In other words the whole area under the Gauss curve is exactly 1. +∞ Y= ∫ −∞ x 1 − ( t 2 / 2) 1 − ( t 2 / 2) e dt = 2 lim x →∞ ∫ e dt = 1 2π 2π 0 (7.16) 54 Models in Biology Additionally holds ∞ Y = ∫ e−t dt = 2 0 π 2 (7.17) A next example. Acoustics relies on harmonic oscillations. These can be described by trigonometric func- sin α tions. We want to compute the integral of y = sin(x) from 1.5 1 0 to 2π. This is the area under the curve as shown beside (Fig. 7.10). Mathematica gives us a simple answer. 0 -0.5 0 2 4 - 6 -1 2π A= + 0.5 ∫ sin( x ) dx = 0 0 -1.5 π Fig. 7.10 2π α What does this mean? Obviously there is an area under the curve. But one time this area is above the x-axis and one time below. Because the function is symmetrically, the sum of both parts is zero. This leads us to an important thing. It is important how we reached a certain data point. If we reach it in a anti clockwise manner we get a positive area and this is the so-called mathematical positive sense. A clockwise manner leads to a mathematical negative sense. Therefore, we have to be carefully when relying on numerical computations when the function considered changes its direction (mathematically has positive and negative parts). To solve our initial question we must double the positive part and solve the equation π A = 2 ∫ s in ( x ) d x 0 We evaluate dy sin( x + Δx) − sin( x) = lim dx Δx →0 Δx A look in a textbook (or some minutes of calculations) give us the following identity ⎛ a −b ⎞ ⎛ a+b⎞ sin(a ) − sin(b) = 2sin ⎜ ⎟ cos ⎜ ⎟ ⎝ 2 ⎠ ⎝ 2 ⎠ (7.18) We get therefore dy sin( x + Δx) − sin( x) 2 sin(Δx / 2) ⎛ Δx ⎞ ⎛ 2 x + Δx ⎞ = lim = lim sin ⎜ ⎟ cos ⎜ cos( x ) = cos( x) ⎟ = Δlim Δ x → 0 Δ x → 0 x → 0 dx Δx Δx Δx / 2 ⎝ 2 ⎠ ⎝ 2 ⎠ d sin( x) = cos( x) dx (7.19) The slope of the function y = sin (x) is for every point x exactly y’ = cos (x), a surprising result. Of course, the latter result could only be obtained if sin(Δx / 2) =1 Δx → 0 Δx / 2 lim How to prove this. We use again the rule of l’Hospital and assume simply that sin’(x) = cos(x). There- Models in Biology 55 fore (with Δx/2 = h) 150 100 sin(h) sin'(h) cos(h) = lim = lim =1 lim h →0 h → 0 ( h) ' h →0 h 1 50 g(x) y 0 Our result implies of course two further simple relations -50 0 A 5 10 15 B 20 25 30 f(x) -100 d cos( x) = − sin( x) dx d tan( x) 1 = dx cos 2 ( x) -150 x Fig. 7.11 (7.20) Now, we can solve the initial question about the integral of sin(x) from 0 to 2π. It is π A = 2 ∫ sin( x ) dx = 2( − cos(π ) + cos(0)) = 4 0 The area under the curve of our trigonometric function is a natural number. A last example. We are interested in the area beneath the two curves shown in the Fig. 7.11 in green colour. We need the integral of f(x) and g(x) in the boundaries A and B. The area is then the difference between both integrals. Therefore, we have to calculate F(x) and G(x) and take the difference A = [(F(B) - F(A)] [(G(B) - G(A)]. We get B A= B ∫ f ( x)dx − x= A ∫ B g ( x)dx = x= A ∫ f ( x) − g ( x)dx x= A This may be written slightly different. B B A A A = ∫ f ( x ) − g ( x ) dx = ∫ y f ( x) g ( x) B f ( x) dx = ∫ ∫ h ( x , y ) dxdy A g ( x) (7.21) This latter equation is a general form of a so-called double integral. Double integrals are used to compute areas bounded by two functions. We see that a simple integral appears as a special case of such an integral were the function y = g(x) = 0. 2 2 dy + dx = dc b 2 Sometimes it is important to compute the total length of a line. For instance, we follow the troops of an animal and y are interested in the total way that animal run or we need dc a dy dx xylem system. These are special cases of a general problem to compute the length of a given function f(x). Look x Fig. 7.12 to calculate the total length of blood vessels or parts of the at Fig. 7.12. We want to calculate the length of the function y=f(x) between the points a and b. For that task we apply the law of Pythagoras and assume that the total length is divided into many small parts dc. The total length is then the sum of all dc. Therefore b b b b a a a a L = lim dc →0 ∑ dc = ∫ dc = ∫ dy 2 + dx 2 = ∫ dy 2 + dx 2 dx = ∫ 1 + f '( x) 2 dx 2 dx a b (7.22) 56 Models in Biology An example. What is the length of the function y = x2 from x = 1 to x = 2? We need 2 L = ∫ 1 + 4 x 2 dx 1 We apply the math program. The integral is a quite complicated term. Hence we use the numerical solution and get L = 3.167. Another problem concerns the volume of bodies. If these bodies were formed through a rotating process (Fig. 7.13) (they are rotation bodies) the computation is easy. Assume the body rotates around the x-axis. Its area at point x f(x) y would then be equal to 2πr2, where r is exactly the func- 0 1 2 3 a 4 b Fig. 7.13 tion value at x, it est f(x). A half rotation gives the full body and we get x 1 V= 2 x2 x2 ∫ 2π rf ( x)dx =π ∫ x1 f ( x ) * f ( x ) dx = π x1 x2 ∫ f ( x ) 2 dx x1 (7.23) If we rotate around the y-axis we get of course 1 V = 2 y2 y2 ∫ 2π rf ( y )dy =π ∫ y1 y2 f ( y ) * f ( y ) dy = π y1 ∫ f ( y ) 2 dy y1 (7.24 Hence we have to take the inverse function x=f(y). An example. What is the volume of the body generated by the rotation of y = x2 from x = 1 to x = 2 around the y-axis. We need the inverse function. 4 V =π∫ 1 π ( y ) dy = 2 y 2 4 = 7.5π = 23.56 2 1 At last we are interested in the surface of a rotation body. We need the surface of all small circles with radius r and length ΔL. This surface is 2πrΔL. r equals y = f(x) and ΔL is again √(1 + f’(x)2). Hence M = 2π x2 ∫ y 1 + ( y ') 2 dx x1 (7.25) For a rotation around the y-axis we get y2 M = 2π ∫ y1 2 ⎛ 1 ⎞ x 1+ ⎜ ⎟ dy ⎝ y '⎠ (7.26) Models in Biology 57 y Often it is easier to apply polar coordinates to compute length, areas Fig. 7.14 or volume. To compute the length L of a segment given by the polar function r = f(α) we would have to add up all segments ΔL. If ΔL goes to zero ΔL / r approaches sin (Δα). Hence (Fig. 7.14) ΔL L ≈ ∑ ΔL = ∑ r sin(Δα ) r Now we use a second approximation. We look for the limes of sin (x) / x. We use Mathematica and compute the lim directly and via a r α Taylor series expansion of sin(x). In the case of the Taylor series x the terms higher than the first are small in relation to the first and we drop them. Both approaches result therefore in lim x →0 sin( x) = x . Now we introduce this approximation into the above equation and get L ≈ ∑ r sin(Δα ) ≈∑ r Δa = ∫ rdα (7.27) For example, what is the circumference of a circle? We consider the range of α = 0 to π / 2. Hence π /2 L=4 ∫ rdα = 4rα π /2 0 = 2π r 0 Another example. What is the length of the logarithmic spiral in Fig. 7.17 from 0 to 2π? The length is 2π α r =c →L= ∫ 0 2π cα c 2π − 1 = c dα = ln(c) 0 ln(c) α By a similar reasoning we get the area inside the range of Δα. This area is approximately r∗r*sin(α)/2. We get α2 1 1 1 A = ∑ r 2 sin(Δα ) ≈ ∑ r 2Δα = ∫ r 2 dα 2 2 2 α1 Now it is easy to compute the area of a circle. It is A=4 1 2 π /2 ∫ 0 r 2 d α = 2 r 2α π /2 0 = π r2 (7.28) 58 Models in Biology Literature (Coloured titles are available in the Institute or the library, red titles are of major importance) Cornish Bowden A. 1999—Basic Mathematics for Biochemists—Oxford Univ. Press 2nd. Ed. Ennos R. 1999—Statistical and Data Handling Skills in Biology—Longman. Foster P. C. 1998—Easy Mathematics for Biologists— Taylor and Francis. Jordan D. W., Smith P. 2002. Mathematical techniques. 3rd. Ed. Oxford Univ. Press Grossman S., Tuner J. E. 1974—Mathematics for the Biological Sciences—Macmillan. Martin J. 1972—Podstawy Matematyki i Statystyki—Warszawa. Portenier C., Gromes W. 2003. Mathematik für Biologen und Humanbiologen. Script. Marburg Scheiner S. M., Gurevitch J. (eds.) 2001—Design and Analysis of Ecological Experiments— Oxford Univ. Press (2nd. Ed.). Wilson E. O., Bossert W. H. 1971, A Primer of Population Biology. Sinauer (Stamford). Murray J. D. 2003. Mathematical Biology. 3rd ed. Parts I and II. Springer New York. Science Magazine special feature. 2004. Mathematics in biology. Science 303. Napiórkowski K. 2001. Matematyka. http://info.fuw.edu.pl/~ajduk/FUW/matnkf/matematyka01_nkf.pdf Models in Biology 59 Online archives and textbooks Online Mathematical textbooks (A large collection of textbooks) http://www.math.gatech.edu/~cain/textbooks/ onlinebooks.html General mathematics (a collection of online lecture scripts and basic text on mathematics) http:// www.geocities.com/alex_stef/mylist.html Mathematics online (a source of educational online texts) http://www.glencoe.com/sec/math/ Mathematics Virtual Library (Many links to interesting web pages and programs) http://www.math.fsu.edu/Science/math.html Math on the web (Search engine for all sorts of mathematics) http://www.ams.org/mathweb/mi-mathinfo07.html The Math Archive (Many links to interesting web pages and programs) http://archives.math.utk.edu/ Eric Weisstein’s Mathematics ( a large online mathematics dictionary, with many examples) http:// mathworld.wolfram.com/ The Internet Mathematics library (a large collections of topics for pupils and students, math-beginners) http:// mathforum.org/library/ Mathematic resources (a large compilation of math internet pages) http://www.clifton.k12.nj.us/cliftonhs/chsmedia/chsmath.html Kolegium nauczyczielski. Materiały z wykładów. (Online scripts on various topics) http://info.fuw.edu.pl/ ~ajduk/lect.html Johannes Müller. 2003. Mathematical models in biology. Lecture term at TU Munich. http://wwwm12.ma.tum.de/lehre/model_2003/skript/skript.pdf Population growth models (a nice collection of growth models) http://www.math.duke.edu/education/postcalc/ growth/contents.html. Population growth models (A collection of growth model an animations) http://members.optusnet.com.au/ exponentialist/Growth_Models.htm Competition models (for persons who are interested In a discussion of the Lotka Volterra models) http:// www.ub.rug.nl/eldoc/dis/fil/r.c.looijen/c11.pdf The MacTutor history of mathematics (a very nice page on historical topics) http://www-history.mcs.standrews.ac.uk/. Excel Turorials (Many macros) http://www.herber.de/index.html?http://www.herber.de/forum/ archiv/104to108.htm. Computational molecular Biology. (a very good side with examples how to use mathematics in molecular biology). http://www.cs.bc.edu/~clote/ComputationalMolecularBiology/ 60 Models in Biology Mathematical software The Windows software collection (public domain and freeware) http://archives.math.utk.edu/software/.msdos.directory.html (contains many very nice programs) The mathematics virtual library (a collection of software pages) http://www.math.fsu.edu/Virtual/index.php? f=21. Guide to mathematical software (a search engine for math programs) http://gams.nist.gov// Step by step derivatives (a very good program for computing derivatives) http://www.calc101.com/ webMathematica/derivatives.jsp#topdoit Derivative calculator (a nice small but quite effective program for computing derivatives) http://cs.jsu.edu/ mcis/faculty/leathrum/Mathlets/derivcalc.html JAVA Mathlets for Math Explorations (a nice collection of small math programs for everybody) http:// cs.jsu.edu/mcis/faculty/leathrum/Mathlets/ The integrator (a small but effective integration program) http://www.integrals.com/index.en.cgi The MathServ Calculus toolkit (a collection of Math applets for calculus computation) http://www.math.vanderbilt.edu/~pscrooke/toolkit.html Modelowanie reczwistości (a nice Polish page with a program collection and many further links) http:// www.wiw.pl/modelowanie/ Maple homepage. http://www.maplesoft.com/ Mathematica homepage (Wofram research) http://www.wri.com/ Mathworks homepage (Matlab) http://www.mathworks.com/ Mathtype (Office build in tool for mathematics writing) http://www.mathtype.com/en/products/mathtype/

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement