Examples of continuous functions with compact support I would like some simple examples of continuous functions with compact support.
I was trying to come up of a function $\rm I\!R\rightarrow\rm I\!R$, but compact support and continuity seem to be incompatible since if $f$ has compact support, which in this case I just take it to be $[a,b]$ for simplicity, by continuity and taking a limit from the left, we would have $f(a)=lim_{x\rightarrow a^-}f(x)=0$. But by construction $f(a)\neq 0$.
If there are no such simple examples, I have introductory knowledge on Measure Theory and Topology, so I should be able to understand some more advanced functions.
Thanks in advance
Edit to add: I was using the wrong definition for support, which gave rise to this question. I was thinking of compact support as a compact set where $f(x)\neq 0$.
 A: $\newcommand{\supp}{\operatorname{supp}}
\newcommand{\Csupp}{\operatorname{Csupp}}$
There are two definitions of the support of a function. One definition, which you have given, is $\supp(f) = \{x : f(x) \neq 0\}$. However, the definition which is more common (especially in analysis) is the closure of this set, which I'll denote $\Csupp(f) = \operatorname{Cl}(\{x : f(x) \neq 0\}) = \operatorname{Cl}(\supp(f))$. This is also sometimes called the closed support of $f$.
If you're looking for continuous functions $f$ such that $\Csupp(f)$ is compact, there are many easy examples. For instance, take $f(x) = 1-|x|$ for $x \in [-1,1]$ and $f(x)=0$ otherwise.
However, you seem to be asking about continuous functions $f$ such that $\supp(f)$ is compact. Aside from the function $f(x) = 0$, this is indeed impossible. The proof of this is below.
Lemma. If $f : \mathbb{R} \rightarrow \mathbb{R}$ is continuous, then $\supp(f)$ is open.
Proof. Let $x \in \supp(f)$. Then $f(x) \neq 0$, so we can choose $\epsilon>0$ such that $0 \notin (f(x)-\epsilon, f(x)+\epsilon)$. By continuity, we can choose $\delta>0$ such that $y \in (x-\delta, x+\delta)$ implies $f(y) \in (f(x)-\epsilon, f(x)+\epsilon)$. Hence $(x-\delta, x+\delta) \subseteq \supp(f)$.
Corollary. If $f : \mathbb{R} \rightarrow \mathbb{R}$ is continuous and $\supp(f)$ is compact, then $f \equiv 0$.
Proof. If $\supp(f)$ is compact, then it is closed. By the lemma, $\supp(f)$ is therefore clopen. But the only clopen subsets of $\mathbb{R}$ are $\mathbb{R}$ and $\varnothing$, so $\supp(f)$ must be one of these. We can rule out $\mathbb{R}$ since it is not compact, we must have $\supp(f) = \varnothing$, implying $f \equiv 0$.
