spectral.fourier_diff_matrix_cotangent#

spectral.fourier_diff_matrix_cotangent(N: int) ndarray[source]#

Construct Fourier differentiation matrix using cotangent identity.

Computes the spectral differentiation matrix for periodic functions on an equispaced grid using the cotangent formula. The matrix entries are constructed directly without FFT operations.

Parameters:
Nint

Number of grid points

Returns:
np.ndarray

Fourier differentiation matrix of shape (N, N)

Notes

The diagonal entries are set to ensure that differentiating a constant function yields zero, which is enforced by requiring each row sum to be zero. This construction is exact for the Fourier collocation method on periodic domains.

References

Engsig-Karup, “Lecture 1: Fourier Methods” Kopriva (2009), “Implementing Spectral Methods for PDEs”