Boundary condition

Viewed 199

Could anyone help me with the boundary conditions for the following equation? I am not able to find the graphs displayed in the figure. They are for different u_0, one has 4 roots and the second has 2 roots.

enter image description here

import matplotlib.pyplot as plt
import math
import numpy as np
fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1, figsize=(5,5))

# Equation - dispersion relation 
omega_p = 500
k       = 5
u_0     = 5
u_02    = 10
m       = 90
M       = 2
omega   = np.arange(0, 500, 0.1)
ksi     = omega/omega_p
ksi_0   = k*u_0/omega_p
ksi_02  = k*u_02/omega_p
F       = (m/M)/ksi**2 + 1/(ksi-ksi_0)**2
F2      = (m/M)/ksi**2 + 1/(ksi-ksi_02)**2

# Fig 1
ax1.plot(ksi, F)
# Fig 2
ax2.plot(ksi, F2)
plt.show()
1 Answers

I cant check the physics of your equation but the problem in the display seems to stem from the two undefined function where the divisions by 0 occur. I have modified your code a bit (introducing an epsilon to prevent div0 - physically this makes no sense but illustrates the behaviour of the function):

import matplotlib.pyplot as plt
import math
import numpy as np

fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1, figsize=(5,5))

# Equation - dispersion relation 
omega_p = 500
k       = 5
u_0     = 5
u_02    = 10
m       = 90
M       = 2
omega   = np.arange(-20, 500, 0.1)
ksi     = omega / omega_p
ksi_0   = k*u_0 / omega_p
ksi_02  = k*u_02 / omega_p

print(ksi)
print(ksi_0, ksi_02)
eps = 0.00001

F       = (m/M) / (ksi**2+eps*10) + 1 / ((ksi-ksi_0)**2+eps)
F2      = (m/M) / (ksi**2+eps*10) + 1 / ((ksi-ksi_02)**2+eps)

# Fig 1
ax1.plot(ksi[:600], F[:600])
# Fig 2
ax2.plot(ksi[:800], F2[:800])
plt.show()

which gives

[-0.04   -0.0398 -0.0396 ...  0.9994  0.9996  0.9998]
0.05 0.1

enter image description here

which is about what you expect (depending on the cut at the y-axis you will have 2 or 4 roots). Now maybe there is an issue with units? This could also be the reason your function gives such large values (i.e. much larger than 1 where the cut is in your example).

Related