Inverse of piecewise functions.

Also included are minor changes to tasks to be more pythonic w.r.t.
copying.