import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Rectangle, FancyBboxPatch
from scipy.constants import h, e
fig, (ax, bx) = plt.subplots(
1, 2, figsize=(12, 5.5),
gridspec_kw={"width_ratios": [1.2, 1]},
constrained_layout=True
)
# -----------------------------------------------------
# LEFT: Photoelectric measurement
# -----------------------------------------------------
ax.set(xlim=(0, 10), ylim=(0, 9))
ax.set_aspect("equal")
ax.axis("off")
ax.set_title("(a) Photoelectric measurement")
# Evacuated photocell
ax.add_patch(FancyBboxPatch(
(.8, 3.15), 8.5, 3.55,
boxstyle="round,pad=.12,rounding_size=.5",
ec=".4", fc="#f7fafc", lw=1.5
))
# Electrodes
ax.add_patch(Rectangle(
(1.8, 3.65), .22, 2.3, color="steelblue"
))
ax.add_patch(Rectangle(
(8.25, 3.65), .22, 2.3, color="darkorange"
))
ax.text(1.9, 3.36, "Cathode", ha="center", fontsize=10)
ax.text(8.35, 3.36, "Anode", ha="center", fontsize=10)
ax.text(
6.2, 6.35, "Evacuated photocell",
ha="center", color=".4"
)
# Incident waves directed toward the emitting face
d = np.array([-.75, -.66])
n = np.array([.66, -.75])
cshift = np.array([-.66, -.75])
for offset in [-.23, 0, .23, .46]:
end = np.array([2.13, 5.17]) + offset * n
start = end - 2.6 * d
t = np.linspace(0, 1, 300)
pts = (
start + offset * cshift
+ (end - start) * t[:, None]
+ .065 * np.sin(12 * np.pi * t)[:, None] * n
)
ax.plot(
pts[:, 0], pts[:, 1],
color="#bf8b19", lw=1.5
)
ax.annotate(
"", xy=end + offset * cshift - np.array([.1, .1]), xytext=pts[-14],
arrowprops=dict(
arrowstyle="-|>",
color="#bf8b19", lw=1.6
)
)
ax.text(
4.1, 7.5,
r"Incident light, frequency $\nu$",
ha="center", color="#9c6c0b"
)
# Photoelectrons with slightly different directions
rng = np.random.default_rng(7)
positions = [
(2.7, 4.05),
(3.25, 5.5),
(3.9, 4.6),
(4.65, 5.05),
(5.3, 3.95),
(5.9, 5.65),
(6.65, 4.45),
(7.35, 5.2)
]
for x, y in positions:
ax.add_patch(Circle(
(x, y), .105,
fc="#389b77",
ec="#216c52",
zorder=4
))
theta = rng.uniform(-.22, .22)
ax.annotate(
"",
xy=(x + .57, y + .57 * np.tan(theta)),
xytext=(x + .13, y),
arrowprops=dict(
arrowstyle="->",
color="#287c60",
lw=1.4
)
)
ax.text(
5.2, 5.95, "Photoelectrons",
color="#287c60", ha="center"
)
# Electrical circuit
wire = dict(color=".25", lw=1.5)
ax.plot(
[1.91, 1.91, 3.05],
[3.15, 1.2, 1.2], **wire
)
ax.plot(
[8.36, 8.36, 7.25],
[3.15, 1.2, 1.2], **wire
)
# Adjustable DC voltage source
ax.plot([3.05, 3.50], [1.2, 1.2], **wire)
ax.add_patch(Circle(
(4.0, 1.2), .5,
fill=False, lw=1.5
))
ax.text(
4.0, 1.35, "+",
ha="center", va="center", fontsize=12
)
ax.text(
4.0, 1.03, "−",
ha="center", va="center", fontsize=12
)
ax.annotate(
"",
xy=(4.42, 1.55),
xytext=(3.57, .82),
arrowprops=dict(arrowstyle="->", lw=1.3)
)
ax.plot([4.5, 5.65], [1.2, 1.2], **wire)
# Ammeter
ax.add_patch(Circle(
(6.15, 1.2), .45,
fill=False, lw=1.5
))
ax.text(
6.15, 1.2, "A",
ha="center", va="center", fontsize=12
)
ax.plot([6.60, 7.25], [1.2, 1.2], **wire)
ax.text(
4, .15,
"Applied variable DC bias\n(polarity reversible)",
ha="center", fontsize=9
)
ax.text(
6.25, 1.85,
"Measured current $I$",
ha="center", fontsize=9
)
# -----------------------------------------------------
# RIGHT: Stopping potential versus frequency
# -----------------------------------------------------
# Illustrative nickel work function
phi = 5.15 # eV
# h/e converted to V/PHz
slope = h / e * 1e15
# Threshold frequency
nu0 = phi / slope
nu = np.linspace(0, 4.6, 400)
vs = slope * nu - phi
# Physical region
ax2 = bx
ax2.plot(
nu[nu >= nu0],
vs[nu >= nu0],
lw=2.4,
label="Einstein relation"
)
# Dashed extrapolation below threshold
mask = (nu >= .085) & (nu < nu0)
ax2.plot(
nu[mask], vs[mask],
"--", color="tab:blue", lw=1.5,
label="Extrapolation (not measured)"
)
# Synthetic illustrative measurements
nu_data = np.array([
1.34, 1.49, 1.65, 1.81,
2.01, 2.19, 2.39
])
noise = np.random.default_rng(19).normal(
0, .11, len(nu_data)
)
ax2.scatter(
nu_data,
slope * nu_data - phi + noise,
color=".15", s=32,
zorder=5,
label="Illustrative data"
)
# Threshold and zero line
ax2.axhline(0, color=".3", lw=.9)
ax2.axvline(nu0, ls=":", color=".55", lw=1)
ax2.annotate(
fr"$\nu_0={nu0:.2f}\ \mathrm{{PHz}}$",
xy=(nu0, 0),
xytext=(1.62, .65),
arrowprops=dict(arrowstyle="->")
)
ax2.set(
xlim=(0, 5.15),
ylim=(-5.5, 16.35),
xlabel="Light frequency (PHz)",
ylabel=r"Stopping potential $V_s$ (V)",
title=r"(b) Nickel ($\Phi\approx5.15$ eV)"
)
ax2.grid(alpha=.2)
ax2.legend(loc="upper left", fontsize=8.5)
plt.show()