Brachistochrone Problem without Trigonometric Substitution I'm trying to numerically reproduce the cycloid solution for the brachistochrone problem. In doing so, I eventually ended up with the following integral:
$$ x = \int{\sqrt{\frac{y}{2a-y}} dy} $$
Traditionally, one would at this point substitute $y=a-a\cos{\theta}$, but that seems very arbitrary and ad-hoc. What would you substitute if you didn't know the solution beforehand? What would you substitute if you had a field other than $v=\sqrt{2gy}$, such as $v=gy^2$? In the face of this conundrum, I decided to test what would happen if I simply integrated with SymPy by doing sol = integrate(y/sqrt((2*a)-y), y) print(sol.doit()), and to my horror:

Piecewise((16sqrt(2)Ia**(7/2)sqrt(-1 + y/(2a))/(-6a2 + 3ay) - 16sqrt(2)a(7/2)/(-6*a2 + 3ay) - 4sqrt(2)Ia**(5/2)ysqrt(-1 + y/(2a))/(-6a**2 + 3ay) + 8sqrt(2)a*(5/2)y/(-6a2 + 3ay) - 2*sqrt(2)Ia(3/2)y**2sqrt(-1 + y/(2a))/(-6a2 + 3ay), Abs(y/a)/2 > 1), (16sqrt(2)a(7/2)sqrt(1 - y/(2a))/(-6*a2 + 3ay) - 16sqrt(2)a(7/2)/(-6a**2 + 3ay) - 4sqrt(2)a*(5/2)ysqrt(1 - y/(2a))/(-6a2 + 3ay) + 8sqrt(2)a(5/2)y/(-6a2 + 3ay) - 2sqrt(2)a(3/2)y**2sqrt(1 - y/(2a))/(-6a**2 + 3ay), True))

When I corroborated with MATLAB, I found

Clearly, this is nowhere close to $x = a\theta - a\sin{\theta}$. What's going on? What can I do?
Also, please let me know if any amendments need to be made to my question.
 A: As has already been noted, we can't give a better answer to general alternative potentials than "usually you'll need numerical methods", so I'll concentrate on a this-potential aspect of your post, namely how you'd stumble on the answer if the substitution you've already mentioned just doesn't occur.
Well, this is the Physics Stack Exchange, so let's think like a physicist by working in dimensions of powers of $a$. The integrand is of the form $f(y/(2a))$, with $f(u):=\sqrt{\frac{u}{1-u}}$. The $2$ in the denominator makes this a bit more pedagogically messy, since I would have loved to write "of the form $f(y/a)$" instead, but whatever. If any substitution occurs to you, it should be $u=y/(2a)$.
Right, let's continue. Your instruction is that we not set $u=1-\cos\theta$, but frankly I would have instead thought of $u=\sin^2\phi$. That's beside the point for the moment. The point is that since the correct answer includes a $\arcsin\sqrt{1-u}$ term (or $\arccos$ with the term's sign changed, depending on how you do it), you need to think of $\sqrt{1-u}$ as being at least as important as $u$, or you'll never solve the problem. That's not a solution strategy: it's just a fact, known to anybody who's solved the problem already or peaked at its ending, that constrains any solution strategy ever.
OK, but now some good news: you can't not look at the above $f$ and not at least compare $u$ and $1-u$. And since $v=1-u$ wouldn't get us very far, you'll have to instead notice $f$ is the ratio of two square roots, and think in terms of $\sqrt{u}$ and $\sqrt{1-u}$. Since these quantities are defined by having squares that sum to $1$, you'll have to use Pythagoras, a hyperbolic equivalent etc. at some point. (In other words, you'll go the $\phi$ route rather than the $\theta$ route.) So there's nothing unguessable about the next step forward.
