Fix trig cumsum

Other than the fix suggested by the title, this branch also addresses the issue #1270 of ```polyfit()``` for ```trigfuns```