Is there a sequence of functions on $\mathbb {R}$ which is uniformly convergent only on compact subsets of $\mathbb {R}$?

Actually am new to this concept of uniform convergence. I have learned a result (Dini's Theorem) which states that if a sequence of continuous real-valued functions $\{\,f_n\}_{n=1}^\infty$ converges pointwise and monotonously $\left(\text{ie} \,f_j(x) \leq f_{j+1}(x) \right)$ to a continuous function $f$ on a compact metric space $(K,d)$, then the convergence is uniform. Now my doubt is, is there a sequence of functions which is uniformly convergent on every compact subsets while non-uniformly convergent on $\mathbb {R}$ itself? Whichever function I try out doesn't fit into my requirement. Can someone help me please? Thanks in advance.

• Partial sums of the Taylor series for $e^x$ – User8128 Jul 4 '17 at 14:24
• It's not true that every pointwise convergent sequence of functions on a compact metric space is uniformly convergent. A classic counterexample is the sequence $f_n:[0,1]\to [0,1]$ given by $f_n(x)=x^n$. They converge pointwise to the function $g(x)=0$ if $0\le x<1$ and $g(1)=1$. If the convergence were uniform, the limit function would have to be continuous. – Jack Lee Jul 4 '17 at 14:38
• Another example: the sequence $f_n(x) = \frac{x^2}{n}$. – Lee Mosher Jul 4 '17 at 16:40
• @shwetha I don't know who taught you that every pointwise convergent sequence of functions on a compact metric space converging to a continuous function is uniformly convergent, but that is not true. For iinstance, define, for each $n\in\mathbb N$, $f_n\colon[0,1]\longrightarrow\mathbb R$ by $f(x)=n^2x-n^3x^2$ if $x\in[0,\frac1n]$ and $f(x)=0$ otherwise. Then $(f_n)_{n\in\mathbb N}$ converges poinwise to the null function, but not uniformly. – José Carlos Santos Jul 4 '17 at 17:10
• $$\forall x\in\mathbb R\quad\forall n\in\mathbb N\quad f_n(x)=\frac{x}n$$ – Did Jul 4 '17 at 17:58