Skip to content

Improve documentation and user interface of Fourier series #23672

Closed
@egourgoulhon

Description

@egourgoulhon

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 SN(x) but SN-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)

CC: @wdjoyner

Component: documentation

Keywords: Fourier series, piecewise functions

Author: Eric Gourgoulhon

Branch/Commit: 8cb8a4d

Reviewer: Richard L Lozes

Issue created by migration from https://trac.sagemath.org/ticket/23672

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions