[关闭]
@feipai11 2016-04-01T01:41:10.000000Z 字数 2123 阅读 1119

population : the more the better?

S.F.Guo


Summary:

This is a problem we are familar, which we have learned in highschool biology. Actually this is a Markov process:the latter outcome is depend only on the former result. In this work, I not only found the outcome depending on the timestep, but also found that different parameters creat totally different result in this model.

The pseudocode:

I want to define a class to do with, but I failed because I don't really know about how to use the class fountion. Finally, I use the most simple way to write this code. that is inistialize, calculate, store and show. In the calculate function, I used the relation:


Actually this differential equation has an accurate solution. But as we woluld take advantage of the computer, we don't bother to solve it. Instead, I solved the linar equation when . So we can see how the timestep determines the pewcision of the numerical solution.

The code and result:

To show the timestep-dependance of the final result, I put some curve together in one figure. This time I didn't use the read_file script. On the contrary, I wrote allt the command in one script, including the discussion on whether the constant . And when the parameter , we the have the exponential solution. finally I plot three curve in on figure to illsutrate the error caused by the longer timestep. If , I use different timestep to get the same curve and prove that the solution is good enough and inpendent on the timestep. THIS is the final codes.

The analysis and conclusion

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注