I have $\sum_{k=0}^{\infty}k^2q^kp=\sum_{k=0}^{\infty}k[kq^{k-1}]qp=\sum_{k=0}^{\infty}k[\frac{d}{dq}(q^k)]qp$.
How can I go about pulling this $\frac{d}{dq}$ outside of the sum?
I have $\sum_{k=0}^{\infty}k^2q^kp=\sum_{k=0}^{\infty}k[kq^{k-1}]qp=\sum_{k=0}^{\infty}k[\frac{d}{dq}(q^k)]qp$.
How can I go about pulling this $\frac{d}{dq}$ outside of the sum?
First of all you need the series to converge and $p$ is not a function of $q$ as julian said.
If it converges,then:
$\sum_{k=0}^{\infty} k^2q^kp=\frac {1}{k+1}\cdot \frac {d}{dq} \sum_{k=0}^{\infty} k^2 q^{k+1}p$