I would like to differentiate the following expression with respect to b:
$$\sum_{i=1}^M (\prod_{j=1}^{i-1} (b+1+a_j))$$ $$a_j\in\mathbb{R}$$ $$b\in\mathbb{R}$$
aj is a small number between between -0.16 and 0.16. b is constant and is also small between -0.001 and 0.001. M will be 4000.
It would be helpful to take b out of the product and sum. I also thought about expanding the product and then rewriting the expanded product as a sum. Seems difficult. How should I go about differentiating this expression with respect to b?
If $D$ is derivative with respect to $b$ and $E$ is that expression, then
$$ DE=\sum_{i=0}^MD\prod_{j-1}^{i-1}(b+1+a_j) $$
Then you are apply Leibniz's rule for the derivative of a product
$$ DE = \sum_{i=0}^M\sum_{j=1}^{i-1}\prod_{k=1, k\neq j}^{i-1}(b+1+a_j) $$