You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

区间0<x<L上完整傅里叶级数存在性及x²特定级数求解与绘图

Hey there! Let's break down your two questions step by step:

Question 1: Does a complete Fourier series exist on the interval 0 < x < L?

Absolutely, but we need to clarify what "complete" means here. Fourier series completeness depends on the orthogonal function basis we're using. For the boundary conditions you mentioned ($u'(0)=0$ and $u'(L)=0$), the corresponding orthogonal basis is a cosine-based Fourier series (a variant of the standard Fourier cosine series). This basis is complete on $[0, L]$ for functions that are piecewise smooth (a common regularity condition), meaning any such function can be expanded into a full, convergent Fourier series using these basis functions.

Question 2: Fourier series expansion of $x^2$ on 0 < x < L with $u'(0)=0$ and $u'(L)=0$, plus partial sum plots

Step 1: Identify the orthogonal basis functions

First, we solve the ODE $u'' + \lambda u = 0$ with boundary conditions $u'(0)=0$ and $u'(L)=0$ to find our basis:

  • For $\lambda=0$: The solution is the constant function $u_0(x) = 1$ (its derivative is zero everywhere, satisfying the boundaries)
  • For $\lambda > 0$: The solutions are $u_n(x) = \cos\left(\frac{n\pi x}{L}\right)$ for $n=1,2,3,...$ (the derivative $u_n'(x) = -\frac{n\pi}{L}\sin\left(\frac{n\pi x}{L}\right)$ is zero at $x=0$ and $x=L$)

Our Fourier series will take the form:
$$x^2 = \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n \cos\left(\frac{n\pi x}{L}\right)$$

Step 2: Calculate the Fourier coefficients

We use orthogonality to compute each coefficient:

  1. Coefficient $a_0$:
    $$a_0 = \frac{2}{L} \int_{0}^{L} x^2 dx$$
    Evaluating the integral: $\int_0^L x^2 dx = \frac{L^3}{3}$, so:
    $$a_0 = \frac{2}{L} \cdot \frac{L^3}{3} = \frac{2L^2}{3}$$

  2. Coefficients $a_n$ (for $n \geq 1$):
    $$a_n = \frac{2}{L} \int_{0}^{L} x^2 \cos\left(\frac{n\pi x}{L}\right) dx$$
    Using integration by parts twice, we end up with:
    $$a_n = \frac{2L^3 (-1)n}{n2 \pi^2}$$

Final Fourier Series

Substituting the coefficients back in, we get:
$$x^2 = \frac{L^2}{3} + \sum_{n=1}^{\infty} \frac{2L^3 (-1)n}{n2 \pi^2} \cos\left(\frac{n\pi x}{L}\right)$$

Step 3: Partial Sum Plots (1, 2, 3 terms)

Here's a Python script using matplotlib to plot the exact function and its partial sums. We'll set $L=2$ for concreteness:

import numpy as np
import matplotlib.pyplot as plt

# Define interval length
L = 2
# Generate x values across the interval
x = np.linspace(0, L, 1000)
# Exact function
y_exact = x ** 2

# Function to compute N-term partial sum
def compute_partial_sum(x, N, L):
    partial_sum = L ** 2 / 3  # Start with the a0/2 term
    for n in range(1, N+1):
        term = (2 * L ** 3 * (-1) ** n) / (n ** 2 * np.pi ** 2) * np.cos(n * np.pi * x / L)
        partial_sum += term
    return partial_sum

# Create subplots
fig, axs = plt.subplots(2, 2, figsize=(12, 8))

# Plot exact function
axs[0, 0].plot(x, y_exact, label='Exact $x^2$', color='black')
axs[0, 0].set_title('Exact Function')
axs[0, 0].legend()
axs[0, 0].grid(True)

# 1-term partial sum (only the constant term)
y_1term = compute_partial_sum(x, 0, L)
axs[0, 1].plot(x, y_1term, label='1-term Sum', color='#1f77b4')
axs[0, 1].plot(x, y_exact, label='Exact $x^2$', color='black', linestyle='--')
axs[0, 1].set_title('1-term Partial Sum')
axs[0, 1].legend()
axs[0, 1].grid(True)

# 2-term partial sum (constant + n=1 term)
y_2term = compute_partial_sum(x, 1, L)
axs[1, 0].plot(x, y_2term, label='2-term Sum', color='#ff7f0e')
axs[1, 0].plot(x, y_exact, label='Exact $x^2$', color='black', linestyle='--')
axs[1, 0].set_title('2-term Partial Sum')
axs[1, 0].legend()
axs[1, 0].grid(True)

# 3-term partial sum (constant + n=1 + n=2 terms)
y_3term = compute_partial_sum(x, 2, L)
axs[1, 1].plot(x, y_3term, label='3-term Sum', color='#2ca02c')
axs[1, 1].plot(x, y_exact, label='Exact $x^2$', color='black', linestyle='--')
axs[1, 1].set_title('3-term Partial Sum')
axs[1, 1].legend()
axs[1, 1].grid(True)

plt.tight_layout()
plt.show()

When you run this code, you'll see that as we add more terms to the partial sum, the approximation gets closer and closer to the exact $x^2$ function, which is exactly what we expect from a convergent Fourier series.


内容的提问来源于stack exchange,提问作者Ahmed Shaikh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:27:01