CE 451/551 – Computer-Aided Research in the Chemical and Materials Sciences:

Homework #11 (Graded #3)

Chemical作业代写 The goal of this assignment is to practice the use of cookbooks, templates, and code snippets as well as the SciPy and Matplotlib…

The goal of this assignment is to practice the use of cookbooks, templates, and code snippets as well as the SciPy and Matplotlib libraries for a given problem setting. Your task is to write a Python program that describes the population development in a simple predator-prey relationship, i.e., one in which there are only two interacting species, one a predator and one its prey. (Predator-prey relationships are typical examples for dynamics in a biological system.)

A basic standard model considers (a) the natural birth rate of the prey species; (b) the natural death rate of the prey due to predation; (c) the natural death rate of the predator due to lack of prey; (d) the factor describing how many caught prey animals lead to the birth of a new predator animal. Your task is to expand the basic model by including (e) the natural death rate of the prey independent of predation; (f) the natural death rate of the predator independent of lack of prey (Note: the original model should result as a special case for e = 0.0 and f = 0.0).

Your code should plot the population evolution results for this model for a number of parameter combinations, i.e., a = 1, b = 0.1, c = 1.75, d = (0.25, 0.5, 0.75, 1.0); e = 0.2 and f = 0.1 as well as e = f = 0.0; initial number of prey animals is 50 and the initial number of predator is (1,10,100). In total, your code should thus plot the results of 24 parameter combinations. (If you end up with 48 plots, you missed that two parameters are not independent, which reduces the number of possible combinations.) Your script should write these plots into image files (e.g., pngs) like we did in the modified zombies example, rather than displaying them on screen. Chemical作业代写

The graphs should be meaningful, attractive, and “publication quality”, which means that the graph is properly labeled; that there is a legend and potentially a plot title; that fonts, font sizes, line thicknesses are chosen sensibly (e.g., well readable, no overlapping texts); that you make appropriate use of color; that you choose the “right” kind of plot (e.g., if a histogram is the most obvious choice, then do not do a pie-chart); that you consider visual aidsif appropriate (e.g., subtle gridlines); that the value ranges make sense (e.g., if the largest y-value is 100, then the y-axis should probably not go to 200); that the files generated are sensibly named (i.e., not just “fig1.png”, “fig2.png”,…), etc.


However, “publication quality” does not mean that they should be overly complicated or full of bells-and-whistles that distract from what you want to show (actually these are all negatives). The recipe may suggest additional field plots which you can add, if you want.

Please submit your zipped source code file to me via email – do not just copy your source into the email. If you want to send multiple files, please add them to the zip folder. You do not have to include the images your code generates as we will run your code for evaluation. Please add a short README text file in which you describe the major changes you made to the original recipe and please also add corresponding comments into the appropriate places of your code (e.g., “# In the following function, I added…”, “# Here I added a loop over all parameters…”).

Your submission will be graded based on the quality of your implementation (including efficiency, documentation, readability, clarity), and whether your program actually works or not. As part of the evaluation, I have to be able to execute the file you send me on CCR using module load python/py38-anaconda-2021.05. Do not assume X window access, i.e., write all graphics to file. If your code does not run under those conditions, then you have a problem. To test your code under these conditions, you can copy it over to CCR, load Anaconda, and try to execute it. Please use the following email subject line “CE 451/551 HW11 submission by <your name>”.

Tip 1: Cookbook recipes, examples, templates, and code snippets for similar problems can be found online. And your primary task is to find and adapt one of them for the task at hand. 2 Chemical作业代写

Tip 2: The Zombie Apocalypse recipe we discussed in class is very similar to the target application at hand. And it can in fact be used as the basis to solve this assignment. However, there is an even better recipe for this particular problem.

Tip 3: The most suitable template you will find will only give you results for one parameter combination. So it will require a rewrite to produce results for all 24 parameter combinations using loops (if you do not use loops but just copy the code over and over again, you will loose points on style).

Tip 4: The standard model of the predator-prey relationship in this assignment is rather famous. It was discovered independently by two scientists in 1925/26, and you should have encountered it in high-school biology.

Tip 5: The key to updating the model given in the most suitable template is to understand how the given differential equation works (in the same way we did in class for the zombie example), then adding e and f is straightforward.

Tip 6: If you have trouble getting your code to run, try to google the error message you get. They will likely lead you to a useful stackoverflow page that will help you solve the problem.

Note: Your code should be adequately commented, so that I know what you are doing. Chemical作业代写

Note: You may interact on technical questions with your classmates, but every student has to submit an individual solution. No two scripts/programs can be alike.