4. An isosceles triangle has legs of length $a$ and a base of length $b(a$ $>b)$, and another isosceles triangle has legs of length $b$ and a base of length $a$. If the vertex angles of the two isosceles triangles are supplementary, then $\frac{a^{2}+b^{2}}{a^{2}-b^{2}}=$
4. $\sqrt{3}$.

Since the apex angles of the two isosceles triangles are supplementary, the base angles of the two isosceles triangles must be complementary.

Obviously, in Figure 6, $\triangle A C D$ is similar to the isosceles triangle with legs of length $a$ and base of length $b$.
Thus, $\frac{C D}{b}=\frac{b}{a}$,
$$
C D=\frac{b^{2}}{a} \text {. }
$$

From the right triangle $\triangle B C D$, we get $B D^{2}=B C^{2}+C D^{2}$, i.e.,
$$
4 b^{2}=a^{2}+\left(\frac{b^{2}}{a}\right)^{2} \text {. }
$$

Therefore, $a^{4}+b^{4}=4 a^{2} b^{2}$.
From this, we have
$$
\left\{\begin{array}{l}
a^{4}+2 a^{2} b^{2}+b^{4}=6 a^{2} b^{2}, \\
a^{4}-2 a^{2} b^{2}+b^{4}=2 a^{2} b^{2},
\end{array}\right.
$$

which simplifies to $\left\{\begin{array}{l}\left(a^{2}+b^{2}\right)^{2}=6 a^{2} b^{2} \\ \left(a^{2}-b^{2}\right)^{2}=2 a^{2} b^{2}\end{array}\right.$.
Thus, $\frac{a^{2}+b^{2}}{a^{2}-b^{2}}=\sqrt{3}$.