Modeling the Frequency of Bear Contacts in Rocky Mountain Residential Areas
Environmental Sciences
New Mexico High School
Supercomputing Challenge
Final Report
April 5, 2000

Team 030

Bosque Preparatory School

 

 

 

 

 

 

 

 

Team Members
Samuel Ashmore
Nicole Mumma
Kenny Sutherland

Teachers
Debra M. Loftin
Dorothy Ashmore

Project Mentors
Geoffrey Comber
Hal Meyer



Executive Summary

Our project is about the interaction between a growing residential area and a bear population. Both the residential area and the bear population are populations that can be modeled by an equation. In reality, they are two populations that have great effect on each other. The interactions between these two populations cause many problems. The biggest of which are a danger to the future size and health of the bear population, decrease of property value, and a danger to the people already living near or in the bear territory.
A bear population increases and decreases in size based on the relationship between their birth and death rates, availability of food, and the amount of hunting annually. A residential area, as far as we were concerned, only grew. It grew only because of an increase in the size of the human population and the need for more room for them to live. It was important for us to understand how each of the populations grew for us to be able to represent them in our program. In order for us to illustrate their interaction, we had to understand the reasons that a bear would migrate toward a residential area. We decided that it was because the area that the bear was in became less desirable, forcing the bear to go in search for more food and better shelter. A bear goes into a residential area because when the bear encounters it, he may believe that it looks much more desirable than any of the territories he had already seen. Bears only go into residential areas in search of food and shelter, never because of 'a thirst for blood', in search of a mate, or simple curiosity.
Our program was based on a Logistic growth model (a model that grows, but has more factors other than the birth and death rate). We modeled a bear population on a grid of the territory, specified which cells are residential areas and which cells are bear territory, and then determined "desirability" for each of the cells. This allowed us to not only show how a residential area and bear population grew, but also how the bears would migrate from one cell to another based on desirability. Theoretically, this program could model the contact between any mammal and human structures, although the variables and values may differ from mammal to mammal and type of human structure to another.

Introduction
The purpose of our project is to model the frequency of a bear encountering a growing residential area. Some people are concerned that bear encounters could negatively effect the bear population. A bear may come in contact with a residential area for many reasons, some of which are a lack of food, a loss of shelter, or a loss of a battle with another bear. If bear encounters increase, then the bears will have to be relocated very far away or killed. Albuquerque alone is supposed to reach a population of one million people by the end of 2001. Therefore the bears will be left with less open space in the years to come. In past years, the media has had stories about bears wandering into residential areas that had to be tranquilized and relocated. We felt that perhaps the media was overplaying the intensity of the situation. We thought we could write a program that could accurately tell us how rare it would be that a bear would come in contact with a residential area.

The Model

Our model began with a simple Malthusian growth model. From there, it became a Logistic growth model. We used the Logistic growth equation as the core of our program. To develop a more complete and accurate model of a real population, more variables had to be incorporated into the program. A Logistic growth equation models a population with a growth rate and carrying capacity. To increase the accuracy of the bear population model, we needed to incorporate variables such as harvest rate, desirability, habitat loss rate, and, territory size. In our program, the user must input the values for each of the variables. For each time the user chooses to continue, a new set of data is given and a graph is produced and updated. A theoretical grid is produced within the program. Each cell in the grid is either open area or residential area. Each of the cells is given a "desirability" value. Desirability is assigned by the percent of the open carrying capacity within the cell. To model migration, the desirability of each cell is compared to each other. The bears are more likely to migrate to the one with the greater desirability. The migration data is displayed in tabular form for easy access in Excel ®.


Project Description

We started out with a simple program with a Malthusian model equation, which prompted the user for each input value, and wrote the results to standard output. From here, we swapped out the equation for a Logistic growth equation. We improved the input interface and also wrote the output in tabular form. Then for the model we added hunting and designed it to print out the information into a file. Then we added habitat loss to the program. After much work, we created a web interface for the program. Then we added zones and migration. That is how our program evolved. During the evolution of the program, we gathered real-life data to make sure the output was realistic. After identifying the useful data, we used it in testing the program.

Bear Research
To validate our model it was necessary to input real data about bears into our program. This information needed to be about all the variables that we were going to use in our program. To get this data we used the Internet and email to communicate with and retrieve data from the Department of Game and Fish, located in New Mexico, Colorado, Wyoming, Montana, and Northern Idaho. The first research we had to do was about generic bear information, so we could understand bear life. This data includes what they eat, their life span, their birth rate, their natural death rate, the hunting rate, and bear territory size. This information was acquired from several different web sites all over the country. We used the North America Bear Association to collect most information, and several newspapers from major cities in the Rocky Mountains.
We found that bears are little more than herbivores. Less than 2% of their diet includes fish. However, the bears living further north eat more fish due to a lack of plants. The life span of a bear is generally 20-25 years. Cubs spend the first few years with their mothers. Then they are left to fend for themselves. Females can begin to have offspring at around age 4-5. On average female bears will produce about 3-5 cubs every 3-4 years. The territory size depends on the region, but on average male bears need about 10-40 square miles of land, while females need only 2.5-10 square miles. If the capacity of the region becomes full, then the bears are more inclined to fight with each other and to wander out of their regions into residential areas.
Once we understood bears in general, we had to find actual data about real populations living in the Rocky Mountains. We found this data though the Department of Game and Fish in several states. We could input this data into our program to test its accuracy. A sample of our data is shown in Appendix C.
C++ Program
We created a program from a mathematical model. Mathematical models are usually one-line equations that researchers can do in Excel ®. However, we used multiple equations to compute our final answer. We used equations that acted recursively. We used four equations using the same variables to compute the population and migration values. Our team designed all of these equations especially for this program.
Our program started out as a Malthusian growth program. A Malthusian model is a model that grows without bounds. See Figure 1. This program was not adequate for our objective because in a real life situation, bears grow with bounds. We then modified it to a Logistic growth program, which allowed us to set bounds. See Figure 2. The population then became predictable because it would level out based on the carrying capacity. Our next problem was modeling hunting. We added a harvest rate based on the number of pelts hunters collected per year from 1967-1998. We then had a Logistic growth model with harvesting. Now it would level off much lower and contained hunting. Then we had to face the problem of residential areas. We knew they sometimes grew into bear territory, so we had to add habitat loss. Our habitat loss rate was based on very rough data that we have collected over the Internet. At Regionals we talked to some scientists who gave us the idea of having multiple regions instead of one. We modifiedour program again by adding regional Logistic growth. We ultimately wanted to be able to monitor the number of times bears encountered a residential area by migrating in to a new region. We had to add a new variable called migration. Migration is based on the percentage of open carrying capacity. Up until now, there was no place for the bears to migrate.
Our program has many different parts. The biggest are input, output, and the equations. The input variables are population size, growth rate, carrying capacity, # of years (cycles), harvest rate, and area reduction rate/capacity reduction. The population size value is the number of bears living in the modeling space. Growth rate is the relationship between the birth and death rate of the total bear population. Carrying capacity is the maximum number of bears that the cell can sustain. The cycles are the number of years for which the program to run (modeled years not actual years). Harvest rate is the percent of bears killed per year (cycle). Area reduction rate is the percent of reduction of the carrying capacity. The capacity reduction is the same as the area reduction rate except it is a fixed number. Since the area reduction rate and capacity reduction have the same purpose, only one can be used, not both.
The output comes in one or two ways. This depends on whether the program is run from the command line or the web site. If the program is run from the web site, the redisplayed input is a table, which displays the population and migration for each year. The data from the output file is displayed in tabular form and has a time date stamp. Underneath that, if the browser is setup up right, is a custom designed table for the input. At the bottom a graph is displayed using Gnuplot. If the program is run from the command line, two types of output are given back. One is the table that displays the population for each year on the screen. The second is a separate file. This file has a time date stamp that allows the user to know when it was created. (This is the file that would be imported onto the web page when the program is run from the web site.) This file also has the table and input numbers. Our equations for population looks like this:
population = population + (growth_rate * population *( (1 - population/carrying_capacity)))
- population * harvest_rate
population is the population size of the species,
growth_rate is the growth rate,
carrying_capacity is the carrying capacity,
and harvest_rate is the percent of bears killed.

Our equation for habitat loss looks like this:
carrying_capacity=carrying_capacity*(1-habitat_loss_percent)-habitat_loss_fixed
where habitat_loss_percent is the percent of the habitat lost,
habitat_loss_fixed is the fixed number of habitats lost.

The desire equation is
Desirability= (1- (population/carrying_capacity),
where Desirability is how desirable the territory is.

The migration equation is
Population1 = (1- desirability0 /desirability1)) * population0 + population1.

Our last equation is
Poulation0 = (desirability0 / desirability1) * population0.
This program can be run at mode.lanl.k12.nm.us/~ch030sra/final.cgi. An example of the zones is shown in Figure 5. We call this type of model a zone migration model.
If our group did not proceed systematically then our project would have been way over our heads and we would not understand it as much as we do. We learned that you must think big, but act slowly and solve the problem in pieces.

 


Results and Conclusions
Several input values had to be adjusted such as growth rate, hunting rate, number of cycles, and carrying capacity in order to obtain realistic results. Game and Fish averages for population size were used to determine growth rate and hunting rate in a 21 year cycle. In order to get a realistic growth rate, the initial population size in 1967 had to be divided by the population size in 1988. The hunting rate was estimated based on the difference between the number of licenses issued, in several states, and the number of pelts accounted for, during a similar time period. Carrying capacity was drawn from the average territory size of male and female bears, which determined the value that made the results realistic. The model results were only validated for a 21-year cycle, due to the fact that actual population sizes were only available for 1967 and 1988 from Game and Fish. If the model produces accurate data for this time interval, then we assume that it will produce realistic results for other time intervals. This demonstrated that the mathematical model used in our program was adequate for predicting the size of a migrant population of bears. The program was run approximately 40 times to confirm that the data was accurate for these cases. Inserting a hunting value brought many problems to our attention. The value we were using for hunting rate did not include poaching (unregistered bear kills). To make our output data more accurate, we had to estimate the amount of annual poaching. Once we incorporated the amount of poaching into our harvest rate, we noticed a change of only 0.005. The estimated pouching rate was 0.10, we got this from the New Mexico Game and Fish. The hardest part about migration was the equations. Coming up with the equations took up more time than programming them.
Recommendations
Perhaps the biggest problem in our program is displaying the migration data clearly, or validating that it is realistic. The program does not directly state the numbers of Bears that have entered into a residential area in the output file. The output tells the user how many bears migrated, but it would be very helpful if the user could see on a grid how many bears migrated to and from which cell. Unfortunately, we could not find any real numbers of the encounters bears have with residential areas. We did, however, find numbers from Game and Fish that told us how many bear sighting there were per year. Assuming that the bear was sighted from a home, and not from a trail or through a telescope, we could estimate the amount of encounters bears had with residential areas.
Our program is also moldable to several other species. The only things that the species need to have as part of the species lifestyle are the variables that are in our program. An example of this usage would be to run the program on mice that carry the plague in the area of New Mexico. The zones include city areas like the West Side, or the East Mountains, or counties like Bernalillo or Sandoval.
We found a Bear Research Study in Colorado that has been going on for the past 10 years. The study was going to be completed some time this year, and the people whom we talked to said that we could get the data only after it had been compiled and discussed, which was going to take another few months. This information contained data for many of the variables in our program, and would have allowed us to test our program more thoroughly. Similarly, New Mexico is doing a large scale research project on Bears, but it would not be available until the end of this year.
Probably the most important users of our program would be environmentalists who would used it to convince construction companies and city planners where a good a place to build would be. If an environmentalists was planning to figure out if this was a bad place for them to be building more homes on the edge of a city, he/she could use our program to model the number of bear encounters with the residents. He/sh e could also determine how appealing the nearby areas would be, thus determining the frequency of bear encounters.
Acknowledgments
We would like to thank Mrs. Ashmore, for keeping us in line and on time, and for helping us to produce the best we can, and better; Ms. Loftin, for her help in the completion of this report, and periodical help throughout the project; Mr. Comber, for helping us set up our linux boxes, and for not deleting the multiple files we forgot about on the F drive; and Mr. Myers for helping us develop the base of our program and the hundreds of ideas that followed.

 

 

References

Practical C++ Programming, O'Reilly,1997, Steve Qualine;
Perl, The Programmer's Companion, Wiley, 1997, Nigel Chapman;
2.3.5Mathematical Modeling, Sandia labs, http://ais.cs.sandia.gov/AiS/textbook/unit2/ projdev2.3.5.html
Bears head south, driven by hunger, mating Experts predict more interaction with humans as animal's numbers grow, Milwaukee Journal Sentinel; Milwaukee; Jun 28, 1999; MEG JONES;

BEARS THREATENED BY POACHING, POLLUTION, DEFORESTATION, Columbian; Vancouver; Aug 1, 1999; AP;

DURANGO Ursine intruders get pretty hard to bear Food shortages boost contact with humans, Denver Post; Denver, Cob.; Sep 6, 1999; Electa Draper Denver Post Four Corners Bureaw

OUTDOORS ALMANAC Bear season a bust for many bunters, Star Tribune; Minneapolis, Minn.; Oct 24, 1999; Doug Smith; Staff Writer;

State considers proposal to allow black bear hunts; Residents say growing population of animals a nuisance, The Sun; Baltimore, Md.; Jan 20, 2000; Greg Garland'

California bear hunt shows population is on upswing, Las Vegas Review - Journal; Las Vegas; Dec 9, 1999; John Kimak;

U.S. authorities report rising cases of bear poaching Hunters make money off sale of galibladders, paws, claws of animal, Milwaukee Journal Sentinel; Milwaukee; Feb 21, 1999; MARIA GLOD AND LEEF SMITH;

IT'S A BEAR MARKET BUT WITH THE DROUGHT AFFECTING, Pittsburgh Post - Gazette; Pittsburgh, Pa.; Nov 14, 1999;

Bear eludes capture in Ramona, The San Diego Union - Tribune; San Diego, Calif; Nov 9, 1999; Bruce Lieberman;

Biologists, environmentalists debate whether migration will boost bear numbers, Officials find tagged animals on Canadian soil, Idaho Statesman; Boise; Nov 16, 1999;

Legal claim says feds can't link grizzly groups Environmentalists say bear numbers still are too low, Idaho Statesman; Boise; Nov 25, 1999;

Maryland's bear population showing new, bristling health, The Sun; Baltimore, Md.; Dec 16, 1999; Peter Baker;

NORTH AMERICAN BLACK BEAR, Bear Country USA, http://www.bearcountryusa.com/animals/bear.htm;

Reports/By Date, Unknown, http://domino.htcomp.net/bhn/bear.nsf/861ba1 1601 8cd870862563b00004524d?OpenView;

Reports/By Area, Unknown, http://domino.htcomp.net/bhn/bear.nsf1c39e9f73a9fS 1 5fd8625 63b0000a8 195 ?OpenView

American Black Bears, "THE BEAR DEN", http :I/www. nature-net. com/bears/black html;

Canadian Grizzly Population Sizes, CERI, http://www.grizzlybear.org/gbmap/cosewics.html

 

 

 

 

Appendices

Appendix A: Grid.cpp

//*************************************************************
//
//Bosque Preparatory School Growth Program
//
//*************************************************************

#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cassert>
#include <time.h>
#define region 2
#define regions 2
// bear class
class Territory{
public:
double population ;
double carrying_capacity;
double growth_rate ;

double harvest_rate ;
double desire;
double habitat_loss_rate;
double habitat_loss_fix;
double migration;
double migrations;
void update();
};
void Territory::update()
{
population = population + (growth_rate * population *( (1 - population/carrying_capacity))) - population * harvest_rate;
}
Territory area[region][regions];

double cycles =0;
double times =0;
// must be one

double time_interval =1;
int timer =0;
int timers =0;
time_t t;

char* s;

double get_input(char* input_value);
int main()
{

 

//Explanation of program

cout << "This is a logistic growth program\n";
cout << "Population is the population at time 0 \n";
cout << "Growth rate is the rate of growth \n";
cout << "Carrying capacity is how much the land can hold \n";
cout << " Cycles the number of units that you want it to run \n";
cout << " Harvest rate is the decimal percent harvested \n";
cout << "Habitat losses are percent for rate and a interger for fix\n";
// prompts
for(timer =0; timer < region ; timer ++)
{
for(timers =0; timers < regions; timers ++)
{
cout << "grid" << timer << ", " << timers << "\n" ;
//Information input

area[timer][timers].population = get_input("population");
area[timer][timers].growth_rate = get_input("growth rate");
area[timer][timers].carrying_capacity =get_input("carrying capacity");
area[timer][timers].harvest_rate = get_input( "harvest rate");
area[timer][timers].habitat_loss_rate= get_input( "habitat loss rate");
area[timer][timers].habitat_loss_fix= get_input( "habitat loss fix");

}

 

}
cycles =get_input("number of cycles");
// the name of output file
cout << "Enter the name of the output file: ";

string outfilename;

cin >> outfilename;

cout << outfilename << endl;
//output file writingi
cout << "0";
ofstream outStream(outfilename.data());
cout << "1";

assert( outStream.is_open());
t = time(NULL);
s= ctime(&t);
outStream << s ;

//writes into file input
outStream <<"Logistical Growth Results: \n ";

outStream << "The original population is: ";
for(timer =0; timer <region; timer ++)
{
for(timers =0; timers <regions;timers ++)
{
outStream << area[timer][timers].population << "\t";
}
outStream << "\n\t\t\t\t" ;
}

outStream << "\n";
outStream << "The growth rate is: ";
for(timer =0; timer <region; timer ++)
{
for(timers =0; timers <regions;timers ++)
{
outStream << area[timer][timers].growth_rate << "\t";
}
outStream << "\n\t\t\t" ;
}
outStream << "\nThe carrying capacity is: ";
for(timer =0; timer <region; timer ++)
{
for(timers =0; timers <regions;timers ++)
{
outStream << area[timer][timers].carrying_capacity << "\t";
}
outStream << "\n\t\t\t" ;
}
outStream << "\nThe habitat loss fixed amount is: ";
for(timer =0; timer <region; timer ++)
{
for(timers =0; timers <regions;timers ++)
{
outStream << area[timer][timers].habitat_loss_fix << "\t";
}
outStream << "\n\t\t\t" ;
}
outStream << "\nThe habitat loss rate is: ";
for(timer =0; timer <region; timer ++)
{
for(timers =0; timers <regions;timers ++)
{
outStream << area[timer][timers].habitat_loss_rate << "\t";
}
outStream << "\n\t\t\t" ;
}
outStream << "\nThe harvest rate is: ";
for(timer =0; timer <region; timer ++)
{
for(timers =0; timers <regions;timers++)
{
outStream << area[timer][timers].harvest_rate << "\t";
area[timer][timers].migration =0;
area[timer][timers].migrations =0;
}
outStream << "\n\t\t\t" ;
}
outStream << "\nThe number of cycles is: " << cycles << "\n";
outStream << "Time \t population\n\n";
cout << "Time \t population \t migration\n";
times =0;
//main loop
for(times= 0; times <= cycles; times++)
{
cout << times << "\t ";
outStream << times << "\t ";
for(timer=0; timer < region; timer++)
{
for(timers=0; timers < regions; timers++)
{
//output
outStream << setiosflags(ios::fixed) << setprecision(2) << area[timer][timers].population << "\t" << area[timer][timers].migration + area[timer][timers].migrations << "\t";
cout << setiosflags(ios::fixed) << setprecision(2) << area[timer][timers].population << "\t" << area[timer][timers].migration + area[timer][timers].migrations << "\t";

 

//THE EQUATIONs
area[timer][timers].update();
area[timer][timers].carrying_capacity = area[timer][timers].carrying_capacity *(1-area[timer][timers].habitat_loss_rate) -area[timer][timers].habitat_loss_fix;
area[timer][timers].desire = 1-(area[timer][timers].population/area[timer][timers].carrying_capacity);
cout << area[timer][timers].desire << "\t";

if(area[timer][timers].population <0){
area[timer][timers].population = 0;
}

if(area[timer][timers].carrying_capacity < 0){
area[timer][timers].carrying_capacity = 0;
}
}
}
//secret ingredent, migration
for(timer=0; timer < region; timer++)
{
for(timers =0; timers < regions; timers ++)
{
try
{
if( area[timer][timers].desire > area[timer +1][timers].desire )
{

area[timer][timers].migration =(1-( area[timer +1][timers].desire/area[timer][timers].desire)) * area[timer+1][timers].population;

area[timer+1][timers].population = area[timer+1][timers].population - area[timer][timers].migration;

 

}
if( area[timer][timers].desire < area[timer +1][timers].desire )
{
area[timer+1][timers].migration =(1-( area[timer ][timers].desire/area[timer+1][timers].desire)) * area[timer][timers].population;
area[timer][timers].population = area[timer][timers].population - area[timer+1][timers].migration;
}
} //in clase the other region doesn't exist
catch(...)
{
}
try
{
if( area[timer][timers].desire > area[timer ][timers+1].desire )
{

area[timer][timers].migrations =(1-( area[timer ][timers+1].desire/area[timer][timers].desire)) * area[timer][timers+1].population;

area[timer][timers+1].population = area[timer][timers+1].population - area[timer][timers].migration;

 

}
if( area[timer][timers].desire < area[timer][timers+1].desire )
{
area[timer][timers+1].migrations =(1-( area[timer ][timers].desire/area[timer][timers+1].desire)) * area[timer][timers].population;
area[timer][timers].population = area[timer][timers].population - area[timer][timers+1].migration;
}
}
catch(...)
{
}

 

}
}

cout << "\n";
outStream << "\n";
}
outStream.close();

//the end
return 0;
}

double get_input(char* input_value)
{
// input section
double num;
num = -9991;
//bad number phase
while (num < -9990)
{
cout << "Please enter the "<< input_value << " : ";
cin >> num;
if (!cin.good()) {
cout <<"bad input data" << endl;
cin.clear();
cin.ignore(200,'\n');
}
}
// cin.clear();
// cin.ignore(200,'\n');
return num;
}
Appendix B: Final .cgi
#!/usr/bin/perl
print "Content-type:text/html\n\n";

print "<html><head><title>Bosque School's Model</title></head></html>\n";
print "<body>";
print "<center><h1> Migration Model</h1></center>";
print <<EndForm;
<form action="final.cgi" method = "POST">
<pre><small> Area 1 Area 2

population = <input type="number" name ="population00" value=$FORM{'population00'}> population = <input type="number" name ="population01" value=$FORM{'population01'}>
growth rate = <input type="number" name ="growth00" value= $FORM{'growth00'}> growth rate = <input type="number" name ="growth01" value= $FORM{'growth01'}>
hunting rate = <input type="number" name ="hunting00" value =$FORM{'hunting00'}> hunting rate = <input type="number" name ="hunting01" value =$FORM{'hunting01'}>
carrying capacity = <input type="number" name ="capacity00" value=$FORM{'capacity00'}> carrying capacity = <input type="number" name ="capacity01" value=$FORM{'capacity01'}>
habitat loss rate = <input type="number" name ="habitatl00" value=$FORM{'habitatl00'}> habitat loss rate = <input type="number" name ="habitatl01" value=$FORM{'habitatl01'}>

Area 3 Area 4

population = <input type="number" name ="population10" value=$FORM{'population10'}> population = <input type="number" name ="population11" value=$FORM{'population11'}>
growth rate = <input type="number" name ="growth10" value= $FORM{'growth10'}> growth rate = <input type="number" name ="growth11" value= $FORM{'growth11'}>
hunting rate = <input type="number" name ="hunting10" value =$FORM{'hunting10'}> hunting rate = <input type="number" name ="hunting11" value =$FORM{'hunting11'}>
carrying capacity = <input type="number" name ="capacity10" value=$FORM{'capacity10'}> carrying capacity = <input type="number" name ="capacity11" value=$FORM{'capacity11'}>
habitat loss rate = <input type="number" name ="habitatl10" value=$FORM{'habitatl10'}> habitat loss rate= <input type="number" name ="habitatl11" value=$FORM{'habitatl11'}>

Number of years = <input type="number" name ="years" value=$FORM{'years'}>

<input type="submit" value = "Run Modeling Program"></pre>
</small></form>

EndForm

print "</body></html>";

read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}

 

if ($FORM{'population00'} eq "" or $FORM{'population01'} eq ""or $FORM{'population10'} eq ""or $FORM{'population11'} eq ""){
print "Please enter the Population and submit";
}
elsif($FORM{'growth00'} eq "" or $FORM{'growth01'} eq "" or $FORM{'growth10'} eq "" or $FORM{'growth11'} eq ""){
print "Please enter the Growth Rate and submit";
}
elsif($FORM{'capacity00'} eq "" or $FORM{'capacity01'} eq ""or $FORM{'capacity10'} eq ""or $FORM{'capacity11'} eq ""){
print "Please enter the Carrying Capacity and submit";
}
elsif($FORM{'years'} eq ""){
print "Please enter the Number of Years and submit";
}
elsif($FORM{'hunting00'} eq "" or $FORM{'hunting01'} eq "" or $FORM{'hunting10'} eq "" or $FORM{'hunting11'} eq ""){
print "Please enter the Hunting Rate and submit";
}
elsif($FORM{'habitatl00'} eq "" or $FORM{'habitatl01'} eq "" or $FORM{'habitatl10'} eq "" or $FORM{'habitatl11'} eq ""){
print "Please enter athe Hunting Rate and submit";
}

else {

open (INPUT, "| ../project/a.out > /dev/null");
print INPUT "$FORM{'population00'}\n";

print INPUT "$FORM{'growth00'}\n";

print INPUT "$FORM{'capacity00'}\n";

print INPUT "$FORM{'hunting00'}\n";

print INPUT "$FORM{'habitatl00'}\n";

print INPUT "0\n";

print INPUT "$FORM{'population01'}\n";

print INPUT "$FORM{'growth01'}\n";

print INPUT "$FORM{'capacity01'}\n";

print INPUT "$FORM{'hunting01'}\n";

print INPUT "$FORM{'habitatl01'}\n";

print INPUT "0\n";

print INPUT "$FORM{'population10'}\n";

print INPUT "$FORM{'growth10'}\n";

print INPUT "$FORM{'capacity10'}\n";

print INPUT "$FORM{'hunting10'}\n";

print INPUT "$FORM{'habitatl10'}\n";

print INPUT "0\n";

print INPUT "$FORM{'population11'}\n";

print INPUT "$FORM{'growth11'}\n";

print INPUT "$FORM{'capacity11'}\n";

print INPUT "$FORM{'hunting11'}\n";

print INPUT "$FORM{'habitatl11'}\n";

print INPUT "0\n";

print INPUT "$FORM{'years'}\n";

print INPUT "./sam.out\n";

close (INPUT);

open (PLOT, "| /usr/bin/gnuplot > /dev/null");
print PLOT "set terminal png\n";

print PLOT "set output './bears.png'\n";

print PLOT "set title 'population' \n";

print PLOT "set xlabel 'years'\n";

print PLOT "set ylabel 'number of bears'\n";

print PLOT "set time\n";

print PLOT "set grid\n";

print PLOT "plot './sam.out' with lines\n";

print PLOT "replot\n";

print PLOT "replot\n";

print PLOT "replot\n";

print PLOT "replot\n";

print PLOT "replot\n";

print PLOT "replot\n";

print PLOT "replot\n";

print PLOT "replot\n";

close (PLOT);

$INPUT_RECORD_SEPARATOR = '\n';
open(INF, "./sam.out");
@b = <INF>;
print <<EndData;
<pre>
@b

<img src="./bears.png" alt="graph" border=0>
</pre>
EndData

close(INF);

}

print "</body></html>";

 

 

Appendix C. Sample Bear Population Data

Year Location Pop Bears Killed Licenses % Kill w/ Lis % Kill Overall Mating Territory Territory Sightings Random kills
1994 Canada 129-142 10-40 Mi 2.5-10 Mi
1997 N America 400,-750 10-40 Mi 2.5-10 Mi
1997 Pittsburgh 10000 2110 116946 0.1794 1.80 % Kill 10-40 Mi 2.5-10 Mi
1998 Pittsburgh 10000 2598 114767 0.226 2.26 % Kill 10-40 Mi 2.5-10 Mi
1999 Maryland 400+ 3 By 2 10-40 Mi 2.5-10 Mi 82
1980's California 10,000-15, 10-40 Mi 2.5-10 Mi 1
1999 California 17,000-23, 10-40 Mi 2.5-10 Mi
1995 Baltimore 200 10-40 Mi 2.5-10 Mi
1999 Baltimore 400 10-40 Mi 2.5-10 Mi
1998 Minnesota 42000 10-40 Mi 2.5-10 Mi
1999 Minnesota 27000 3000 16500 0.181 0.1111 10-40 Mi 2.5-10 Mi
2000 Minnesota 30,000 est Want 6,000 10-40 Mi 2.5-10 Mi
1999 Denver 10-40 Mi 2.5-10 Mi + - 900 4