Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #23672: Improve documentation and user interface of Fourier series
As discussed in https://groups.google.com/forum/#!topic/sage- devel/b1pWen3lrKA, the documentation of Fourier series as implemented in piecewise-defined functions needs some improvement. This ticket provides it, as well as a simplification of the user interface: the half-period is now an optional argument; if not provided, it is inferred from the domain of the piecewise-defined function: {{{ sage: f = piecewise([((0, 2*pi), cos(x))]) sage: f.fourier_series_cosine_coefficient(1) # results in TypeError in Sage 8.0 1 sage: f.fourier_series_cosine_coefficient(1, pi) # compatible with Sage 8.0 1 }}} The ticket also corrects two bugs: - computation of Fourier coefficients when the domain width does not coincide with the period: {{{ sage: f = piecewise([((0, 4*pi), cos(x))]) sage: f.fourier_series_cosine_coefficient(1, pi) # yields 2 in Sage 8.0 1 }}} - despite what it claimed, the method `fourier_series_partial_sum` did not return ''S,,N,,(x)'' but ''S,,N-1,,(x)'' (this is because the summation was governed by `srange(1, N)` instead of `srange(1, N+1)`); we have now {{{ sage: f = piecewise([((0, 2*pi), cos(x))]) sage: f.fourier_series_partial_sum(1, pi) # yields 0 in Sage 8.0 cos(x) }}} URL: https://trac.sagemath.org/23672 Reported by: egourgoulhon Ticket author(s): Eric Gourgoulhon Reviewer(s): Richard L Lozes
- Loading branch information