I was trying to evaluate the following integral, and wanted a solution verification. If I did something wrong please explain why it was wrong and how it can be fixed!
Here is my method:
$$I:=\int_{0}^{\frac{\pi}{2}}\log(a+\sin(x))\,dx$$
$$=\int_{0}^{\frac{\pi}{2}}\log(a+\cos(x))\,dx$$
Use:
$$\cos(x)\equiv 2\cos^2(\frac{x}{2})-1$$
And define:
$$c:=a-1$$
So
$$I=\int_{0}^{\frac{\pi}{2}}\log(c+2\cos^2(\frac{x}{2}))\,dx$$
Let
$$\frac{x}{2}\longrightarrow{x}$$
$$I=2\int_{0}^{\frac{\pi}{4}}\log(c+2\cos^2(x))\,dx$$
$$=2\int_{0}^{\frac{\pi}{4}}\log(c\sec^2(x)+2)\,dx+4\int_{0}^{\frac{\pi}{4}}\log(\cos(x))\,dx$$
The second integral is evaluated by my post:
Solving integrals through “integral systems.”
For the first, let:
$$\tan(x)\longrightarrow{x}$$
$$I=2G-\pi\log(2)+2\int_{0}^{1}\frac{\log(c(x^2+1)+2)}{x^2+1}\,dx$$
$$I=2G-\pi\log(2)+2J$$
$$J=J(c):=\int_{0}^{1}\frac{\log(c(x^2+1)+2)}{x^2+1}\,dx$$
Now we perform Feynman’s technique on $J(c)$.
$$J’(c)=\int_{0}^{1}\frac{1}{cx^2+c+2}\,dx$$
$$J’(c)=\frac{\tan^{-1}\sqrt{\frac{c}{2+c}}}{\sqrt{c(2+c)}}$$
$$J(c)=J(c)-J(0)+\frac{\pi}{4}\log(2)=\frac{\pi}{4}\log(2)+\int_{0}^{c}J’(x)\,dx$$
$$J=\frac{\pi}{4}\log(2)+\int_{0}^{c}\frac{\tan^{-1}\sqrt{\frac{x}{2+x}}}{\sqrt{x(2+x)}}\,dx$$
Let:
$$\sqrt{\frac{x}{2+x}}\longrightarrow{x}$$
$$J=\frac{\pi}{4}\log(2)+2\int_{0}^{\sqrt{\frac{a-1}{a+1}}}\frac{\tan^{-1}(x)}{1-x^2}\,dx$$
By another one of my posts:
A generalized integral. $\int_{0}^{t}\frac{\arctan(x)}{1-x^2}\,dx$
And with mulch simplification we arrive at:
$$I=\frac{\pi}{2}\cosh^{-1}(a)-\frac{\pi}{2}\log(2)+2Ti_2(a-\sqrt{a^2-1})$$
Where in my computations, $G$ denotes Catalans constant, and $Ti_2(x)$ denotes the inverse tangent integral.
Your work seems correct to me. I actually like your approach a lot. You may however want to define exactly what $a$ is. Here is another solution using my favorite methods.
$$\begin{align*}I(a)&=\int_{0}^{\pi/2}\log(a+\sin(x))\ dx \\&=\int_{0}^{\pi/2}\log(a)+\log\left(1+\frac{\sin(x)}{a}\right)\ dx \\&=\frac{\pi\log(a)}{2}+\underbrace{\int_{0}^{\pi/2}\log\left(1+\frac{\sin(x)}{a}\right)\ dx}_{J(a)}\end{align*}$$ Expanding the logarithm by it's power series, $$J(a)=\int_0^{\pi/2}\sum_{n=1}^\infty\frac{(-1)^{n+1}}{n}\frac{\sin^n(x)}{a^n}\ dx=\sum_{n=1}^\infty\frac{(-1)^{n+1}}{na^n}\int_0^{\pi/2}\sin^{n}(x)\ dx$$ by the integral representation of the Beta function, $$\sum_{n=1}^\infty\frac{(-1)^{n+1}}{na^n}\int_0^{\pi/2}\sin^{n}(x)\ dx=\frac{1}{2}\sum_{n=1}^\infty\frac{(-1)^{n+1}}{na^n}B\left(\frac{n+1}{2},\frac{1}{2}\right)$$ which in terms of the Gamma function, $$\begin{align*}\frac{1}{2}\sum_{n=1}^\infty\frac{(-1)^{n+1}}{na^n}B\left(n+\frac{1}{2},\frac{1}{2}\right)&=\frac{1}{2}\sum_{n=1}^\infty\frac{(-1)^{n+1}}{na^n}\frac{\Gamma\left(\frac{n+1}{2}\right)\Gamma\left(\frac{1}{2}\right)}{\Gamma\left(\frac{n}{2}+1\right)} \\ &=\frac{\sqrt\pi}{2}\sum_{n=1}^\infty\frac{(-1)^{n+1}}{na^n}\frac{\Gamma\left(\frac{n+1}{2}\right)}{\Gamma\left(\frac{n}{2}+1\right)}\end{align*}$$ then by the relation, $$\frac{\Gamma\left(\frac{n+1}{2}\right)}{\Gamma\left(\frac{n}{2}+1\right)}=\frac{\sqrt\pi}{2^n}\binom{n}{n/2}$$ we have our series, $$J(a)=-\frac{\pi}{2}\sum_{n=1}^\infty\binom{n}{n/2}\frac{(-1)^{n}}{n(2a)^n}$$ which is evaluated here (credits to @ClaudeLeibovici) and offers closed forms in terms of dilogarithms and hyperbolic functions, but it is not pretty.
Instead if you allow the ${}_3F_2$ Hypergeometric function the integral is, $$I(a)=-\frac{\pi}{2}\log\left(2\left(a-\sqrt{a^2-1}\right)\right)+\frac{1}{a}{}_3F_2\left(\frac{1}{2},1,1;\frac{3}{2},\frac{3}{2};\frac{1}{a^2}\right).$$