Зомби против людейPython

Программы на Python
Гость
Зомби против людей

Сообщение Гость »


Let us play a game popular on many campuses: Humans vs. Zombies! The students join one of two groups, designated as Humans and Zombies, respectively. Members of each group are armed with toy dart guns. To make it interesting, let us assume that the firing rates, or "kill" rates, between the groups are different. Let H be the number of Humans with a kill rate lamda h, and Z the number of Zombies with a kill rate lamda z. In the simplest model, we can assume that the number of Humans decreases at a rate proportional to the kill rate and the number of Zombies, and vice versa. This model can be written as d/dt (H) = - lambda_{Z} * Z, d/dt (Z) = - lambda_{H} * H

The game ends when one side reaches zero, and the other side is the winner.

(a) Say you are the last one to join, and you are free to choose either group. The current situation is as follows: 69 Humans with a kill rate 2, and 99 Zombies with a kill rate 1. There are fewer Humans, but they have twice the kill rate. If your goal is to win, which group would you join? Choose wisely (and write it down).

(b) It is war now! Simulate the game by solving the model with the initial condition as: lambda_{H} = 2 lambda_{z} = 1 if you decided to join the Humans, then H = 70 Z = 99 otherwise H = 69 Z= 100. Plot the H-t and Z-t curves when the game ends. You may use either RK2/RK4 or the leapfrog method. Are you victorious? Why?

(c) Switch sides and repeat (b).

(d) Run the program with different initial H, say 80, 100, 120, etc., and for each H, find the upper limit Z such that the Humans barely win. Plot H vs. Z, and you should discover a scaling law, i.e., H/Z = C. Find the constant C. As it turns out, the model yields analytic solutions. Find them, and discuss how C is related to λy and Az.

I am not getting the answer of d part.


Источник: https://stackoverflow.com/questions/781 ... -vs-humans

Вернуться в «Python»