bos/statistics — Issue #24: Bug in DCT

Author: Shimuuar
Created: 2012-01-17 17:49:39+00:00
State: open

I think there is bug in DCT

```
dct [1,0] = [1, sqrt 2]
```

If defintion from wikipedia is used then result should be

```
[1 , 1 / sqrt 2]
```

Further inspection shows that every element except first is multiplied by 2. Either first element should be multiplied as well or none. Both convention are used in practice. For example fftw3 multiplies result by 2 http://www.fftw.org/fftw3_doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html

P.S. I think documentation for these these function must include formulae of what actually computed. No amount of word could replace math notation. And because of multitude of conventions it's very important here.

Recently I've learned a nice trick with TeX to gif services and <<url>> haddock markup. Following code will generate inline picture which is generated using such service.

```
-- | Some function
--
-- <>
someFunction :: ...
```

There are some concerns. Service may not tolerate such use it may go away. Alternative is to generate pictures and paste them into documentation using [data URI](http://en.wikipedia.org/wiki/Data_URI_scheme). It will require huge tens of kchars comments