Need help integrating a trigonometric function over an interval I found an equation for calculating the perimeter of an ellipse and need help converting it to its series.
$$
\operatorname{p}\left(a,b\right) =
4a\int_{0}^{\pi/2}\sqrt{\,{1 − \left(\frac{\sqrt{a^{2} - b^{2}}}{a}\right)^{2}\sin^{2}\left(θ\right)}\,\,}\,\,{\rm d}θ
$$
where
$$\frac{\sqrt{a^2-b^2}}{a} = \text{eccentricity (ellipse)}$$
therefore
$$a \geq b$$
So far, I have
$$
p(a,b) = 4a \cdot \biggl[\frac{2}{3} \cdot \frac{\biggl(1 − \bigl(\frac{\sqrt{a^2-b^2}}{a}\bigr)^2 \sin^2θ\biggr)^\frac{3}{2}}{-\bigl((\frac{1}{3} \bigl(\frac{\sqrt{a^2-b^2}}{a}\bigr)^3+C_2) \cdot (\frac{θ}{2} - \frac{sin(θ)}{4} + C_3)\bigr)} + C_1\biggr]_0^\frac{π}{2}
$$
I'm sure this naïve attempt has many mistakes, but I wanted to show that I've tried.  What is the correct way to integrate p (with respect to θ over 0 to π/2).
P.S. I hope my question is clear because I am new to MathJax and these equations took 20 minutes to compose. I am developing some software as a hobby to help with recursive and/or iterative calculations of unknown computational depth and/or iterations, respectively.  I currently have this working for calculating Fibonacci numbers, π, and other values of increasing complexity.  I think this calculation will most likely lead to an infinite series and not a tidy solution, but I am 20 years out of practice.
 A: Using elliptic integrals and your notations, we have for
$$p(a,b) = 4a \int^{\frac{\pi}{2}}_{0} {\sqrt{1 − \biggl(\frac{\sqrt{a^2-b^2}}{a}\biggr)^2 \sin^2(θ)}}\,dθ$$
$$p(a,b)=4 aE\left(1-\frac{b^2}{a^2}\right)$$ Around $b=a$, you will get as series
$$p(a,b)=2\pi a \Big[1+\sum_{n=1}^\infty c_n\,x^n\Big]\qquad \text{with} \qquad x=\frac {a-b}a$$ the first coefficients being
$$\left\{-\frac{1}{2},\frac{1}{16},\frac{1}{32},\frac{17}{1024},\frac{19}{2048},\frac
   {89}{16384},\frac{109}{32768},\frac{8921}{4194304},\frac{11887}{8388608},\cdots\right\}$$
Using these cofficients, the relative error is less tha $0.1$% as soon as $b>0.4 a$.
Edit
Let $k=\frac{\sqrt{a^2-b^2}}{a}$
$$I=\int^{\frac{\pi}{2}}_{0} \sqrt{1 − k^2 \sin^2(θ)}\,dθ=E\left(k^2\right)\quad \text{if} \quad \Im(k)\neq 0\lor -1\leq \Re(k)\leq 1$$ and, under these conditions,
$$E\left(k^2\right)=\frac \pi 2 \sum_{n=0}^\infty \frac{ [(2 n)!]^2 }{(1-2 n)\,2^{4n}\, (n!)^4} k^{2 n}$$ which is suitable for coding since
$$d_n=\frac{ [(2 n)!]^2 }{(1-2 n)\,2^{4n}\, (n!)^4}\implies d_{n+1}=\frac{(2n+1)(2n-1)}{4(n+1)^2}d_n$$ with $d_0=1$.
