Define a function \( f: \mathbb{R} \rightarrow \mathbb{R} \) by \( f(x)=\left\{\begin{array}{ll}x^{2} \sin \left(\frac{1}{x}\right), & \text { if } x \neq 0 \\ 0, & \text { if } x=0\end{array}\right.