The Azimuth Project
Experiments in predator-prey with Sage (Rev #3, changes)

Showing changes from revision #2 to #3: Added | Removed | Changed



Showing an easy way of doing predator-prey modeling in Sage. Right now it is a generic version.

Plot and Code


   # Predator prey in Sage. default for ode_solver runga-kutta-felhberg (4,5) T = ode_solver() T.function = lambda t, y: [y[0]-y[0]*y[1], -y[1]+y[0]*y[1]] sol_lines = Graphics() for i in srange(0.1,1.1,.1):     T.ode_solve(y_0=     [i,i],t_span=[0,10],num_points=1000)     y = T.solution     sol_lines = sol_lines + line([x[1] for x in y], rgbcolor = (i,0,1-i)) show(sol_lines+point((1,1),rgbcolor=(0,0,0)), figsize = [6,6], xmax = 6, ymax = 6)