# Lab 10# Name:Michele Shi# I worked on this code with:# Please do all of your work for this week's lab in this worksheet. If# you wish to create other worksheets for scratch work, you can, but# this is the one that will be graded. You do not need to do anything# to turn in your lab. It will be collected by your TA at the beginning# of (or right before) next week’s lab.# Be sure to put each exercise in a new cell with an exercise number at the top.# Use enough comments that you and the grader can understand your code.# Label axes on all graphs.
#6 plotting function x^2+y^2 and the tangent plane that passes through (1,-1,2)#z=k1x+k2y k1 and k2 are slopes. When x=0, the tangent line to x^2 is just f(x)=x and when y=0, tangent line to y^2 is just f(y)=y. so k1 and k2 are equal to 1 (derivative of x^2 is just x and at point (1,-1,2))var("x,y")plot3d(x^2+y^2,(x,-10,10),(y,-10,10),color="aqua",opacity=.4)+point3d((1,-1,2),color="purple",size=10)+plot3d(x+y,(x,-10,10),(y,-10,10),color="orange",opacity=.4)
3D rendering not yet implemented
#8 plot vector field for Holling tanner modelvar("x","y")r=0.2Xprime=(r*x)*(1-(x/7))-(x/(1+x))*yYprime=(1/10)*y*(1-(y/x))eqns=[Xprime,Yprime]t=srange(0,100,.1)sol=desolve_odeint(eqns,ics=[10,10],times=t,dvars=[x,y])plot_vector_field([Xprime,Yprime],(x,-10,10),(y,-10,10))+point((.239,.24),size=10)+list_plot(sol,plotjoined=true)
#This equilibrium point is a stable spiral.#9 computing the jacobian for the holling tanner model. assign the result to a variable J and "show"J=jacobian([Xprime,Yprime],[x,y])J
#since both eigenvalues are complex conjugates both with negative real parts, the equilibrium point is a stable spiral.#11var("x,y")eqn1=0.0300033894396598*x-0.192897497982244*yeqn2=0.100838570753313*x-0.100836820083682*yplot_vector_field([eqn1,eqn2],(x,-10,10),(y,-10,10))
#Compared to the nonlinear system, this new vector field looks like all points will approach this. It is not as messy since the nonlinear system can have multiple equilibrium points but only approaching one. This system shown above has only one equilibrium point.