ĐKXĐ: \(\left\{{}\begin{matrix}2a+7-x>0\\x-5-a^2\ne0\\x+8-a\ge0\end{matrix}\right.\) \(\Rightarrow\left\{{}\begin{matrix}x< 2a+7\\x\ne a^2+5\\x\ge a-8\end{matrix}\right.\)
\(\Rightarrow\left\{{}\begin{matrix}a-8\le x< 2a+7\\x\ne a^2+5\\a>-15\end{matrix}\right.\)
Để hàm số xác định trên (-2;5] \(\Rightarrow\left\{{}\begin{matrix}(-2;5]\subset[a-8;2a+7)\\a^2+5\notin(-2;5]\end{matrix}\right.\)
\(\Rightarrow\left\{{}\begin{matrix}a-8\le-2\\2a+7>5\\a\ne0\end{matrix}\right.\) \(\Rightarrow\left\{{}\begin{matrix}a\le6\\a>-1\\a\ne0\end{matrix}\right.\) \(\Rightarrow\left\{{}\begin{matrix}-1< a\le6\\a\ne0\end{matrix}\right.\)