4. In the Cartesian coordinate system, point $A(1,2)$, $B(4,1)$, and a moving point $P(x, y)$ on the circle $x^{2}+y^{2}=25$ form a triangle. Then the maximum value of $S_{\triangle A B P}$ is $\qquad$
4. $\frac{1}{2}(7+5 \sqrt{10})$.

The length of segment $AB$ is
$$
\sqrt{(4-1)^{2}+(1-2)^{2}}=\sqrt{10} \text {. }
$$

The equation of the line on which segment $AB$ lies is $x+3 y-7=0$, and its distance from the origin is $\frac{|-7|}{\sqrt{1^{2}+3^{2}}}=\frac{7}{\sqrt{10}}$.

Since points $A$ and $B$ are both inside the circle, the maximum height of $\triangle ABP$ with $AB$ as the base is $\frac{7}{\sqrt{10}}+5$.
$$
\begin{array}{l}
\text { Therefore, }\left(S_{\triangle ABP}\right)_{\max }=\frac{1}{2} \times \sqrt{10} \times\left(\frac{7}{\sqrt{10}}+5\right) \\
=\frac{1}{2}(7+5 \sqrt{10}) .
\end{array}
$$