Inverse of a bijective function programmatically