# Assumptions for FourierSeries

I want to calculate the Fourier series of the following function.

$$u(t)=\left\{\begin{array}{lc}0, & -\frac{T}{2} \leqslant t<-\frac{\tau}{2} \\ h, & -\frac{\tau}{2} \leqslant t<\frac{\tau}{2} \\ 0, & \frac{\tau}{2} \leqslant t<\frac{T}{2}\end{array}\right.$$

The result should be

$$u(t)=\frac{h \tau}{T}+\frac{h}{\pi} \sum_{\substack{n=-\infty \\ n \neq 0}}^{\infty} \frac{1}{n} \sin \frac{n \pi \tau}{T} \mathrm{e}^{\frac{2 n \pi t}{T} \mathrm{i}}$$

Before calculation, the parameters have been assumed to be positive real numbers.

Clear["Global*"]
$Assumptions = n \[Element] Integers && n >= 0 && T > 0 && \[Tau] > 0 && T > \[Tau] && h > 0; u[t_] := Piecewise[{{0, -T/2 <= t < -\[Tau]/2}, {h, -\[Tau]/2 <= t < \[Tau]/2}, {0, \[Tau]/2 <= t < T/2}}]; sol = FourierSeries[u[t], t, 3, FourierParameters -> {1, 2 Pi/T}]  $$\left(\left[\begin{array}{ll}\frac{h \tau}{\text { Abs }[T]} & \tau>0 \& \& \tau0 \& \& \text { Abs }[T]>0 \& \& \tau \geq A b s[T] \\ 0 & \text { True }\end{array}\right)+\right.$$....(Too complicated) However, the assumption doesn't seem to work for the calculation of Fourier series. The results of Fourier series are still very complex. Can the results be simplified under the assumption of positive real numbers of these parameters? How to achieve it? ## 2 Answers Remove $Assumptions=... and try

sol = FourierSeries[u[t], t, 3, FourierParameters -> {1, 2 Pi/T}] // Simplify[#, {h > 0, T > \[Tau] > 0}] &
sol // ExpToTrig // ComplexExpand // Simplify
(*(h (6 \[Pi] \[Tau] - 2 T Sin[(\[Pi] (6 t - 3 \[Tau]))/T] -
3 T Sin[(\[Pi] (4 t - 2 \[Tau]))/T] -
6 T Sin[(\[Pi] (2 t - \[Tau]))/T] +
6 T Sin[(\[Pi] (2 t + \[Tau]))/T] +
3 T Sin[(2 \[Pi] (2 t + \[Tau]))/T] +
2 T Sin[(3 \[Pi] (2 t + \[Tau]))/T]))/(6 \[Pi] T)*)

• Wow, great! Thank you. Mar 22, 2022 at 14:24

sometimes global \$Assumptions are not used for some reason. However, using them directly in the call itself does work:

Clear["Global*"]
assume = T > 0 && tau > 0 && T > tau && h > 0;
u[t_] := Piecewise[{{0, -T/2 <= t < -tau/2}, {h, -tau/2 <= t <
tau/2}, {0, tau/2 <= t < T/2}}]

sol = FourierSeries[u[t], t, 3, FourierParameters -> {1, 2 Pi/T},
Assumptions -> assume]


To convert to trig do

ExpToTrig[sol]


• The result is perfect! Thank you! Mar 22, 2022 at 14:35