### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Intro to Matlab MATH 410

GPA 3.96

### View Full Document

## 14

## 0

## Popular in Course

## Popular in Mathematics (M)

This 17 page Class Notes was uploaded by Miss Hillary Grady on Thursday October 29, 2015. The Class Notes belongs to MATH 410 at College of William and Mary taught by Junping Shi in Fall. Since its upload, it has received 14 views. For similar materials see /class/231143/math-410-college-of-william-and-mary in Mathematics (M) at College of William and Mary.

## Reviews for Intro to Matlab

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/29/15

Math 410510 Notes 2 Analyzing Single Species Population Models Ordinary Differential Equations J unping Shi Since we learn the word equation we always want to solve an equation which means to nd the solutions of the equation For example 1 x273x20 Solve 3012 3021 Once an equation is solved that is the end of the story we nd all and only solutions to the equation But this is not always the case Another example 2 w7i5w20 There is no good way to solve the equation But still we can have ways to get the information of the solutions to the equation A By using computer or calculator we can graph the function fc 7 7 5x 2 and on the graph we can see and roughly locate the roots B we can use the Newton s method or other numerical method to nd highly accurate approximate solutions So for the algebraic equation like 2 rst we try to solve it that is called analytic method if that wouldn t work we can analyze its graph that is called qualitative method or geometric method nally we can use numerical method to nd approximate solution For differential equation all three methods are still useful but techniques are quite different In this notes we describe all three methods for equation a fl Equation 3 is called a rst order autonomous ordinary di erential equation First there are two kinds of differential equations ordinary differential equation ODE and partial differential equation PDE A solution of an ODE is a function Pt which depends on only one variable a solution of a PDE is a function like Ptcy which depends on more than one variables 3 is called rst order since there is only the rst order derivative dPdt in the equation Here are some higher order equations d3P 4 P 3P 7 2OOP 2 2nd order W sint 3rd order Finally it is called autonomous since the right hand side of the equation only depends on P but not t A non autonomous equation is like dPdt P2 t or more general dP 5 t P m w 1 Analytic method how to solve the equation This is how it basically goes dP dP dP dP fP dt dt t0 a gt no no no where C is a constant and you should solve the integral then solve P in term of t We show that we can do this for the exponential model and logistic model dP dP dP Exponential Model E kP kdt kdt lnP kt C P ekHC 06 so we P obtain Pt Ce where C is a constant Note that C here can be any constant and it changes in ektc to C61 Indeed by the property of exponential function we have ektc ekteC so our new constant C is 60 in the previous expression But 60 is still a constant we don t need to keep track how the constant changes here so we just still call it C Als 0 we can drop the absolute value I a on P if we allow C to be negative since P iP Initial Value Problem Since C can be any number in the above expression then the differential equation P kP has in nite many solutions Which one is useful for us Usually in applications we know the initial population ale PO or just population at any given time Then we can actually solve the constant C by using this information For example consider dP 6 3P P0 100 dt From above we rst get Pt Cegt this is called the general solution of the equation P 3P Now we substitute PO 100 into the general solution 100 PO CeO C so C 100 and the unique solution to the initial value problem is Pt 10063t In general the solution of dP 7 Wkpvp0gtP0 is Pt P061 When k gt 0 this population has an exponential growth when k lt 0 the population has an exponential decay Logistic Equation Consider dP 8 E 2P17P PO 06 dP 1 1 P P t m 72dt ltF17PgtdPi2dtlnP7ln17P7tCln lip 7tC 3706 Since PO 06 then C60 so C 32 get P 317 Pet P get 7 getP so t 7 32et 7 3et 7132et 7 2 365 Why 17313 can be broken into dP This is because 17313 by the partial fraction technique which you should learn in Calculus II Math 112 course In general the solution of dP P 9 kP 1 7 P 0 P lt gt d lt N lt gt o NPO 1s Pt see Polking s textbook Chapter 3 page 129 130 P0 N 7 P0ekt 2 Geometric method how to see the equation As you may expect we cannot solve all the differential equations In the computer age we can easily draw various kinds of graphs of the differential equations Here we consider an equation dPdt ftP If the function Pt is a solution of the equation and if its graph passes through the point t0P0 where P0 yt0 then the di erential equation says that the derivative dPdt at t to is given by the number ft0 P0 Geometrically this means the slope of the tangent line to the graph of Pt at to P0 is ft0 P0 And this must hold for all points on the graph of Pt In other word the values of the right hand side of the di erential equation yield the slopes of the tangents at all points on the graph of Pt Since we are given the function f t P in the di erential equation we obtain a rough idea of the graphs of the solutions to the di erential equations by sketching the corresponding direction eld We make this sketch by selecting points in the t 7 P plane and computing the numbers f t P at these points At each point selected we draw a minitangent line we call it slope mark whose slope is f tP Once we have a lot of such slope marks we can visualize the graphs of the solutions Of course this would be a tedious work if you try to do this by hand drawing even if you just select 100 points A computer program can do this in a perfect way in just one second Here are the direction elds of exponential and logistic models am vunng the held element ReadY Eamvuhng the held elements Ready Eamvmmg the held elements Ready We introduce a few ways to produce the graphs of direction elds on a computer If you just want to visualize the equation by seeing the direction eld you can use the the following online java applets which draw direction eld httpmathrice eduquotdfield By John Polking from Rice University http Namath colorado eduf acultysherodclassesPhasorphase html http wwwmathpsu edumelviuphaseuewphase html While the online softwares are convenient to use they usually do not have good printing results and sometime are even not possible to be printed For good printout you can go to any on campus computer labs which have Windows 2000 network computers Details will be given in another handout 3 Numerical method how to compute the approximate solution Every budding dynamicist or math biologist should master a third tool numerical methods In the old days numerical methods were impractical because they required enormous amounts of tedious hand calculations But all that ha changed thanks to the computer Computers enable us to approximate the solutions to analytically intractable problems and also to visualize those solutions The problem can be posed this way given the di erential equation P f t P subject to the condition P P0 at t to nd a way to approximate the solution Pt We can use the direction eld introduced above to help us thinking We could think the solution Pt owing steadily on the P axis with velocity f t P at the location P and time t lmagine we are riding along with a point being carried downstream by the direction eld Initially we are at P0 when the time is to and the local velocity is f to P0 If we Ordinary Generating Functions The ordinary generating function OGF for a series 1a of complex numbers is the formal power series 20 anx When an counts the objects in a universe A for which an index parameter X has value ri7 we say that the generating function is indexed by X 0 an be the number of binary lists of length n Then the OGF is 220 Tr which is indexed by length of binary lists 0 Consider k subsets of an n set Then Anx 20 M is indexed by size of subsets of Given two formal power series 20 anx and 20 bnx the sum and product or convolution is de ned as follows7 respectively sum Zan bar product 2 ajbnjp n0 7L0 10 De ne Ax 1 to be Bp such that AxBx 1 1x0 0x1 0x2 Then we may show that Ap has a multiplication inverse if zOAx 31 0 Examples 1 Multisets from two types of objects the OGF is M Ma ltk1gtzk lt Ma w H 0 w H 0 2 Multisets selections with repetition let dk be the number of multisets of size k from 71 types of objects Then the OGF is dezk 2m 2611 kZO kZO kZO 3 Multisets with restricted multiplicities When S is the set of multiplicities al lowed for a type of objects7 the generating function for that factor is Zkes M 0 When no restriction for multiplicity7 then the OGF is Zkzo pk 1iz 1 o For ordinary subsets7 S 017 then the OGF is 1 0 When each type must be used7 the OGF is z p2 p3 z17 z 1 0 When the usage for a type must be even7 the factor for it is p2 x4 1 7 p2 1 ln how many ways can one pick 20 coins that are pennies7 nickels7 or dlimes7 with at least three nickels and at most four dimes Solution the number is x2017 x 1x3 x4 z 2 3 4 We may operate on the OGFs and on the expansions without losing equality This may allow us to use OGF to prove something pleasantly Some basic propositions 1 shifting the index 27 Z Zki w kZO kzr kZO Let A7 B7 0 be are the OGFs for lt 1 gt7 lt b gt7 lt 0 gt7 respectively7 then 2 on an bn for all n if and only if Cs A 3 on 20 aibni for all n iff Cz n7 7 f 2 k 4 bn Z fk or nk if and only if Bz 7 or n lt 5 on 20 11 for all 239 if and only if Cs g n f 6 bn a or even if and only if Ba 05mm A7z 0 for 71 odd 7 b 0 f n 7 or n even if and only if Bz 05A 7 A7 an7 for 71 odd ak for n mk 8 bn if and only if Bz 0otherwise 9 bn nan if and only if B xA z Examples 0 n2n 1 The sum is the value at z 1 after differentiating Z 0 2 2 1 The sum is the value at z 1 of 2 x2 Zkzo km Consider Zkzo kmxk 220 72k The convolution of ak and bk o 20k01 7 The convolution of ak bk k Snake Oil method When n is a parameter in a sum7 we can always multiply by x to form an OGF Then interchange the order of summation in the expression for Aw and perform the new inner sum on n explicitly 1 Zkzo k Let an Zkzo with AW ano anx Then AW k nfkx kk1k 39 nik is the OGF for Fibonacci numbers We already know that 1757M lt2 2k 3 2 2k 3 225 Multiply both sides by x and sum over 717 and interchange the order of the summation RHS 2k 216 if 1i1m 3 ELM 717 k Cn 1m 17 where Cn7 k denote the number of permu tations of with k cycles The OGF is Cnz zx1z2 n71 n Zoom gawk cnk1xk 1x m w X 0017 k lxmllt1 96gt lzm1llt1 W Cn 1 m 1 km The generating function method to solve recursive relations 0 The generating function for a sequence lt a gt of complex numbers is the 00 n i i i i formal power serzes Zypo anx or any function w1th power series expansion 220 anx The coe icient operator extracts the coef cient of x in a power series in 7 so can when Aw 20 anx Direction field slope field dP E 157 P If the function P05 is a solution of the equation and if its graph passes through the point tOPO where P0 yt0 then the differential equation says that the derivative dPdt at t to is given by the number ftOPO Direction field at each point selected we draw a minitangent line we call it slope mark whose slope is ftP Autonomous Equation dP E fP The direction field of an autonomous equation does not depend on 25 so the slope marks at t1P and t2P are same All solutions are parallel in P direction in the sense that if P05 is a solution then Ptc is also a solution So we only need to draw slope marks for a fixed 25 Phase line Phase line is a simplified direction field for autonomous eduation only On a vertical line we indicate the positive derivative by an arrow pointing up and negative derivative by an arrow pointing down Equilibrium solutions dP 2 p dt f gt If for some number a fa 0 then Pt a is an equilibrium solution constant solution How to draw the phase line 1 Draw the P Iine usually vertical 2 Find and mark the equilibrium points 3 Find the intervals of P values for which fP gt O and draw arrows pointing up in these intervals 4 Find the intervals of P values for which fP lt O and draw arrows pointing down in these intervals Euler s Method dP E ap 13050 P0 Idea use tangent line to approximate the solution curve P P0 PtoXt to to PoXt to Approximate the value at t 251 P1 13051 P0 to 1 30th to General formula in tn l At Pn Pn l fan 1 Pn 1At At is the step size Model 3a Allee effect Assumptions 1 If the population is too large then the growth is negative 2a If the population is too small then the growth is negative Example The fox squirrel a small mammal native to the Rocky Mountains If the population is too small fertile adults run the risk of not being able to find suitable mates so the growth is negative d szPlt1 gtlt5 lgt dt N M k 2 growth rate per capita coefficient N carrying capacity M sparsity constant and O lt M lt N Model 3b Allee effect Assumptions 1 If the population is too large then the growth is negative 2a If the population is too small then the growth rate per capita is positive but not the largest d PkPlt1 igtlt5 1gt dt N M k 2 growth rate per capita coefficient N carrying capacity M no meaning here and M lt O lt M lt N Malthus Model Assumption the reproduction rate is proportional to the size of the population dP E kP k 2 growth rate per capita Solution Pt P0eki k gt O exponential growth is lt O exponential decay Proposed by Thomas Robert Malthus 1798 British An essay on the principle of population available online Validity good for bacteria in an unlimited environment or com puter virus otherwise not reasonable due the the limitation of the resource Logistic Model Assumption the reproduction rate is proportional to the size of the population when the population size is small and the growth is negative when the size is large dP E P gP gP growth rate per capita Choose the simplest form which fulfils the assumptions P d kP lt1 5 dt N k maximum growth rate per capita N carrying capacity Proposed by Pierre Francois Verhulst 1838 Belgian Examples bacteria yeast in a limited environment laboratory experiments Example 1 A biologist prepares a culture After 1 day of growth the biologist counts 1000 cells After 2 days of growth he counts 3000 Assuming a Malthus model what is the repro duction rate and how many cells were present initially Qualitative analysis of Logistic equation dP P Plt1 gt dt 4 o P O and P 4 are equilibrium solutions constant solutions 0 When 0 lt PO lt 4 the solution is increasing since P 1 gt gt O and Iim Pt 4 4 t gtoo 0 When PO gt 4 the solution is decreasing since P 1 gt lt O and Iim Pt 4 4 t gtoo Analytical solution of Logistic equation dP P dt N 0 NPO N Po kt P0 Pt 2 Example 2 A population is observed to obey the Logistic equa tion with eventual population 20000 The initial population is 1000 and 8 hours later the observed population is 1200 Find the reproductive rate and the time required for the population to reach 75 of its carry capacity answer is 00241 T 16776 hours

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.