RE: insect population dynamics

*To*: mathgroup at smc.vnet.net*Subject*: [mg24614] RE: [mg24590] insect population dynamics*From*: "David Park" <djmp at earthlink.net>*Date*: Fri, 28 Jul 2000 17:23:50 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Mark, You can quickly generate numerical solutions without using RSolve. Here are your equations in definition form. It was necessary to reindex to get proper definitions. Also I used dynamic programming (Section 2.4.9 in the Book) so that the functions would remember their values and not continually have to recalculate. a[0] := 25; b[0] := 10; a[n_] := a[n] = E^(0.63*(1 - 1/50* a[-1 + n]) - 0.068*b[-1 + n])* a[-1 + n] b[n_] := b[n] = (1 - E^(-0.068*b[-1 + n]))* a[-1 + n] This calculates a set of data points for the a and b populations for times 0 to 100. {adata, bdata} = Transpose[ Table[{{i, a[i]}, {i, b[i]}}, {i, 0, 100}]]; This plots the a population and data points versus time: Block[{$DisplayFunction = Identity}, apoints = ListPlot[adata, PlotJoined -> False, Prolog -> {AbsolutePointSize[4]}]; aplot = ListPlot[adata, PlotJoined -> True]]; Show[apoints, aplot, ImageSize -> 500, Frame -> True, FrameLabel -> {"period", "insects"}, PlotRange -> {0, 35}, PlotLabel -> "a Population"]; This plots the b population and data points versus time: Block[{$DisplayFunction = Identity}, bpoints = ListPlot[bdata, PlotJoined -> False, Prolog -> {AbsolutePointSize[4]}]; bplot = ListPlot[bdata, PlotJoined -> True]]; Show[bpoints, bplot, ImageSize -> 500, Frame -> True, FrameLabel -> {"period", b}, PlotRange -> {0, 20}, PlotLabel -> "b Population"]; This plots the two populations on the same plot with different colors. Block[{$DisplayFunction = Identity}, aplot = ListPlot[adata, PlotJoined -> True, PlotStyle -> RGBColor[0, 0, 1]]; bplot = ListPlot[bdata, PlotJoined -> True, PlotStyle -> RGBColor[1, 0, 0]]]; Show[aplot, bplot, ImageSize -> 500, Frame -> True, FrameLabel -> {"period", "insects"}, PlotRange -> {0, 35}, PlotLabel -> "Insect Polulations, a Blue, b Red"]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > -----Original Message----- > From: Mark Hunter [mailto:mhunter at ecology.uga.edu] To: mathgroup at smc.vnet.net > > I'm trying to use mathematica to run insect population models. I'm new > to the system, and wolfram support suggested that I post my question > here. > > The models are simple predator-prey models. They are non-linear > simultaneous difference equations. I've tried using RSolve, but it > doesn't seem to handle the non-linearity. Is there a way of using a > Do-Loop for the same kind of thing? A simple example of the model that > I tried is: > > RSolve[{a[n + 1] == a[n]*Exp[0.63((1 - a[n]/50)) - 0.068b[n]], > b[n + 1] = a[n]*(1 - Exp[-0.068*b[n]]), a[0] == 25, > b[0] == 10}, {a[n], b[n]}, n] > > I want an output for variables a and n at time n, n+1, etc. > > I'd be most grateful for any advice that you can offer, and please don't > underestimate my current level of ignorance. > > Many thanks, > > Mark Hunter > >