Example 3 For the function $f(x)$. If $f(x)=x$, then $x$ is called a "fixed point" of $f(x)$; if $f(f(x))=x$, then $x$ is called a "stable point" of $f(x)$. The sets of "fixed points" and "stable points" of the function $f(x)$ are denoted as $A$ and $B$, respectively. If $f(x)=$ $a x^{2}-1(a \in \mathbf{R}, x \in \mathbf{R})$ and $A=B \neq \varnothing$, find the range of real number $a$.
(1) When $a=0$, $f(x)=-1$, then the sets $A=B=\{-1\}$, which satisfies the condition.
(2) When $a \neq 0$.

Since the set $\Lambda \neq \varnothing$, the equation $a x^{2}-1=x$ has a solution, thus $a \geqslant-\frac{1}{4}$
The set $B=\left\{x \mid a\left(a x^{2}-1\right)^{2}-1=x\right\}=\left\{x \mid a^{3} x^{4}-2 a^{2} x^{2}-x+a-1=0\right\}$
$$
=\left\{x \mid\left(a x^{2}-x-1\right)\left(a^{2} x^{2}+a x-a+1\right)=0\right\}
$$

Since $A=B$, the equation $a^{2} x^{2}+a x-a+1=0$ has no solution, or is identical to $a x^{2}-x-1=0$.
From $\Delta<0$, we get $\quad a<\frac{3}{4}$
From $\left\{\begin{array}{l}a^{2} x^{2}+a x-a+1=0 \\ a x^{2}-x-1=0\end{array}\right.$
We solve to get $\quad a=\frac{3}{4}$
In summary, $-\frac{1}{4} \leqslant a \leqslant \frac{3}{4}$ is the solution.