Mode of #cas
fourierSin
The coefficients of the sine series on [0, L] as exact functions of n, with a theorem about the integrals.
#cas [fourierSin x n L] fThe sine series on is the one that comes up for a vibrating string with fixed ends, and fourierSin computes its coefficients. The series is , and the theorem is about Mathlib’s interval integrals over , one for every .
Each term of f is integrated by parts, and gives the factors you see in the result. For the cosine series on the same interval, use fourierCos, and for the full series on , use fourier.
Examples (9)#
Basic Examples (2)
The sine series of on , with the theorem for every . The coefficients for even are 0:
#cas [fourierSin x n pi] (x * (pi - x))
sine series coefficients
bₙ = 4*(1 - (-1)^n)/(n^3*pi)- Domain
x ∈ [0, pi], n ≥ 1
Checked by Lean’s kernel: The sine coefficients on [0, L]
∀ (n : ℕ), 0 < n → 2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, x * (Real.pi - x) * Real.sin (↑n * x) = 4 * (1 - (-1) ^ n) / (↑n ^ 3 * Real.pi)
The certificate: 1 checked step
The sine coefficients on [0, L]
∀ (n : ℕ), 0 < n → 2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, x * (Real.pi - x) * Real.sin (↑n * x) = 4 * (1 - (-1) ^ n) / (↑n ^ 3 * Real.pi)
The sine series of on :
#cas [fourierSin x n 1] (x)
sine series coefficients
bₙ = 2*(-1)^(n + 1)/(n*pi)- Domain
x ∈ [0, 1], n ≥ 1
Checked by Lean’s kernel: The sine coefficients on [0, L]
∀ (n : ℕ), 0 < n → 2 * ∫ (x : ℝ) in 0..1, x * Real.sin (↑n * Real.pi * x) = 2 * (-1) ^ (n + 1) / (↑n * Real.pi)
The certificate: 1 checked step
The sine coefficients on [0, L]
∀ (n : ℕ), 0 < n → 2 * ∫ (x : ℝ) in 0..1, x * Real.sin (↑n * Real.pi * x) = 2 * (-1) ^ (n + 1) / (↑n * Real.pi)
Scope (1)
An exponential. The coefficients contain :
#cas [fourierSin x n pi] (exp x)
sine series coefficients
bₙ = 2*n*(1 - (-1)^n*exp(pi))/(pi*(n^2 + 1))- Domain
x ∈ [0, pi], n ≥ 1
Checked by Lean’s kernel: The sine coefficients on [0, L]
∀ (n : ℕ), 0 < n → 2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, Real.exp x * Real.sin (↑n * x) = 2 * ↑n * (1 - (-1) ^ n * Real.exp Real.pi) / (Real.pi * (↑n ^ 2 + 1))
The certificate: 1 checked step
The sine coefficients on [0, L]
∀ (n : ℕ), 0 < n → 2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, Real.exp x * Real.sin (↑n * x) = 2 * ↑n * (1 - (-1) ^ n * Real.exp Real.pi) / (Real.pi * (↑n ^ 2 + 1))
Applications (1)
The integral behind of , in a proof. cas proves it, and only the three standard axioms are used:
theorem fourierSin_b_one : ∫ x in (0 : ℝ)..Real.pi, x * (Real.pi - x) * Real.sin x = 4 := by cas #print axioms fourierSin_b_one
fourierSin_b_one depends on the axioms propext, Classical.choice, Quot.sound.
Properties and Relations (2)
The sine series on is the Fourier series on of the odd extension of f. For the odd function , the sine series has the coefficients that fourier gives, times those on above:
#cas [fourier x n] (x)
Fourier coefficients
a₀ = 0, aₙ = 0, bₙ = 2*(-1)^(n + 1)/n- Domain
x ∈ [-π, π], n ≥ 1
Checked by Lean’s kernel: The Fourier coefficients on [-π, π], by integration by parts
1 / Real.pi * ∫ (x : ℝ) in -Real.pi..Real.pi, x = 0 ∧ (∀ (n : ℕ), 0 < n → 1 / Real.pi * ∫ (x : ℝ) in -Real.pi..Real.pi, x * Real.cos (↑n * x) = 0) ∧ ∀ (n : ℕ), 0 < n → 1 / Real.pi * ∫ (x : ℝ) in -Real.pi..Real.pi, x * Real.sin (↑n * x) = 2 * (-1) ^ (n + 1) / ↑n
The certificate: 1 checked step
The Fourier coefficients on [-π, π], by integration by parts
1 / Real.pi * ∫ (x : ℝ) in -Real.pi..Real.pi, x = 0 ∧ (∀ (n : ℕ), 0 < n → 1 / Real.pi * ∫ (x : ℝ) in -Real.pi..Real.pi, x * Real.cos (↑n * x) = 0) ∧ ∀ (n : ℕ), 0 < n → 1 / Real.pi * ∫ (x : ℝ) in -Real.pi..Real.pi, x * Real.sin (↑n * x) = 2 * (-1) ^ (n + 1) / ↑n
The cosine series of decays more slowly than its sine series. The even extension to has corners, and is of order . The odd extension has a continuous derivative, and above is of order :
#cas [fourierCos x n pi] (x * (pi - x))
cosine series coefficients
a₀ = 1/3*pi^2, aₙ = -(2*(1 + (-1)^n)/n^2)- Domain
x ∈ [0, pi], n ≥ 1
Checked by Lean’s kernel: The cosine coefficients on [0, L]
2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, x * (Real.pi - x) = 1 / 3 * Real.pi ^ 2 ∧ ∀ (n : ℕ), 0 < n → 2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, x * (Real.pi - x) * Real.cos (↑n * x) = -(2 * (1 + (-1) ^ n)) / ↑n ^ 2
The certificate: 1 checked step
The cosine coefficients on [0, L]
2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, x * (Real.pi - x) = 1 / 3 * Real.pi ^ 2 ∧ ∀ (n : ℕ), 0 < n → 2 / Real.pi * ∫ (x : ℝ) in 0..Real.pi, x * (Real.pi - x) * Real.cos (↑n * x) = -(2 * (1 + (-1) ^ n)) / ↑n ^ 2
Possible Issues (3)
The length must be positive:
#cas [fourierSin x n 0] (x)
Error
fourierSin: L must be positive
The length is a positive rational number or a positive rational multiple of , such as 2 * pi / 3:
#cas [fourierSin x n (sqrt 2)] (x)
Error
fourierSin: L must be a positive rational number or a rational multiple of π
Other functions are refused on , here . fourier takes sines and cosines with integer frequencies on :
#cas [fourierSin x n pi] (exp (x ^ 2))
Error
fourierSin: on [0, L] the function must be a sum of terms c x ^ j e ^ (a x)
