move more code from utpm.py into algorithms.py in a way that uses specialized code for the 'zeroth derivative' case