There is no such function, because they're not equal. Perhaps the second expression should be x^2-2x+1+C...
sage: var('C')