AMath 573 - Homework 3

561 days ago by cswiercz

%hide %html <h1>Exercise 3</h1> 
       

Exercise 3

Exercise 3

def makeH(gamma,W0): def H(U,V): return -(U^4+V^4)/4 + (U^2+V^2)/2 - U^2*V^2/2 + gamma*V^2/2 + (1-W0)*U + W0-5/4 return H 
       
var('U,V') gamma = 1/10 W0s = [3,2,1.1,1,0.95,0.9] l = [] for W0 in W0s: H = makeH(gamma,W0) P = implicit_plot(H, (U,-3,2), (V,-2.5,2.5), plot_points=100) P += point((1,0), pointsize=50, color='blue') P += text("$W_0 = %.3f$" %(W0), (-2.5,2), fontsize=12) l.append(P) 
       
G = graphics_array(l,2,3) 
       
G.show(figsize=[18,12]) 
       
 
       
%hide %html <h2>Some Tests</h2> 
       

Some Tests

Some Tests

var('U,V') P = Graphics() gamma = 1/10 W0 = 3 Umin,Umax,Vmin,Vmax = [-3,3,-3,3] for C in [-1,0,1,W0 - 5/4]: H = makeH(gamma,W0,C) if abs(C + W0 - 5/4) < 10^6: P += implicit_plot(H, (U,Umin,Umax), (V,Vmin,Vmax), plot_points=60, linestyle='--') P += else: P += implicit_plot(H, (U,Umin,Umax), (V,Vmin,Vmax), plot_points=60, linestyle='') 
       
P += point((1,0),color='blue',pointsize=50) P.show(figsize=[8,8]) 
       
eqn = H(1,0) eqn(W0=9/10) 
       
C + 7/20
C + 7/20
float(23/20) 
       
1.1499999999999999
1.1499999999999999
var('C') H = makeH(gamma,W0,C) 
       
H(1,0) 
       
C + 23/20
C + 23/20
23