Let $f:[a,b] \rightarrow \mathbb{R}$ be a function which is continuous on $(a,b]$ and differentiable on $(a,b)$. Is there any function such that $f(b)-f(a)≠(b-a)f'(x), \forall x\in (a,b)$?
There was a typo, and now it's edited. I wanted to know whether compactness of a set where $f$ is continuous on is essential.
Let $f(0)=-20, f(x)=0 \text{ for } x \in (0,1]$. Is this the sort of example you were thinking of?