lua/…/numeric: provide functions sum() and prod()

These functions remove some burden from the user scripts.

This commit refs #143580.