# PyWavelets CWT : error when differentiating after convolution?

I'm trying to understand the implementation of CWT in PYWT. This topic has already helped me quite a lot but there is still a thing that is unclear to me : why is the result differentiated only after the convolution?

Following the detailed mathematical breakdown explaining the old matlab implementation (here):

$$W_{n}(s) = \frac{1}{\sqrt{a}} \int_{-\infty}^{+\infty} s(t) \psi^{\star}(\frac{t-b}{a})$$

$$W_{n}(s) = \frac{1}{\sqrt{a}} \sum\limits_k \int_{k}^{k+1} s(t) \psi^{\star}(\frac{t-b}{a})$$

$$W_{n}(s) = \frac{1}{\sqrt{a}} \sum\limits_k s(k)\int_{k}^{k+1} \psi^{\star}(\frac{t-b}{a})$$

Finally:

$$W_{n}(s) = \frac{1}{\sqrt{a}} \sum\limits_k s(k)\left[\int_{-\infty}^{k+1} \psi^{\star}\left(\frac{t-b}{a}\right)-\int_{-\infty}^{k} \psi^{\star}\left(\frac{t-b}{a}\right)\right]$$

To me, it follows from the last equation that:

$$W_{n}(s) = \text{CONV}(s,\text{DIFF}(\Psi))$$

Where $$\Psi$$ is the primitive of $$\psi$$.

But the code does compute convolution first, and differentiate only in the end.

Differentiating in the end makes the code compute $$s(k+1)\Psi^{\star}(k+1) - s(k)\Psi^{\star}(k)$$ instead of $$s(k)\left[\Psi^{\star}(k+1)-\Psi^{\star}(k)\right]$$, which is only true if $$s(k)-s(k+1)=0$$. Or at least is small. But i see no reason why this condition would be true. Am i missing something? Is there a regularity assumption on $$s$$ ?