Understanding Delta Function Approximations: Lorentzian, Gaussian, and Sinc Compared
- Get link
- X
- Other Apps
Delta-Convergent Sequences — Refined Blog with SageMath Symbolics, Physics Insights, and Cleaner Code
In the previous blog, we understood the Lorentzian Delta Sequence (Cauchy Kernel) , Gaussian Approximation (Heat Kernel) and Sinc Delta Sequence. Let's take another one step and explore the Understanding Delta Function Approximations: Lorentzian, Gaussian, and Sinc Compared.
Why Study These Approximations?
Delta functions are central in many fields:
- Signal Processing: Ideal impulse, filter response
- Physics: Point charges/masses, Green's functions
- Spectral Theory: Lorentzian profiles in resonance
- Diffusion Models: Gaussians arise from the heat equation
- Numerics: Regularizing singular integrals
Each kernel has a story to tell.
Comparison of Delta Function Approximations
Feature | Lorentzian | Gaussian | Sinc |
---|---|---|---|
Definition | \( \frac{\epsilon}{\pi(x^2 + \epsilon^2)} \) | \( \frac{1}{2\sqrt{\pi t}} e^{-x^2 / 4t} \) | \( \frac{\sin(\nu x)}{\pi x} \) |
Smoothness | Fully smooth | Fully smooth | Oscillatory, discontinuous at \( x=0 \) |
Decay Rate | Slow (\( \sim 1/x^2 \)) | Fast (Exponential) | Oscillatory (\( \sim 1/x \)) |
Integral Convergence | Approaches 1 | Approaches 1 | Approaches 1 |
Use Cases | Spectral lines, resonance | Heat diffusion, probability | Signal processing, sampling |
Comparative Visualization
import numpy as np
import matplotlib.pyplot as plt
# Define function representations
def f_lorentz(x, epsilon):
return (epsilon / (x**2 + epsilon**2)) / np.pi
def f_gauss(x, t):
return (1/(2*np.sqrt(np.pi*t))) * np.exp(-x**2 / (4*t))
def f_sinc(x, nu):
return np.sinc(nu*x/np.pi) / np.pi
# Generate values
x_vals = np.linspace(-5, 5, 100)
lorentz_vals = [f_lorentz(x, 0.1) for x in x_vals]
gauss_vals = [f_gauss(x, 0.1) for x in x_vals]
sinc_vals = [f_sinc(x, 30) for x in x_vals]
# Plot with matplotlib
plt.figure(figsize=(8, 5))
plt.plot(x_vals, lorentz_vals, color="red", label="Lorentzian")
plt.plot(x_vals, gauss_vals, color="blue", label="Gaussian")
plt.plot(x_vals, sinc_vals, color="green", label="Sinc")
plt.xlabel(r"$x$")
plt.ylabel(r"$f(x)$")
plt.title("Comparison of Delta Function Approximations")
plt.legend()
plt.grid(True)
plt.show()
π‘ Try It Yourself! Now You can copy and paste directly into here Run SageMath Code Here
Comparative Numerical Visualization
import numpy as np
from scipy.integrate import quad
# Define numerical integral for Lorentzian, Gaussian, and Sinc
def lorentzian_integral(epsilon, x):
return quad(lambda xi: (epsilon / (xi**2 + epsilon**2)) / np.pi, -1, x)[0]
def gaussian_integral(t, x):
return quad(lambda xi: (1/(2*np.sqrt(np.pi*t))) * np.exp(-xi**2 / (4*t)), -1, x)[0]
def sinc_integral(nu, x):
return quad(lambda xi: np.sin(nu*xi) / (np.pi*xi), -100, x)[0]
# Computations
lorentzian_integral(0.01, 5),gaussian_integral(0.01, 5),sinc_integral(30, 5)
π‘ Try It Yourself! Now You can copy and paste directly into here Run SageMath Code Here
These numerical results indicate that your integral approximations for the Lorentzian, Gaussian, and Sinc functions are very close to 1, aligning with the expected normalization property of delta-like functions.
- Lorentzian Integral: ≈ 0.9962 (Smooth decay, heavy tails)
- Gaussian Integral: ≈ 0.9999 (Fast exponential decay)
- Sinc Integral: ≈ 0.9962 (Oscillatory behavior before settling)
Now that the integral functions are correctly defined, let's proceed with the visualization.
Generate Data for the Plot
import numpy as np
import matplotlib.pyplot as plt
# Define x values for visualization
x_vals = np.linspace(-5, 5, 100)
# Compute integral values numerically
lorentz_vals = [lorentzian_integral(0.01, x) for x in x_vals]
gauss_vals = [gaussian_integral(0.01, x) for x in x_vals]
sinc_vals = [sinc_integral(30, x) for x in x_vals]
# Define Heaviside function for reference
def heaviside(x):
return np.where(x >= 0, 1, 0)
heaviside_vals = heaviside(x_vals)
Plot the Step Function Transition
plt.figure(figsize=(8, 5))
plt.plot(x_vals, lorentz_vals, color="purple", label="Lorentzian Step")
plt.plot(x_vals, gauss_vals, color="blue", label="Gaussian Step")
plt.plot(x_vals, sinc_vals, color="green", label="Sinc Step")
plt.plot(x_vals, heaviside_vals, color="black", linestyle="--", label="Heaviside (True Step)")
plt.xlabel(r"$x$")
plt.ylabel(r"Integral Value")
plt.title("Transition from Delta Approximation to Heaviside Step")
plt.legend()
plt.grid(True)
plt.show()
π‘ Try It Yourself! Now You can copy and paste directly into here Run SageMath Code Here
If \( f_{\nu}(x) \) is a delta-convergent sequence (approximating \( \delta(x) \)), then its integral: \[ F_{\nu}(x) = \int f_{\nu}(\xi) d\xi \] approximates the Heaviside step function \( \theta(x) \). Different delta approximations (Lorentzian, Gaussian, Sinc) produce slightly different "smoothings" or approximations of the sharp step, with the Sinc function's integral notably showing ringing artifacts.
Let's explore the Fourier transform to see how these delta approximations behave in the frequency domain.
Define the Fourier Transforms
Since delta-like functions interact directly with Fourier theory, we compute their transforms:
\[ \mathcal{F}[f_{\epsilon}(x)] = e^{-\epsilon |\omega|} \]
\[ \mathcal{F}[f_t(x)] = e^{-t\omega^2} \]
\[ \mathcal{F}[f_{\nu}(x)] = \text{rect} \left(\frac{\omega}{2\nu} \right) \]
# Run this code in Python environment and see what it show?
import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import fft, fftfreq
# Improved resolution
dx = 0.005 # Smaller step for higher detail
N = 4096 # More points for finer spectral resolution
x_vals = np.linspace(-N*dx/2, N*dx/2, N)
freqs = fftfreq(N, dx)
# Define function samples
lorentz_samples = np.exp(-0.1 * np.abs(x_vals))
gauss_samples = np.exp(-0.1 * x_vals**2)
sinc_samples = np.sinc(x_vals / np.pi)
# Compute Fourier Transforms
lorentz_fft = fft(lorentz_samples)
gauss_fft = fft(gauss_samples)
sinc_fft = fft(sinc_samples)
# Zoom in on ultra-low-frequency details
plt.figure(figsize=(8, 5))
plt.xlim(-0.3, 0.3) # Tighter zoom for more clarity
plt.plot(freqs, np.abs(lorentz_fft), color='purple', label="Lorentzian FT")
plt.plot(freqs, np.abs(gauss_fft), color='blue', label="Gaussian FT")
plt.plot(freqs, np.abs(sinc_fft), color='green', label="Sinc FT")
plt.xlabel("Frequency")
plt.ylabel("Magnitude")
plt.title("Ultra-Zoomed Fourier Transform of Delta Approximations")
plt.legend()
plt.grid(True)
plt.show()
Coming Up Next: In the upcoming blog, we’ll dive into differential equations involving generalized functions. Stay with me as we take one thoughtful step from pure theory toward powerful computational insights.
- Get link
- X
- Other Apps
Comments
Post a Comment
If you have any queries, do not hesitate to reach out.
Unsure about something? Ask away—I’m here for you!