2
$\begingroup$

I already asked a question here regarding the discrepancy between the answers I get when I work integrals by hand and the result I can verify using $Mathematica$. I only know enough about $Mathematica$ to type in the commands I need to verify results, plot graphs of polynomials, etc.

Usually I get to the same answer that the program produces, which I always find a bit gratifying, but other times I get results that are equivalent but quite different and often tedious to transfer for one form to the other to verify the equivalence.

Anyway, since this happens to me quite often lately, I wonder how I could check whether I am getting correct results in a reliable way.

For example $$\int \frac{\cos x + \sin x}{\sin 2x}\,dx$$ I use the identity $\sin 2x = 2 \sin x \cos x $ and get $$\frac 12 \int \frac {\cos x + \sin x}{\sin x \cos x}\, dx$$

$$=\, \frac 12 \int \frac {\cos x}{\sin x \cos x}+\frac {\sin x}{\sin x \cos x}\, dx$$

$$=\, \frac 12 \int \csc x \, dx \; + \; \frac 12 \int \sec x \,dx$$

$$=\, -\frac 12 \ln {|\csc x + \cot x|} + \frac 12 \ln {|\sec x + \tan x|}+C$$

This is not the same as the result from $Mathematica$, which gives $$-\frac 12 \ln \left(\cos \frac x2 \right) - \frac 12 \ln \left( \cos \frac x2 - \sin \frac x2 \right)+ \frac 12 \ln \left( \sin \frac x2 \right) + \ln \left( \cos \frac x2 + \sin\frac x2 \right)$$ is this equivalent to my result $$=\, -\frac 12 \ln {|\csc x + \cot x|} + \frac 12 \ln {|\sec x + \tan x|}+C$$ and how could I reliably verify my answers with $Mathematica$?

$\endgroup$
7
  • 1
    $\begingroup$ What is the Mathematica result? It may be possible to show both are equivalent. $\endgroup$
    – Mike
    Feb 11, 2017 at 21:49
  • 1
    $\begingroup$ you could numerically compare results for a definite integral e.g. from $\frac\pi 4$ to $\frac\pi 3$ $\endgroup$
    – WW1
    Feb 11, 2017 at 21:49
  • 1
    $\begingroup$ Give Mathematica the integral minus the result you think ... Mathematica should be smart enough to workout they are the same & give you back the result zero ! $\endgroup$ Feb 11, 2017 at 21:54
  • $\begingroup$ @Mike I added it to my question and doing so it seems to me that some identity has to be involved here. $\endgroup$
    – user409521
    Feb 11, 2017 at 21:59
  • 3
    $\begingroup$ You can probably verify they differ by a constant; just try computing the derivative of the difference of the two functions. If it's zero, you should be alright. $\endgroup$
    – Lonidard
    Feb 11, 2017 at 22:27

2 Answers 2

5
$\begingroup$

It's the same result, if you change the parentheses for modulus:

$$ -\ln \left| \cos \frac x2 - \sin \frac x2 \right|+ \ln \left| \sin \frac x2 + \cos \frac x2 \right| = \ln \frac{\left| \sin \frac x2 + \cos \frac x2 \right|}{\left| \cos \frac x2 - \sin \frac x2 \right|} =$$

$$\ln \left| \frac{\left( \sin \frac x2 + \cos \frac x2 \right)^2}{\left( \cos \frac x2 - \sin \frac x2 \right)\left( \sin \frac x2 + \cos \frac x2 \right)} \right | = \ln \left| \frac{1 + \sin x}{\cos x} \right | = \ln |\sec x + \tan x| $$

And

$$ -\ln {|\csc x + \cot x|} = \ln \left|\frac{\sin x}{1+\cos x} \right| = \ln \left|\frac{2\sin \frac x2\cos \frac x2}{2\cos^2 \frac x2} \right| = \ln \left |\tan \frac x2 \right| = \ln \left | \sin \frac x2 \right| - \ln \left |\cos \frac x2 \right| $$

$\endgroup$
2
  • 1
    $\begingroup$ Please rectify the last part $\endgroup$ Feb 12, 2017 at 6:59
  • $\begingroup$ @labbhattacharjee thanks! $\endgroup$ Feb 12, 2017 at 16:34
2
$\begingroup$

Check your integrals by taking the derivatives; if you're good at derivatives it's easy. Faster and more productive than Mathematica in a large number of cases.

$\endgroup$

You must log in to answer this question.