HOEMWORK COSC 120 WINTER 2017 Distributed: 2/2/2017 Due: CHANGE DATE TO 2/14/2017 Write three Python scripts to show the convergence of the following models. (1) Babylonian. Compute sqrt(2000) in 20 steps (aka ticks). x(t+1) = 0.5 * (x(t) + (a / x(t) ) x0 = a (or x0 = (a + a/2) / 2 (2) Compute pi using the following expansion for 20 ticks. See https://en.wikipedia.org/wiki/Pi (use floating point arithmetic) pi = 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + . . . (3) This models predator (y) and prey (x) population. r is growth rate of prey (0 <= r <= 1.0) d is death rate of predator ( 0 <= d <= 1.0) b is a tuning parameter to determine how quickly d (death rate of predator) changes as y (prey population) increases. c is a tuning parameter to determine how quickly r (growth rate of prey) changes as x (predator population increases. K is carrying capacity of the environment. x(t+1) = x(t) + r * x(t)*( 1 - x(t)/K) - (1 - 1/ (b * y(t) + 1) ) * x(t) y(t+1) = y(t) - d * y(t) + c * x(t) y(t) Run the model for 300 ticks with: r = b = 0.5 d = c = 1 K = 20 x0 = y0 = 1