1
$\begingroup$

My apologies if this is a somewhat confused question. I'm not a mathematician. I'm self-studying wavelets, and until now I thought I got at least the basics right. But I've played around with the Discrete Wavelet Transform (DWT) in PyWT a bit, and my problem is with the following code:

import pywt
x=[2 for i in range(16)]
d = pywt.wavedec(x, 'db3') 
print d
print [len(i) for i in d]
print sum([len(i) for i in d])

The output I get is

[array([ 2.82842712,  2.82842712,  2.82842712,  2.82842712,  2.82842712,
    2.82842712,  2.82842712,  2.82842712,  2.82842712,  2.82842712]), array([ -5.99627292e-12,  -5.99627292e-12,  -5.99627292e-12,
    -5.99627292e-12,  -5.99627292e-12,  -5.99627292e-12,
    -5.99627292e-12,  -5.99627292e-12,  -5.99653660e-12,
    -5.99620353e-12])]
[10, 10]
20

The two arrays correspond to the scale and detail coefficients. It seems like I'm missing something big here: I always thought the DWT produces a representation in some orthonormal basis. For an input of 16 values, shouldn't the output consist of 16 coefficients, not 20?

Also, am I correct in assuming that the detail coefficients are non-zero due to numerical reasons only? They should be zero due to the input being constant and db3 having three vanishing moments, correct?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.