Thread View: sci.math.num-analysis
1 messages
1 total messages
Started by rcorless
Mon, 02 Nov 1992 12:19
Re: The Fourier Coefficients of ln(x)
Author: rcorless
Date: Mon, 02 Nov 1992 12:19
Date: Mon, 02 Nov 1992 12:19
106 lines
4038 bytes
4038 bytes
|\^/| MAPLE V
._|\| |/|_. Copyright (c) 1981-1991 by the University of Waterloo.
\ MAPLE / All rights reserved. MAPLE is a registered trademark of
<____ ____> Waterloo Maple Software.
| Type ? for help.
Maple V running on VAX under VMS.
# Simple Maple program for Fourier coefficients.
# I assume two things:
# a) this isn't a homework problem
# (since the answers aren't elementary functions
# this is actually reasonable)
# b) The interval of interest is (0,2*Pi). On this
# interval the convergence will be very slow, but
# that is the problem of the person who wants the
# series.
#
> f := ln(x);
f := ln(x)
> An := int(f*cos(n*x),x=0..2*Pi);
sin(2 n Pi) ln(2 Pi) - Si(2 n Pi)
An := ---------------------------------
n
# The answer involves sine and cosine integrals
# (more later). We must also normalize by
# the integral of cos(n*x)^2 but this is left as an
# exercise.
#
# Just in case you want it on a different interval, here is
# the analytic antiderivative:
> int(f*cos(n*x),x);
sin(n x) ln(x) Si(n x)
-------------- - -------
n n
#
# Now for the sine coefficients:
#
> Bn := int(f*sin(n*x),x=0..2*Pi);
- cos(2 n Pi) ln(2 Pi) + Ci(2 n Pi) gamma + ln(n)
Bn := ----------------------------------- - -------------
n n
#
# And the analytic antiderivative:
#
> int(f*sin(n*x),x);
cos(n x) ln(x) Ci(n x)
- -------------- + -------
n n
#
# So what are the Si and Ci functions?
#
# Si(x) = int( sin(t)/t, t=0..x), while
#
# Ci(x) = gamma + ln(x) + int( (cos(t) - 1)/t, t=0..x).
#
#
# Now the answer for B0 above is problematical --- do it
# directly:
> B0 := int(f,x=0..2*Pi);
B0 := - 2 Pi + 2 ln(2 Pi) Pi
#
# The first few coefficients:
#
> Digits := 16;
Digits := 16
> for k to 8 do
> lprint(`A`.k.` =`,evalf(subs(n=k,An)));
> lprint(`B`.k.` =`,evalf(subs(n=k,Bn)));
> od;
A1 = -1.418151576132629
B1 = -2.437653393057225
A2 = -.7460806127922327
B2 = -1.557178275501372
A3 = -.5060113204890600
B3 = -1.172158126196615
A4 = -.3827828212476692
B4 = -.9507389113630155
A5 = -.3078058159155137
B5 = -.8051075631699461
A6 = -.2573845870565533
B6 = -.7012588150022402
A7 = -.2211547528113995
B7 = -.6230740340027308
A8 = -.1938647041004790
B8 = -.5618661407881365
#
# WARNING: I have not checked whether Maple got these right
# or not. For example, you could complete the
# calculation of the Fourier series by normalizing,
# and graphing the sum of the first few terms and
# comparing it with ln(x).
> done
bytes used=4072244, alloc=2883056, time=11.830
--
======================================================================
Dr. Robert M. Corless | logic, n. The art of thinking and
Department of Applied Mathematics | reasoning in strict accordance
University of Western Ontario | with the limitations and in-
London, Ontario | capacities of the human misun-
Canada N6A 5B | derstanding. (Ambrose Bierce)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads