Re: Bug in the FourierSinCoefficient function

• To: mathgroup at smc.vnet.net
• Subject: [mg85404] Re: [mg85340] Bug in the FourierSinCoefficient function
• Date: Sat, 9 Feb 2008 04:16:56 -0500 (EST)
• References: <200802061136.GAA07063@smc.vnet.net>

```On Wed, 6 Feb 2008, Pianiel wrote:

> Dear Mathematica experts,
>
> In Mathematica 6.0 when I type
>
> << FourierSeries`
>
> FourierSinCoefficient[Sin[2 \[Pi] t], t, n]
> FourierSinCoefficient[Sin[2 \[Pi] t], t, 1]
>
> The first line gives 0.
> and the second gives 1.
>
> Do you know if Wolfram Research will solve this bug soon?
>
> Mathematica is such a great program...
>
> Sincerely
>
> Pianiel
>

Hello,

Thank you for reporting the problem with using symbolic 'n' in the
above FourierSinCoefficient example.

The FourierSinCoefficient is computed using symbolic integration, and the
incorrect result (for n = 1) occurs when the assumption that 'n' is an
integer is specified in the call to Integrate. Hence, a partial workaround
for the problem is  to use Integrate directly, without assumptions, and to
find the limiting value of the answer for n = 1, as shown below.

==========================

In[1]:= \$Version

Out[1]= 6.0 for Linux x86 (32-bit) (June 28, 2007)

In[2]:= 2*Integrate[ Sin[2*Pi*t]*Sin[2*n*Pi*t], {t, -1/2, 1/2}]

2 Sin[n Pi]
Out[2]= -----------
2
Pi - n  Pi

In[3]:= Limit[%, n -> 1]

Out[3]= 1

In[4]:=  Table[%%, {n, 2, 10}]

Out[4]= {0, 0, 0, 0, 0, 0, 0, 0, 0}

In[5]:= <<FourierSeries`

In[6]:= Table[FourierSinCoefficient[Sin[2*Pi*t], t, n], {n, 1, 10}]

Out[6]= {1, 0, 0, 0, 0, 0, 0, 0, 0, 0}

=======================

We apologize for the confusion caused by this problem.

Sincerely,