use sum instead of reduce in example code
Merge pull request #2590 from MartinNowak/docs

use sum instead of reduce in example code