Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fourier series hp 49

7 views
Skip to first unread message

Martin Nielsen

unread,
Apr 5, 2001, 12:13:32 PM4/5/01
to
Hello

I’ am just started to learn about Fourier series.
My question is can my hp 49 develop Fourier series??

I know that hp 49 have a FOURIER command, but I cannot make it work. It
seems to give some thing with complex numbers. But this is not the way my
math book does. It does not come up with complex numbers.

Can anyone explain the different between the complex results and the real
results.

Does anyone know a program that can find ao, an and bn without complex
numbers, I have seen on hpcal.org, but the only programs I could find, is
for the hp 48.


Thanks
Martin


Martin Nielsen

unread,
Apr 7, 2001, 6:02:08 AM4/7/01
to

PLEASE

"Martin Nielsen" <***m.ni...@mail1.stofanet.dk> wrote in message
news:uP0z6.1269$76.1...@news101.telia.com...

Steen Schmidt

unread,
Apr 7, 2001, 9:35:48 AM4/7/01
to
Sorry to answer this late - I thought maybe BP would answer this....

> I' am just started to learn about Fourier series.
> My question is can my hp 49 develop Fourier series??

It can develop the complex coefficients of the series.

> I know that hp 49 have a FOURIER command, but I cannot make it work. It
> seems to give some thing with complex numbers. But this is not the way my
> math book does. It does not come up with complex numbers.
>
> Can anyone explain the different between the complex results and the real
> results.

The Fourier series you know is
'f(t)=1/2*A0+Sum(n=1,inf,An*cos(n*w*t))+Sum(n=1,inf,Bn*sin(n*w*t))',
where 'An=2/T*Integral(0,T,f(t)*cos(n*w*T),t)' and
'Bn=2/T*Integral(0,T,f(t)*sin(n*w*T),t)'

T is the period of 'f(t)'.

If you now use Euler to get
'f(t)=1/2*A0+Sum(n=1,inf,(An/2+Bn/2*i)*e^(i*n*w*t))+Sum(n=1,inf,(An/2-Bn/2*i
)*e^-(i*n*w*t))', you can introduce the variable Cn, as 'Cn=1/2*(An-i*Bn)'
and 'C(-n)=1/2*(An+i*Bn)'

Your *complex* Fourier series now becomes
'f(t)=Sum(n=-inf,inf,Cn*e^(i*n*w*t))', where 'Cn=1/2*(An-i*Bn)'

> Does anyone know a program that can find ao, an and bn without complex
> numbers,

Notice that this is *only* if PERIOD=[0;T]. If 'f(t)' is periodic from,
say, -1 to 1, then yo must program this yourself (integrals are then not
from 0 to T, but from -1 to 1 or whatever the boundaries are). PERIOD is the
reserved variable in CASDIR. The variable 't' is VX, so often you'll have to
replace this with 'X'.

If 'f(t)=2*cos(t)', with a period of PERIOD[0;2], you do (after you have
saved 2 into the PERIOD variable - considering VX=X):
's*COS(X)' 'n' FOURIER -> Cn (a huge complex expression).

Now, to get A0, you do 'n=0' SUBST, and then either ->NUM 2 * RE, to obtain
the numeric result, or 2 * RE TRIG, to obtain a symbolic result (much
slower). Similar with A1 - 'n=1' SUBST ->NUM 2 * RE, and B1 - 'n=1' SUBST 2
* IM.

If PERIOD[-1;1], you can't use FOURIER - you'll have to evaluate the
inegrals. Do (to evaluate An for this example)
'2/T*Integral(d,d+T,2*cos(t)*cos(n*w*T),t)' 'w=2*pi/T' SUBST 'T=2' SUBST
'd=-1' SUBST EVAL -> huge complex expression. Now SUBST anything for 'n'
('n=0' for A0). Similar for Bn.

Regards
Steen


Albert Graef

unread,
Apr 7, 2001, 10:46:12 AM4/7/01
to
> I' am just started to learn about Fourier series.
> My question is can my hp 49 develop Fourier series??

Yes, sure. The CAS can even (in simple cases) symbolically evaluate the
closed form of the Fourier coefficients.

> I know that hp 49 have a FOURIER command, but I cannot make it work. It
> seems to give some thing with complex numbers. But this is not the way my
> math book does. It does not come up with complex numbers.

Well, that all boils down to Euler's formula, exp(ix) = cos x + i sin x,
with i=sqrt(-1). The imaginary exponential function is nothing but a phasor
rotating on the unit circle, where x denotes the angle in radians, and (cos
x,sin x) are the corresponding rectangular coordinates. Function theorists
and the digital signal people prefer the complex exp representation, since
it tends to simplify the theory. So the general definition of the Fourier
series for a function f(t) with period T is

f(t) = SUM_(k=-infty)^(+infty) c_k exp(2 pi ikt/T)

(Hope you can read my pigeon LaTeX. I use SUM for sums, INT for integrals, _
for subscripts, ^ for superscripts.)

The Fourier coefficients c_k are given by

c_k = 1/T INT_0^T f(t)exp(-2 pi ikt/T) dt

Now, how does this relate to the sin/cos series you see in your book? Quite
simple. If f is a real function, then the imaginary terms in the series must
all cancel out, and so we have that c_(-k) must be the complex conjugate of
c_k, that is, if c_k=a_k + ib_k,
then a_(-k) = a_k and b(-k) = -b_k (in particular, b_0=0). So the series
reduces to

f(t) = a_0
+ 2 SUM_(k=1)^infty a_k cos(2 pi kt/T)
- 2 SUM_(k=1)^infty b_k sin(2 pi kt/T)

Voila, there you have your sin/cos series. :) The real coefficients are

a_0' = a_0 = c_0
a_k' = 2a_k = 2 Re(c_k)
b_k' = -2b_k = -2 Im(c_k), k>0

where c_k are the coefficients of the complex representation, and Re/Im
denote the real and imaginary parts of a complex number, respectively.

Let's verify this on the 49G: Let f(t)=sin(t) with a period of 2 pi. So b_1'
should be 1, and all other coeffs should be zero, right? First, make sure
that both exact and complex mode are on and that the CAS PERIOD variable is
set to 2 pi: 2 [pi] * 'PERIOD' STO. Then you can have a look at, say, the
first three complex coeffs (0, 1, 2) as follows: 'SIN(X)' {0 1 2} FOURIER
Result: {0 '-(i*pi/(2*pi))' 0}
To further simplify the 2nd term: 1 << EVAL >> DOSUBS
Result: {0 '-(i/2)' 0}

Note that c_1 = -i/2, hence b_1' = -2 Im(-i/2) = -2/-2 = 1, and the other
coeffs are zero, as required.

Let's do the same exercise with f(t)=t^2 and again take a look at the first
three coeffs: 'X^2' {0 1 2} FOURIER 1 << EVAL >> DOSUBS
Result: { '4*pi^2/3' '2*i*pi+2' '(2*i*pi+1)/2' }

So the first five real coeffs here are
a_0' = 4 pi^2/3,
a_1' = 4, a_2' = 1,
b_1' = -4 pi, b_2' = -2 pi.

You can calculate the first 2N+1 real coeffs with the following program:

'COEFF':
<< -> N
<< 'I' 'I' 0 N 1 SEQ FOURIER
DUP HEAD EVAL SWAP
TAIL DUP RE 1 << 2 * EVAL >> DOSUBS
SWAP IM 1 << -2 * EVAL >> DOSUBS >>
>>

Example: 'X^2' 2 COEFF
Result:
3: '4*pi^2/3'
2: { 4 1 }
1: { '-(4*pi)' '-(2*pi)' }

Hope this helps.

Albert

--
Dr. Albert Gräf
Dr.G...@t-online.de, a...@muwiinfa.geschichte.uni-mainz.de
http://www.musikwissenschaft.uni-mainz.de

"Martin Nielsen" <***m.ni...@mail1.stofanet.dk> schrieb im Newsbeitrag
news:uP0z6.1269$76.1...@news101.telia.com...

Albert Graef

unread,
Apr 7, 2001, 11:10:13 AM4/7/01
to
BTW, Steen, do you know why FOURIER keeps asking "Turn complex mode on?"
even if you invoked it in complex mode (ROM 1.19-5)?

Steen Schmidt

unread,
Apr 7, 2001, 11:27:38 AM4/7/01
to

> BTW, Steen, do you know why FOURIER keeps asking "Turn complex mode on?"
> even if you invoked it in complex mode (ROM 1.19-5)?

My ROM doesn't do that (v?.??.?), so it may be a combination of other flags.
My flags are
{48403ACB5051FF0#h 0#h 5010400A200008#h 0#h}

Regards
Steen


Martin Nielsen

unread,
Apr 7, 2001, 12:10:40 PM4/7/01
to
Thank you very Albert for your program and for the explanation.
And also thanks Steen for the explanation of hte Fourier command

Martin

"Albert Graef" <Dr.G...@t-online.de> wrote in message
news:9an97e$u71$02$1...@news.t-online.com...

Albert Graef

unread,
Apr 7, 2001, 1:26:41 PM4/7/01
to
> My flags are
> {48403ACB5051FF0#h 0#h 5010400A200008#h 0#h}

That helped, thanks! :) (I had rigorous mode on. I don't quite see how this
relates to my problem, but anyway.)

0 new messages