Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 215
#Today we will be doing Euler's method for the Shark-Tuna model #I'm going to help you get started by giving you the model itself var("S","T") Tprime(T,S) = 2/3*T - 4/3*S*T Sprime(T,S) = S*T - S S0 = 1 #initial number of Sharks T0 = 3 #initial number of Tuna ## Exercise 1 : write code that calculates the shark tuna population at t=0.1 (one step). Verify your result by hand. ## Exercise 2: use that code and a for loop to find the population size at t= 10. ################The goal here is to do what you just did 100 times ################For now don't worry about saving each value in a list, but make sure you update the value of shark and tuna each time ## Exercise 3: calculate the shark tuna population size for each time point in the list below. ##############Save the shark and the tuna population sizes in two lists and use append to add new values timepoints = srange(0.1,20,0.001) ## Exercise 4: plot shark and tuna population time series using the time points given. You will need the function zip. ################use the function list_plot with argument plotjoined = true to get a continuous line ##Exercise 5: Use the code below to plot the vector field. Then, plot the trajectory you calculated on the vector field. vector_field(S,T) = (Sprime,Tprime) p=plot_vector_field(vector_field, (S,0,3),(T,0,4)) show(p) ##Exercie 6: Run the code you just wrote again, changng ony the initial population size to 3 shark and 3 tuna. Wh do ou obere n? ##Wha do yo hik wo hppen in nture i yu hd thi siation?