These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
### Exercise Set 1
1. What is the total net force on the dipole?
2. What is the magnitude of the net torque on the dipole in terms of $q$, $d$ and $|\mathbf{E}|$?
3. Express the torque as a vector in terms of the vectors $\mathbf{p}$ and $\mathbf{E}$.
4. For what angles $\theta$ is the dipole
* in stable equilibrium?
+ in unstable equilibrium?
+ undergoing maximum torque?
### Exercise Set 2
1. Using the small angle approximation (i.e. for $|\theta| \ll 1$ then $\sin(\theta) \approx \theta$), show that for small initial displacement, $\theta$, the electric dipole undergoes simple harmonic motion. (Hint: use your result from Exercise Set 1 and remember that $\tau = I\alpha$ where $\alpha$ is the angular acceleration and $I$ is the moment of inertia.)
+ What is the angular frequency of the oscillations?
+ Write out the formula for $\theta$ as a function of $t$. (Hint: this should be a solution to the second order differential equation above)
+ Edit the code below to plot a graph of the angle of displacement from equilibrium vs. time where $q=1.6\times 10^{-19}$ C, $d=5$ cm, $m = 1.67\times 10^{-27}$ kg, and $E=100$ N/C.
```python
theta0=(10.0/180)*np.pi #initial displacement in radians
q = #Charge on dipole in Coulombs
d = #distance separating the charges (m)
m = #mass of a single charge (kg)
E = #magnitude of the electric field
############################################################
######## EDIT BELOW WITH YOUR VALUE ###########
######## THIS IS THE ANGULAR FREQUENCY ###########
omega = #enter your angular frequency
############################################################
############################################################
######## Determine the Period of the motion ########
######## in terms of the angular frequency ########
T = #edit this for the period of motion #
############################################################
t=np.linspace(0,2*T,2000) #time interval from t = 0 to t = 2T
theta = theta0*np.cos(omega*t) #solution for Simple harmonic motion
############################################################
######## The following code plots the data #######
plt.plot(t,theta)
plt.title("Simple Harmonic Motion - dipole in an Electric field")
plt.xlabel("time (s)")
plt.ylabel("angle (radians)")
plt.grid()
plt.show()
############################################################
```
###Exercise Set 3###
1. in the code below you can see some parameters which you can edit. Also, there is a field in which you need to put in your value of the angluar frequency. $\omega$ you obtained above.
(a) Determine the time, for a dipole with $q=e$, $d=3\times 10^{-9}$ m, $m=3\times 10^{-5}$ kg in an electric field, $E=1000$ N/C, at which the small-angle solution differs from the non small-angle solution by 0.01 rads.
2. Try other parameter values as well.
```python
############################################################
################ Start of parameters ###################
theta_degrees = 30.0 #intial angle of displacement (degres)
Tmax = 500.0 #upper bound for time (s)
q = 1.0e-19 #Charge on dipole in Coulombs
d = 3.0e-9 #distance separating the charges (m)
m = 3.0e-5 #mass of a single charge (kg)
E = 1000 #magnitude of the electric field
N = 50000 #number of time intervals
error = 0.05
############################################################
######## EDIT BELOW WITH YOUR VALUE ###########
######## THIS IS THE ANGULAR FREQUENCY ###########
omega = np.sqrt((2.0*q*E/(d*m))) ## EDIT THIS ##
############################################################
################ End of parameters ###################
############################################################
############################################################
############################################################
#Set the times to evaluate
t = np.linspace(0,Tmax,N)
#convert initial angle to radians
theta_rads = theta_degrees * np.pi / 180.0
##############################
# compute approximate theta values on the time intervals
Approx_Solution = theta_rads*np.cos(omega*np.array(t))
##############################
# Set the intial condition [initial angle, initial velocity]
x0 = [theta_rads, 0.0]
##############################
# numerically solve the real solution using odeint
sol2 = odeint(torque,x0,t,args=(q,d,m,E))
#############################
# Plot the two solutions
plt.plot(t,theta_rads*np.cos(omega*np.array(t)))
plt.plot(t,sol2[:,0])
plt.grid()
plt.xlabel("time (s)")
plt.ylabel("angle (rads)")
plt.show()
############################
# compute the difference between approx and actual on intervals
diff = [np.abs((a1-b1)) for a1,b1 in zip(Approx_Solution,sol2[:,0])]
#########################################
# Plot the difference vs time
plt.plot(t,diff)
plt.xlabel("time (s)")
plt.ylabel("Difference")
plt.show()
#########################################
# Find when the two differ by .01 radians
flag = True
for i in range(len(t)-1):
if abs(diff[i]> error):
print("after t =", t[i],"the two solutions differ by more than .01 rads")
flag = False
break
if flag:
print("solution always within",error," rads")
```
2. Try varying the magnitude of the electric field (e.g. $1000 \leq E \leq 5000$). What do you notice about the time it takes for the solutions to differ by .01 rads?
3. If you run the last cell, you will obtain a short animation displaying the dipole oscillating about the stable equilibrium point and below that a graph of the difference between the two different solutions and the approximation. What can you notice about when the differences are largest? Can you explain?