Results 1 to 3 of 3
- 02-12-2012, 09:58 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 2
- Rep Power
- 0
Help writing a program to study population growth
I am currently working on a program for class:
"Write a program to study the following simple model for population growth, which might be applied to study fish in a pond, bacteria in a test tube, or any of a host of similar situations. We suppose that the population ranges from 0 (extinct) to 1 (maximum population that can be sustained). If the population at time t is x, then we suppose the population at time t + 1 to be r*x*(1 - x), where the argument r, known as the fecundity parameter, controls the rate of growth. Start with a small population-- say, x = 0.01-- and study the result of iterating the model, for various values of r. For which values of r does the population stabilize at x = 1 - 1/r? Can you say anything about the population when r is 3.5? 3.8? 5?"
Here is what I have so far, can someone please help me figure out what I am doing wrong?
public class Chaos
{
public static void main(String[] args)
{
double t = Double.parseDouble(args[0]);
double x = Double.parseDouble(args[1]);
double r = Double.parseDouble(args[2]);
for(x = 0.01; x >= 0 && x <= 1; t++) {
x = (r*x*(1 - x));
System.out.println(1 - 1/r);
}
}
}
- 02-12-2012, 10:18 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
Re: Help writing a program to study population growth
What sort of 'wrongness' did you experience?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 02-12-2012, 10:26 PM #3
Member
- Join Date
- Feb 2012
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Help with writing my own program
By DMarsh12 in forum New To JavaReplies: 4Last Post: 12-30-2011, 03:34 AM -
How Search Is Accelerating The Growth of Video In The Enterprise
By petermatilda in forum Java SoftwareReplies: 0Last Post: 11-15-2010, 11:37 AM -
Combo Box Population
By barusk in forum Java AppletsReplies: 1Last Post: 03-20-2009, 01:48 PM -
Due Tommorow Writing a Program Please Help
By gallimaufry in forum New To JavaReplies: 4Last Post: 10-23-2008, 03:15 AM -
Java Developer Needed/Perm/NJ/Brokerage...lots of room for growth
By shagans982 in forum Jobs OfferedReplies: 1Last Post: 08-09-2008, 11:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks