Example 8. Study the maximum and minimum values of the function $y=\mathrm{x}^{-\frac{\mathrm{x}^{2}}{2}}$ on $(-\infty$, $+\infty)$.
Given, $\because y(-\infty)=y(+\infty)=0^{(2)}$, and $y^{\prime}=e^{-\frac{x^{2}}{2}}\left(1-x^{2}\right)$, the critical points are $x_{1}=-1$, $\mathrm{x}_{2}=1 \cdot \mathrm{y}(-1)=-\mathrm{e}^{-\frac{1}{2}}, \mathrm{y}(1)=\mathrm{e}^{-\frac{1}{2}}$, hence we know that $y$ on $(-\infty,+\infty)$ has a maximum value $y(1)=e^{-} \frac{1}{2}$ and a minimum value $y(-1)=-\mathrm{e}^{-\frac{1}{2}}$ (Figure 10).