fourier_series(f, limits, finite) is the Fourier series of f over
limits = list(x, a, b) (default list(x, -pi, pi)). Trigonometric
polynomials give a FiniteFourierSeries. Use truncate() for the first
n nonzero terms, sigma_approximation() for the Lanczos smoothed sum,
and shift(), shiftx(), scale(s, k), scalex() to transform the series
as SymPy does; + and - add series with the same period.
Arguments
- f
An expression.
- limits
list(x, a, b)orlist(a, b).- finite
Detect trigonometric polynomials.
- n
Number of terms;
NULLintruncate()returns all terms of a finite series.- ...
Unused.
- s, x, con
A Fourier series (
confortruncate(),xforscale()).- k
The shift or scale amount.
- center
The factor for
scale(s, k)(the second argument of thebase::scale()generic).- scale
Ignored; part of the
base::scale()generic.
Examples
x <- Symbol("x")
s <- fourier_series(x^2, list(x, -pi, pi))
truncate(s, 4)
#> -39.4784176043574*cos(0.318309886183791*pi*x)/pi^2 + 9.86960440108936*cos(0.636619772367581*pi*x)/pi^2 - 4.3864908449286*cos(0.954929658551372*pi*x)/pi^2 + 3.28986813369645
# \donttest{
fourier_series(sin(x)^2)
#> FiniteFourierSeries(sin(x)^2, (x, -pi, pi), (1/2, {2: -1/2}, {}))
# }