Post Reply 
[VA] SRC#001 - Spiky Integral
07-10-2018, 10:10 PM
Post: #1
[VA] SRC#001 - Spiky Integral
.

Hi all, welcome to my SRC#001 - Spiky Integral:

Here I'll deal with a real-world math problem not of my own making but which did appear at a certain math competition. The problem introduces this "spiky" integral:

            I(N) = \(\int_{0}^{2\pi} cos(x)\, cos(2x)\, cos(3x)\, ...\, cos(Nx)\, dx \)

and asks  for which values of  N  in the interval  [1,10]  does  I(N)  have a non-zero value.

It then specifies that the result must include proof of correctness but in my extensive experience with problems of this sort I've found that it's best to first obtain the correct result using whatever means (praying included, bribing not excluded), as this will usually provide a most helpful "hint" to afterwards try and get proof of its validity.

With this strategy in mind (and if praying and bribing have already proved ineffective), we can use our beloved HP calcs (yes, HP calcs, not Excel, not Mathematica, not Wolfram Alpha, not Maple, not Matlab, not laptops, you get the drift) to get some numerical evidence first, then use it to make an educated conjecture on what the correct result might probably be.

As for numerical evidence, this is how I'd obtain it using an HP-15C and a very simple, straightforward little program I wrote which goes as follows:

The program segment which computes   Cos(x)*Cos(2x)*Cos(3x)*...*Cos(Nx),   where N is assumed to be in R0 and x in stack register X (the display), is placed under LBL B and the main program which computes the integral I(N) for N from 1 to 10 is placed after it under LBL A:

      001  LBL B      015  LBL A
      002  STO 1      016  1.01
      003  RCL 0      020  STO 0
      004  INT        021  LBL 0
      005  STO I      022  0
      006  1          023  PI
      007  LBL 1      024  2
      008  RCL I      025  x
      009  RCLx 1     026  INTEG B
      010  COS        027  RCL 0
      011  x          028  R/S
      012  DSE I      029  X<>Y
      013  GTO 1      030  R/S
      014  RTN        031  ISG 0
                      032  GTO 0

To run it, simply press:

      [USER] [RAD] [FIX 3]

      [A]   ->  1.010    [R/S] -1.083 -04
      [R/S] ->  2.010    [R/S] -5.974 -05
      [R/S] ->  3.010    [R/S]  1.571
      [R/S] ->  4.010    [R/S]  0.785
      [R/S] ->  5.010    [R/S]  3.778 -08
      [R/S] ->  6.010    [R/S]  2.733 -09
      [R/S] ->  7.010    [R/S]  0.393
      [R/S] ->  8.010    [R/S]  0.344
      [R/S] ->  9.010    [R/S] -3.600 -04
      [R/S] -> 10.010    [R/S]  1.664 -09

Notes:

- It's best to run this on much faster, modern HP-15C-based hardware or a fast software emulator as otherwise it will take several hours for a physical vintage HP-15C to get the results above, mostly because the function being integrated gets more an more "spiky" as N grows and so it takes more and more time to integrate it accurately.

- FIX 3 is recommended for speed as FIX 4 or higher takes significantly longer and the extra accuracy isn't needed here. On the other hand, FIX 2 can't be used in the HP-15C or the HP-41C/Advantage versions because for N=4 we get:

        I(4) = 0.86 +- 0.03

which is wrong, the uncertainty is lying. This is similar to what Mr. Kahan said about one of his sample integrals in some issue of the HP Journal: the error is too small to notice but too big to ignore. The solution is of course to use FIX 3 as above or SCI 2, which also gives the correct result, namely:

        I(4) = 7.85E-01 +- 1.48E-03



With this evidence in mind and regarding anything smaller than 1E-3 as 0 (as we are computing the integrals in FIX 3) we can see that I(N) is non-zero for N=3, 4, 7 and 8.

Using this numerical evidence I have my own conjecture on what the result will be for general N, which I'll post in a few days together with my verbatim conversion of this HP-15C program for the HP-41C/Advantage ROM (which runs very fast in modern hardware/emulators) as well as a completely different 6-line enhanced version for the HP-71B/Math ROM which profitably uses a technique discussed in my latest S&SMC#23 and further includes a couple of very nice extras not present in the other versions.

First though, I'd like to see what your own conjectures are (computing for N>10 might help to check them out) and of course your very own programs for your preferred hardware (RPL comes to mind, Prime's PPL, even SHARP or Casio models ...) or, if you're not up to the task (you know who you are), at least your very own personal comments or ideas ! (Googling for the solution is totally laaaaaame, boo !).

Regards.
V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[VA] SRC#001 - Spiky Integral - Valentin Albillo - 07-10-2018 10:10 PM
RE: [VA] SRC#001 - Spiky Integral - pier4r - 07-11-2018, 11:10 AM
RE: [VA] SRC#001 - Spiky Integral - Pjwum - 07-12-2018, 10:32 AM
RE: [VA] SRC#001 - Spiky Integral - DavidM - 07-15-2018, 07:53 PM
RE: [VA] SRC#001 - Spiky Integral - Werner - 07-18-2018, 06:17 AM



User(s) browsing this thread: 1 Guest(s)