13
$\begingroup$

Bug introduced in 7.0.1 or earlier and persisting through 11.1


I am using version 10.0 with Apple OS X. Consider the following.

f[t_]:=1/(1+25.0*(t-0.3)^2);
Plot[f[t],{t,-1,1}]

enter image description here

Below FourierSeries retruns the wrong series.

WrongSeries[t_]=Chop@Expand@ExpToTrig@FourierSeries[
f[t],t,4,FourierParameters->{1,\[Pi]}];
Plot[WrongSeries[t],{t,-1,1},
PlotLabel->Style["The Wrong Truncated Fourier Series",14,Bold]]

enter image description here

Does Version 11 also have this problem?

-----EDIT-----

I can derive the right series using a combination of FourierCosSeries and FourierSinSeries.

RightSeries[t_]=Expand[(
FourierCosSeries[f[t]+f[-t],t,4,FourierParameters->{1,\[Pi]}]+
FourierSinSeries[f[t]-f[-t],t,7,FourierParameters->{1,\[Pi]}])/2
];
Plot[{f[t],RightSeries[t]},{t,-1,1},
PlotLegends->{"g[t]","Truncated Fourier Series"}]

enter image description here

$\endgroup$
5
  • $\begingroup$ Hi; I run 11.0 on linux and I get that too. $\endgroup$
    – bobbym
    Commented Mar 11, 2017 at 19:24
  • $\begingroup$ Same with 11.0 on Windows. Image $\endgroup$
    – jjc385
    Commented Mar 11, 2017 at 19:28
  • 1
    $\begingroup$ Sadly, the same bug even with version 7.0.1 on Win7x64. $\endgroup$
    – innaiz
    Commented Mar 13, 2017 at 22:08
  • $\begingroup$ I can confirm that the bug is present in MMA 11.1.0. $\endgroup$
    – user58955
    Commented Mar 23, 2017 at 17:48
  • $\begingroup$ The same issue in version 12.1 on Linux. $\endgroup$
    – user64494
    Commented May 19, 2020 at 5:19

1 Answer 1

11
$\begingroup$

This is a bug in FourierSeries, and appears to be caused by the default setting GenerateConditions -> False which is used while computing the underlying integrals.

A workaround for the problem is to use GenerateConditions -> True, as shown below.

f[t_] := 1/(1 + 25.0 * (t - 0.3)^2);
FSeries[t_] = Chop @ Expand @ ExpToTrig @ FourierSeries[f[t], t, 4,
    FourierParameters -> {1, Pi}, GenerateConditions -> True];

plot

Thank your for reporting this issue, and sorry for the inconvenience.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.