Wikipedia:Reference desk/Archives/Mathematics/2007 June 16

= June 16 =

Integral of the square root of tan(x)
We found a question in our maths text book asking us to find the integral of the square root of tan(x). Neither our teacher nor anybody in the class has been able to work it out. Can somebody give us some help? thanks! D3av 11:45, 16 June 2007 (UTC)


 * Unless I'm missing something, put u=tanx and it'll come straight out.81.159.77.229 12:29, 16 June 2007 (UTC)


 * I don't know the answer but I am sure it is more more complex than that, as I have heard this problem discussed before. Algebra man 13:02, 16 June 2007 (UTC)

ummm.. this integral is very complicated and a simple subtitution of u = tanx does not do the job..

my advice is to put = u2 = tan(x), and it will reduce to:


 * = $$2 \int\ \frac{u^2 du}{u^4 + 1}\ $$


 * = $$ 2 \int\ \frac{u^2 du}{(u^2 + u\sqrt{2}\ + 1)(u^2 - u\sqrt{2}\ + 1)}\ $$


 * = $$ 2 ( \int\ \frac{(Au + B)du}{u^2 + u\sqrt{2}\ + 1}\ + \int\ \frac{(Cu + D)du}{u^2 - u\sqrt{2}\ + 1}\ ) $$

now determine A, B, C and D ... then once you've done that, apply partial fractions again ... and you should get a function with some inverse tangents and natural logs.. if anybody wants to take it up from there or suggest a simpler method go for it..


 * or use the decomposition
 * $$u^4 + 1= (\omega u+1)(\omega^3u+1)(\omega^5u+1)(\omega^7u+1)\,,$$
 * in which $$\omega\,\!$$ is a primitive 8th root of unity. If you make use of the properties of roots of unity, this should make the tedious exercise slightly less messy. Or you could cheat, and ask Mathematica. It's always a good idea to check the answer, which I haven't done. --Lambiam Talk  14:47, 16 June 2007 (UTC)
 * Nasty result, not mine (can be found in Mathematics Today Vol. 41, No. 3, June 2005, Eric Watson CMath FIMA):
 * $$\begin{array}{rl}

\int \sqrt{\tan x} \, dx &= \int \frac{\sin x}{\sqrt{\cos x \sin x}} \, dx \\ &=\int \left ( \frac{1}{2} \frac{\sin x + \cos x}{\sqrt{\cos x \sin x}} + \frac{1}{2} \frac{\sin x - \cos x}{\sqrt{\cos x \sin x}} \right ) \, dx \\ &=\int \left ( \frac{1}{\sqrt{2}} \frac{\cos x + \sin x}{\sqrt{1-(\sin x - \cos x)^2}} - \frac{1}{\sqrt{2}} \frac{\cos x - \sin x}{\sqrt{(\sin x - \cos x)^2-1}} \right ) \, dx \\ &=\frac{1}{\sqrt{2}} \arcsin (\sin x - \cos x) - \frac{1}{\sqrt{2}} \operatorname{arccosh} (\sin x + \cos x) + c \end{array}$$ x42bn6 Talk Mess  15:35, 16 June 2007 (UTC)


 * Think that's nasty? Ha! We can directly ask Mathematica for a solution at The Integrator, where we get an answer with a more imposing appearance.
 * $$\begin{align}

\int \sqrt{\tan(x)} \, dx &{}= \frac{ \arctan \left(1+\sqrt{2 \tan (x)}\right) - \arctan \left(1-\sqrt{2 \tan (x)}\right) }{\sqrt{2}} +{} \\ &\quad \frac{ \log \left(\sqrt{2 \tan (x)}-\tan (x)-1\right) -\log \left(\sqrt{2 \tan (x)}+\tan (x)+1\right) }{2  \sqrt{2}} \end{align}$$
 * Following Lambiam's wise advice, we can try algebraic manipulations to prove equality. That fails, and numerical tests confirm the answers are different. So is Mathematica wrong? No! Both results are antiderivatives of the square root of the tangent of x; they differ by the constant (1+i)&pi;/(2&radic;2). Most likely Mathematica converts the integrand to
 * $$ \sqrt{ \frac{i (e^{-ix} - e^{ix})}{e^{-ix} + e^{ix}} }$$
 * so that it can apply advanced methods going back to Liouville. The transformation is clever and effective, but introduces complex numbers into a purely real calculation. --KSmrqT 20:19, 16 June 2007 (UTC)
 * Nasty as in I wonder what motivated such a manipulation in the first place. x42bn6 Talk Mess  21:21, 16 June 2007 (UTC)

wow! thanks so much everyone. We got to the partial fraction point above and then just stopped because we knew it'd be a lot of work to do the partial fractions a few times and we weren't sure if we'd get a result. thanks! D3av 09:11, 17 June 2007 (UTC)

Can you find out if a list of numbers is random
What I mean is: I know that if you roll a die say, 300 times, and you count the number of times each number shows on top, then you can use a chi^2 test to see if the die is fair. But is there a way or a test to tell the difference between a computer outputting 50 1's then 50 2's then 50 3's and so on until 50 6's and then back to 1's again from a fair die?--71.175.128.187 16:15, 16 June 2007 (UTC)


 * There are several tests for statistical randomness, almost all of which would reject this sequence with long runs of the same value. No practical test, however, can distinguish with certainty between true randomness and good pseudorandomness. --Lambiam Talk  17:43, 16 June 2007 (UTC)


 * Or even bad pseudorandomness. —Bromskloss 20:17, 16 June 2007 (UTC)


 * Three points: (1) Certainty, no; confidence, yes. (2) Genuine random sequences includes long runs that make humans uncomfortable; "made up" sequences don't have enough long runs! (3) Practical applications like Monte Carlo integration suffer from runs, so use a different measure called discrepancy. --KSmrqT 20:27, 16 June 2007 (UTC)


 * You might want to check out the program ENT - a Pseudorandom Number Sequence Test Program, written by John Walker. It runs several tests on sequences of bytes, and is useful for evaluating pseudorandom number generators. --NorwegianBluetalk 08:26, 17 June 2007 (UTC)
 * The Diehard tests are a well-known standard, but see also cryptographically secure pseudorandom number generator. --KSmrqT 19:20, 17 June 2007 (UTC)
 * Well, of course a sequence of random numbers would, somewhere, contain the sequence 50 1's then 50 2's then 50 3's and so on until 50 6's and then back to 1's again. In fact, it would contain it infinitely many times. Or any other sequence however odd or long or short you may desire. So, the best you can do is come up with the odds, which is where statistics comes in. This would fall under the heading of nonparametric stats, which I like because it's smaller and more limited. There are several ways to analyze this kind of thing, that look at whether the next number goes up or down randomly enough; for instance your sequence 'same, same, same, same, up, same, same, same, same, up, same, same, same, same, up' etc. would immediately show up, but so would something like 'up, down, up, down, up, down' etc. They are named rank test, run test, etc. There's so much financial benefit in being able to determine whether something is going wrong in an industrial process or not, that it's all been studied very closely. Gzuckier 19:04, 20 June 2007 (UTC)