| name | optics |
| description | Geometrical and wave optics including ray tracing, lens systems, interferometry, polarization, lasers, and nonlinear optics for physics and engineering applications. |
| category | physics |
| tags | ["physics","optics","geometrical-optics","wave-optics","interferometry","polarization","lasers","nonlinear-optics"] |
| difficulty | intermediate |
| author | neuralblitz |
Optics
What I do
I provide comprehensive expertise in optics, the branch of physics describing light and its interactions with matter. I enable you to analyze ray optics and lens systems, understand wave phenomena and interference, model polarization and birefringence, design laser systems, and apply nonlinear optics for frequency conversion. My knowledge spans from fundamental principles to advanced techniques essential for photonics, telecommunications, microscopy, and laser engineering.
When to use me
Use optics when you need to: design lens systems and optical instruments, analyze interference and diffraction patterns, model laser resonators and beam propagation, calculate polarization effects and optical activity, design fiber optic systems, understand nonlinear frequency conversion, analyze thin film coatings, or model atmospheric and underwater optical phenomena.
Core Concepts
- Snell's Law: n₁ sin(θ₁) = n₂ sin(θ₂) describing light refraction at interfaces.
- Thin Lens Equation: 1/f = 1/d_o + 1/d_i relating focal length to object/image distances.
- Interference: Superposition of waves producing constructive/destructive patterns with path difference conditions.
- Diffraction: Bending of waves around obstacles with characteristic patterns from aperture size.
- Polarization: Orientation of electric field vector with states (linear, circular, elliptical).
- Fresnel Equations: Reflectivity and transmittivity at interfaces for different polarizations.
- Gaussian Beams: Fundamental laser mode with waist, Rayleigh range, and beam radius.
- Nonlinear Optics: Intensity-dependent phenomena including second/third harmonic generation.
- Coherence: Temporal and spatial coherence determining interference visibility.
- ABCD Matrices: Ray transfer matrices for analyzing optical systems.
Code Examples
Geometrical Optics
import numpy as np
def snell_refraction(n1, n2, theta1):
"""Snell's law: n1*sin(theta1) = n2*sin(theta2)"""
sin_theta2 = (n1 / n2) * np.sin(theta1)
if abs(sin_theta2) > 1:
return None
return np.arcsin(sin_theta2)
def critical_angle(n1, n2):
"""θ_c = arcsin(n2/n1) for n1 > n2."""
if n1 <= n2:
return None
return np.arcsin(n2 / n1)
def brewster_angle(n1, n2):
"""θ_B = arctan(n2/n1) for p-polarization zero reflection."""
return np.arctan(n2 / n1)
def thin_lens(f, d_o):
"""1/f = 1/d_o + 1/d_i"""
return 1 / f - 1 / d_o
def lensmaker_equation(R1, R2, n, d):
"""1/f = (n-1)[1/R1 - 1/R2 + (n-1)d/(nR1R2)]"""
return (n - 1) * (1/R1 - 1/R2 + (n-1)*d/(n*R1*R2))
def lensmaker_thin(R1, R2, n):
"""Thin lens approximation."""
return (n - 1) * (/R1 - /R2)
n_air, n_glass = ,
theta_i = * np.pi /
()
theta_t = snell_refraction(n_air, n_glass, theta_i)
()
theta_c = critical_angle(n_glass, n_air)
()
()
theta_B = brewster_angle(n_air, n_glass)
()
f =
d_o =
d_i = / (/f - /d_o)
magnification = -d_i / d_o
()
()
()
n =
R1, R2 = , -
f_designed = / lensmaker_thin(R1, R2, n)
()
()
Wave Optics and Interference
import numpy as np
def path_difference(d, theta, wavelength):
"""δ = d sin(θ) for double slit."""
return d * np.sin(theta)
def constructive_interference(m, wavelength, d=None, theta=None):
"""Constructive: δ = mλ (m = 0, 1, 2, ...)"""
if theta is not None:
return m * wavelength / np.sin(theta)
return m * wavelength
def destructive_interference(m, wavelength, d=None, theta=None):
"""Destructive: δ = (m + 1/2)λ"""
return (m + 0.5) * wavelength
def fringe_spacing(wavelength, d, L):
"""Δy = λL/d for small angles."""
return wavelength * L / d
def thin_film_interference(n_film, n_air, n_substrate, wavelength, m, d):
"""
Thin film interference.
Constructive: 2n d = (m + 1/2)λ (hard reflection)
Destructive: 2n d = mλ (soft reflection)
"""
return None
def diffraction_angle(a, m, wavelength):
"""Minima in single slit: a sin(θ) = mλ"""
return np.arcsin(m * wavelength / a)
def ():
* wavelength / D
wavelength =
d =
L =
()
()
()
m (-, ):
m != :
theta = np.arcsin(m * wavelength / d)
()
a =
()
()
m (-, ):
m != :
theta = diffraction_angle(a, m, wavelength)
()
D =
theta_res = * wavelength / D
()
()
():
np.pi * np.sqrt(F) / ( - F)
():
FSR / finesse
FSR =
finesse =
delta_lambda = FSR / finesse
()
()
()
()
Polarization
import numpy as np
def polarization_ellipse(Ex, Ey, phi, t):
"""Calculate polarization ellipse components."""
return np.array([Ex * np.cos(wavelength), Ey * np.cos(wavelength + phi)])
def brewster_reflection(s, p):
"""Reflectivity for s and p polarizations."""
pass
def malus_law(I0, theta):
"""I = I0 cos²θ after polarizer."""
return I0 * np.cos(theta)**2
def fresnel_coefficients(n1, n2, theta_i):
"""r_s = (n1 cosθi - n2 cosθt)/(n1 cosθi + n2 cosθt)"""
theta_t = snell_refraction(n1, n2, theta_i)
if theta_t is None:
return None, None
cos_i, cos_t = np.cos(theta_i), np.cos(theta_t)
r_s = (n1 * cos_i - n2 * cos_t) / (n1 * cos_i + n2 * cos_t)
r_p = (n2 * cos_i - n1 * cos_t) / (n2 * cos_i + n1 * cos_t)
return r_s, r_p
def birefringence_delta(n_e, n_o, d):
"""Optical path difference in birefringent crystal."""
return (n_e - n_o) * d
def half_wave_plate_retardation(d, n_o, n_e):
"""δ = 2π(n_e - n_o)d/λ"""
return 2 * np.pi * (n_e - n_o) * d
n1, n2 = 1.0, 1.5
theta_i = * np.pi /
r_s, r_p = fresnel_coefficients(n1, n2, theta_i)
R_s = (r_s)**
R_p = (r_p)**
()
()
()
I0 =
theta_deg [, , , , ]:
I = malus_law(I0, theta_deg * np.pi / )
()
n_o =
n_e =
d =
delta_n = n_e - n_o
OPD = birefringence_delta(n_e, n_o, d)
()
()
()
lambda_ =
lambda_quarter = lambda_ /
d_quarter = lambda_quarter / (delta_n)
()
Gaussian Beams
import numpy as np
def gaussian_beam_radius(w0, lambda_, z):
"""w(z) = w0 * sqrt(1 + (z/z_R)²)"""
z_R = np.pi * w0**2 / lambda_
return w0 * np.sqrt(1 + (z / z_R)**2)
def rayleigh_range(w0, lambda_):
"""z_R = πw0²/λ"""
return np.pi * w0**2 / lambda_
def beam_waist(wavelength, divergence_angle):
"""w0 = λ/(πθ)"""
return wavelength / (np.pi * divergence_angle)
def gouy_phase(z, lambda_):
"""ψ(z) = arctan(z/z_R)"""
z_R = rayleigh_range(wavelength, lambda_)
return np.arctan(z / z_R)
def m_squared(divergence_measured, divergence_diffraction):
"""M² = θ_measured/θ_diffraction"""
return divergence_measured / divergence_diffraction
lambda_heNe = 632.8e-9
w0 = 0.5e-3
z_R = rayleigh_range(w0, lambda_heNe)
print("Gaussian beam (HeNe, w0=0.5mm):")
print(f" Rayleigh range: {z_R*1e3:.1f} mm")
for z in [0, z_R, 2*z_R, *z_R, *z_R]:
w = gaussian_beam_radius(w0, lambda_heNe, z)
()
w_at_inf = gaussian_beam_radius(w0, lambda_heNe, )
divergence = w_at_inf /
()
()
lambda_YAG =
P =
w0_high =
z_R_high = rayleigh_range(w0_high, lambda_YAG)
()
()
()
Laser Physics
import numpy as np
def gain_bandwidth(g0, delta_nu, nu0):
"""g(ν) = g0 / (1 + (ν-ν0)²/δν²)"""
return None
def cavity_mode_spacing(c, L, n=1):
"""Δν = c/(2nL) for Fabry-Perot cavity."""
return c / (2 * n * L)
def threshold_gain(alpha_i, R):
"""g_th = α_i + (1/2L) ln(1/R)"""
return alpha_i + np.log(1/np.sqrt(R)) / L
def output_coupling(T, R1, R2):
"""T = 1 - R1 for input coupler."""
return 1 - R1
def laser_power(P_pump, eta_slope, P_thresh):
"""P_out = η_slope(P_pump - P_thresh)"""
return max(0, eta_slope * (P_pump - P_thresh))
def wavelength_to_frequency(wavelength):
"""ν = c/λ"""
return 3e8 / wavelength
def frequency_stability(delta_nu, nu0):
"""Δν/ν for stability."""
return delta_nu / nu0
L = 0.3
R1, R2 = ,
nu_spacing = cavity_mode_spacing(, L)
()
()
()
()
alpha_i =
L_cavity =
g_th = threshold_gain(alpha_i, np.sqrt(R1*R2))
()
lambda_NdYAG =
P_pump =
eta_slope =
P_thresh =
P_out = laser_power(P_pump, eta_slope, P_thresh)
()
()
()
()
():
Best Practices
- Use Jones calculus for systematic analysis of polarization transformations through optical systems.
- Account for chromatic dispersion in lens design by specifying wavelength range.
- For interferometers, maintain path length stability within wavelengths for good visibility.
- Consider apodization and phase masks for optimizing diffraction-limited performance.
- When designing laser cavities, verify stability criterion 0 < g₁g₂ < 1.
- Account for thermal lensing effects in high-power laser systems.
- For thin film coatings, use transfer matrix method for accurate reflectance predictions.
- Consider atmospheric effects (turbulence, absorption) for free-space optical communication.
- Use spatial filtering for improving beam quality in Gaussian beam optics.
- Validate optical designs with ray tracing and wave propagation calculations.