Difficulties with an elliptic integral (Ahlfors) In Ahlfors' Complex Analysis text, page 239 he defines 
$$F(w)=\int_0^w \frac{dw}{\sqrt{(1-w^2)(1-k^2w^2)}} $$ where $0<k<1$ is a constant.
He notes

this time we agree that $\sqrt{1-w^2}$and $\sqrt{1-k^2w^2}$ shall have positive 
  real parts.

Exercise 1 asks us to show that $$F(\infty)=\int_0^\infty \frac{dw}{\sqrt{(1-w^2)(1-k^2w^2)}}=iK' $$
where $K'=\int_1^{1/k} \frac{dt}{\sqrt{(t^2-1)(1-k^2t^2)}}.$
I have two questions:


*

*Can we really determine the square roots by the sign of their real parts, as the author claims? (given that $w$ lies in the closed upper half plane).

*What's wrong with my evaluation below of $F(\infty)$?  
I'm asking 1 because taking $w=bi$ with $b>1$, makes the expression $1-w^2$ negative, hence it's real part is zero.
As for the evaluation of the integral, we have
$$\int_0^\infty \frac{dw}{\sqrt{(1-w^2)(1-k^2w^2)}}=\int_0^1 \frac{dw}{\sqrt{(1-w^2)(1-k^2w^2)}}+\int_1^{1/k} \frac{dw}{\sqrt{(1-w^2)(1-k^2w^2)}}+\int_{1/k}^\infty \frac{dw}{\sqrt{(1-w^2)(1-k^2w^2)}}. $$ The middle integral in the RHS clearly equals $iK'$, and it will suffice to show that the other two cancel each other out. Well, I only found that
$$\int_{1/k}^\infty \frac{dw}{\sqrt{(1-w^2)(1-k^2w^2)}}=\int_{0}^1 \frac{dt}{\sqrt{(1-t^2)(1-k^2t^2)}}, $$
using the substitution $t=\frac{1}{kw}$. I believe I'm missing a minus sign here?
Help is greatly appreciated!
EDIT:
I should have written "$w=b$ with $b>1$" above.
 A: *

*The square roots must give continuous functions on their whole domain.
(They must be analytic in the interior, but are only continuous at some
boundary points.)
This determines $\sqrt{1-w^2}$ when $w = bi$ and $b > 1$ as being on the
upper imaginary axis near the function value for $w = \epsilon+bi$.

*The square roots must be taken for each factor ${1-w^2}$ and ${1-k^2w^2}$
separately, since otherwise it is too unclear how to choose the sign of the square root of the product so as to make the function even continuous.  For
$1/k < w < \infty$, the individual square roots are on the upper imaginary
axis so their product is negative.  Your sign error is from taking the
square root of the product.
$w = bi$ confused me too.  The following corrections are needed to my
answer:
1a. The boundary is the entire real axis, and there is a sign ambiguity
at every point of the boundary.  This is resolved by requiring continuity.
2a. For $1/k < w < \infty$, the individual square roots are actually on
the lower imaginary axis.  Their product is still negative.  However,
for the subinterals between the cusps $\{\pm1, \pm k\}$ in which only
1 of the square roots is imaginary, this choice of sign for the square
roots is critical -- it is what makes the contour traversed by the integral
$F(w)$ go around clockwise as $w$ traverses the real axis from left to
right.
