Test Functions and Schwartz Space Explained – ๐ ⊂ ๐ข, with SageMath & SymPy!
- Get link
- X
- Other Apps
Test Functions and Schwartz Space Explained – ๐ ⊂ ๐ข, with SageMath & SymPy!
Function Space Clubs: Who Belongs Where?
In mathematical analysis, we often group functions into "spaces" based on their behavior—how smooth they are, how fast they vanish at infinity, and how well-behaved they are under transformations like Fourier analysis.
๐ – The Compact Support Crew
- Infinitely differentiable
- Supported within a finite interval
- Vanishes outside a compact set
Think: A smooth “bump” function that’s perfectly zero beyond a certain region.
SageMath/SymPy Example:
import sympy
x = sympy.Symbol('x')
def k_function(x_val):
if -1 <= x_val <= 1:
return sympy.exp(-1 / (1 - x_val**2)) # Smooth bump
else:
return 0
๐ข – The Schwartz Space Superstars
- Infinitely differentiable
- All derivatives decay faster than any polynomial as ∣๐ฅ∣→∞ \[ \phi(x) = e^{-x^2} \in \mathcal{S} \]
Gaussian functions are prime examples. They vanish "faster than fast"—ideal for signal processing, quantum mechanics, and PDEs.
๐ข′ – The Dual Space (Tempered Distributions)
- Contains linear functionals acting on ๐
- Includes generalized functions like Dirac delta, and integration functionals
Think: A smooth “bump” function that’s perfectly zero beyond a certain region.
SageMath/SymPy Example:
# Example functional acting on ๐ข
T(ฯ) = ∫ g(x) * ฯ(x) dx
# g can grow polynomially
Function Space Comparison
Function Space | Properties | Decay Behavior |
---|---|---|
๐ (Compact Support) | Infinitely differentiable, finite support | Zero outside a bounded interval |
๐ข (Schwartz Space) | Infinitely differentiable, all derivatives decay fast | Faster than any polynomial as \( |x| \to \infty \) |
๐ข′ (Dual of ๐ข) | Linear functionals on ๐ข | Includes Dirac delta, polynomial-growth integrals |
Visualizing the Gaussian Decay in ๐ข
Let’s plot \[ \phi(x) = e^{-x^2} \],the prototypical Schwartz function.
import sympy
import matplotlib.pyplot as plt
import numpy as np
x = sympy.Symbol('x')
s_function = sympy.exp(-x**2)
f_lambdified = sympy.lambdify(x, s_function, 'numpy')
x_vals = np.linspace(-10, 10, 200)
y_vals = f_lambdified(x_vals)
plt.plot(x_vals, y_vals, label="e^(-x²)", color='blue')
plt.xlabel("x")
plt.ylabel("ฯ(x)")
plt.title("Decay Behavior of a Function in ๐ข")
plt.legend()
plt.grid(True)
plt.show()
Interactive Plot: This SageMathCell lets you explore how the Gaussian function ฯ(x) = e^(–x²) behaves. It's a classic Schwartz function with rapid decay.
๐ก Explore the Gaussian Decay Behavior:
Copy the code snippet from this post and paste it into the live SageMath cell here:
๐ Run SageMath Code Here
Plot Description: A symmetric, bell-shaped curve centered at x = 0. The function rapidly approaches zero as x moves away from the center, illustrating Schwartz space decay.
๐ ⊂ ๐ข – And ๐ is Dense in ๐ข
- Every ๐ function is also in ๐ข (compact support → rapid decay).
- Density: You can approximate any Schwartz function using smooth compact-supported functions.
Example Approximation:
\[ \phi_v(x) = \phi(x) \cdot \eta_v(x) \] Where:
- \( \eta_v(x)\) is a smooth function: \( \eta_v(x)=1 \) on [-v,v],decaying smoothly outside
- As \( v \to \infty, \quad \phi_v \to \phi \) in ๐ข
Real-World Applications of Schwartz Space
- Fourier Analysis: F(S)⊂S
- Quantum Mechanics: Gaussians model wave packets
- PDE Theory: Weak solutions often live in ๐ข′
Fun Fact: The Fourier transform of \( \phi(x) = e^{-x^2} \) is another Gaussian—this symmetry makes it beloved in physics and math.
Try It Yourself!
Example-1
import sympy
import numpy as np
import matplotlib.pyplot as plt
x = sympy.Symbol('x')
gaussian = sympy.exp(-x**2)
def smooth_cutoff(val, center, width):
if -width/2 <= val - center <= width/2:
return 1
elif -width <= val - center < -width/2:
return sympy.exp(-1 / (1 - ((val - center + 0.75*width) / (0.25*width))**2))
elif width/2 < val - center <= width:
return sympy.exp(-1 / (1 - ((val - center - 0.75*width) / (0.25*width))**2))
else:
return 0
widths = [1, 2, 3, 5]
plt.figure(figsize=(12, 8))
plt.plot(np.linspace(-6, 6, 400), [float(gaussian.subs(x, val)) for val in np.linspace(-6, 6, 400)], label='Gaussian', linestyle='--')
for w in widths:
cutoff_sym = smooth_cutoff(x, 0, w)
approximated_vals = [float((gaussian * cutoff_sym).subs(x, val)) for val in np.linspace(-6, 6, 400)]
plt.plot(np.linspace(-6, 6, 400), approximated_vals, label=f'Width = {w}')
plt.title('Approximating Gaussian with Smoothly Cut-off Functions')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.legend()
plt.grid(True)
plt.ylim(-0.1, 1.1)
plt.show()
๐ก Approximating Gaussian with Smoothly Cut-off Functions
Copy the code snippet from this post and paste it into the live SageMath cell here:
๐ Run SageMath Code Here
- Modify the Gaussian to \( e^{-x^4} \) or \( e^{-x^2}cos(x) \)
- Build your own compact-supported bump
- Test convergence using visual plots
- Explore the effect of Fourier transforms on these functions
Call to Action
Try implementing your own test function spaces in SageMath or SymPy!
Explore convergence, visual decay, or even Fourier transforms.
๐ฌ Comment below with your discoveries or any cool insights you uncover!
Would you like help embedding more interactive notebooks, exporting this as a Markdown blog, or building a PDF handout? Just say the word!
- 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!