[SciPy-User] Quick Implementation of Matrix via a Sum

Lorenzo Isella lorenzo.isella at gmail.com
Mon Jun 29 14:46:19 EDT 2015


>Hi Lorenzo:
>
>Is this what you want?
>
>https://github.com/guziy/PyNotebooks/blob/master/np_demo1.ipynb
>
>Cheers
>
>2015-06-29 11:03 GMT-04:00 Lorenzo Isella <lorenzo.isella at gmail.com>:
>
>> Dear All,
>> My scipy is unbelievably rusty and I am struggling with a simple
>> problem.
>> Please consider the following quantity (which I write a la LaTex)
>>
>> D_{n,r}=\frac{1}{n} \sum_{j=1}^r frac{1}{n-j+1} for r=1,2,...n
>>
>> How can I implement this efficiently as a numpy array?
>> I am struggling with newaxis, but I am not going very far.
>> Any suggestion is welcome.
>> Cheers
>>
>> Lorenzo
>>

Perfect!
Thanks.

Lorenzo



More information about the SciPy-User mailing list