🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.num-analysis
Article #54

Re: The Fourier Coefficients of ln(x)

#54
From: rcorless
Date: Mon, 02 Nov 1992 12:19
106 lines
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)
Technical Details
Message-ID: <1992Nov2.081926.1@uwovax.uwo.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!cs.utexas.edu!torn!newshost.uwo.ca!uwovax.uwo.ca!rcorless

Show Full Headers
Complete Article Headers
Newsgroups: sci.math.num-analysis
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!cs.utexas.edu!torn!newshost.uwo.ca!uwovax.uwo.ca!rcorless
From: rcorless@uwovax.uwo.ca
Subject: Re: The Fourier Coefficients of ln(x)
Organization: University of Western Ont, London
Date: Mon, 2 Nov 1992 12:19:26 GMT
Message-ID: <1992Nov2.081926.1@uwovax.uwo.ca>
Sender: news@julian.uwo.ca (USENET News System)
Nntp-Posting-Host: hydra.uwo.ca
Lines: 106