>
          Rabbit/Coyote Ecololgy Simulation
        Using Simplified Lotka-Volterra Model

> module EcologyEquations
>   (displayRabbitCoyotePopulationTrajectory)
>   where

>   import DrawingUtilities(makeChart, displayChart)
>   import SequenceUtilities(pam)


deliver displayable string depicting rabbit/coyote population cycle

>   displayRabbitCoyotePopulationTrajectory ::
>     Int -> Int -> Int -> [Float] -> [Float] -> String
>   displayRabbitCoyotePopulationTrajectory
>     width height period modelCoefficients initialPopulations =
>     (displayChart["Rabbits", "Coyotes"] .
>       makeChart '*' width height . take period .
>        rabbitCoyotePopulationTrajectory modelCoefficients)
>                                                initialPopulations

rabbit population update function (simplified Lotka-Volterra model)

>   nextRabbitPopulation :: RealFrac num => [num] -> [num] -> num
>   nextRabbitPopulation
>    [rabbitIncreaseWithoutWolves, coyoteDecreaseWithoutRabbits,
>     chanceThatCoyoteAEatsRabbitX, coyoteIncreaseByEatingRabbit]
>    [currentRabbitPopulation, currentCoyotePopulation]
>    =
>    (1 + rabbitIncreaseWithoutWolves)*currentRabbitPopulation -
>    (chanceThatCoyoteAEatsRabbitX*currentCoyotePopulation)*
>                                          currentRabbitPopulation


coyote population update function (simplified Lotka-Volterra model)

>   nextCoyotePopulation :: RealFrac num => [num] -> [num] -> num
>   nextCoyotePopulation
>     [rabbitIncreaseWithoutWolves,  coyoteDecreaseWithoutRabbits,
>      chanceThatCoyoteAEatsRabbitX, coyoteIncreaseByEatingRabbit]
>     [currentRabbitPopulation, currentCoyotePopulation]
>     =
>     (1 - coyoteDecreaseWithoutRabbits)*currentCoyotePopulation +
>     (chanceThatCoyoteAEatsRabbitX*currentRabbitPopulation*
>              coyoteIncreaseByEatingRabbit) * currentCoyotePopulation


delivers rabbit/coyote population trajectory via
simplified Lotka-Volterra model

>   rabbitCoyotePopulationTrajectory ::
>     RealFrac num => [num] -> [num] -> [[num]]
>   rabbitCoyotePopulationTrajectory populationChangeCoefficients
>                                    initialRabbitCoyotePopulations =
>     populationTrajectory
>       (rabbitCoyoteUpdateFunctions populationChangeCoefficients)
>       initialRabbitCoyotePopulations


update functions, packaged for populationTrajectory function

>   rabbitCoyoteUpdateFunctions::RealFrac num => [num] -> [[num]->num]
>   rabbitCoyoteUpdateFunctions populationChangeCoefficients =
>    [nextRabbitPopulation populationChangeCoefficients,
>     nextCoyotePopulation populationChangeCoefficients ]


deliver time-sequence of population figures given
population update functions and initial populations
Note: can handle any number of species

>   populationTrajectory ::
>    [[population] -> population] -> [population] -> [[population]]
>   populationTrajectory updateFunctions = iterate(pam updateFunctions)

Last Modified: