Did Math DF's integral calculator make a glaring mistake?

Click For Summary

Discussion Overview

The discussion centers on the evaluation of the integral ##\int{\ln\left(x\right)\,\sin\left(x\right)\,\cos\left(2\,x\right)}{\;\mathrm{d}x}## using various online integral calculators, particularly focusing on the approach taken by Math DF's integral calculator. Participants are examining the validity of Math DF's integration by parts (IBP) method and whether it correctly incorporates the entire integrand.

Discussion Character

  • Debate/contested
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • Eric expresses concern that Math DF's calculator omits the ##\ln x## term in its IBP calculations, questioning whether this is a mistake.
  • Some participants note that antiderivatives can take multiple forms and discuss the implications of different results being "equivalent" or not.
  • There is a suggestion that verifying the correctness of the results could be done by differentiating both antiderivatives to see if they yield the same integrand.
  • Participants discuss the necessity of choosing a ##u## and ##dv## that represent the entire integrand when performing IBP, emphasizing that leaving out parts of the integrand could lead to incorrect results.
  • One participant points out that while the differentiation approach may confirm correctness, it does not clarify the specific integration by parts technique used by Math DF.
  • There is uncertainty about whether Math DF's approach is fundamentally flawed or if it simply requires a more thorough examination of the calculations presented.

Areas of Agreement / Disagreement

Participants generally agree that the choice of ##u## and ##dv## must encompass the entire integrand in IBP. However, there is no consensus on whether Math DF's calculations are correct or if they contain a significant error, leaving the discussion unresolved.

Contextual Notes

Participants acknowledge that the images of Math DF's calculations do not provide the complete equation, which complicates the assessment of its correctness. There are also discussions about the nature of equivalence in antiderivatives and the implications of constants of integration.

SmartyPants
Messages
15
Reaction score
1
TL;DR
Used Math DF's integral calculator to check a solution I got, and I think it might be making a big mistake in its calculations...
In calculating the integral ##\int{\ln\left(x\right)\,\sin\left(x\right)\,\cos\left(2\,x\right)}{\;\mathrm{d}x}##, I used a few online integral calculators to check my answer. According to one calculator, I got the correct antiderivative, but according to another (Math DF Integral Calculator), I did not.

As you know, the antiderivative of a function can often take more than one form (and sometimes several forms) depending on how one goes about solving the integral. For instance, we know that ##\int tan~x~dx## = both ##ln\left | sec~x \right |+C## and ##-ln\left | cos~x \right |+C##. And while it may be straightforward to show that these two solutions are equivalent, it remains to be seen as to whether the two different solutions these online integral calculators came up with for ##\int{\ln\left(x\right)\,\sin\left(x\right)\,\cos\left(2\,x\right)}{\;\mathrm{d}x}## are in fact equivalent.

But for the moment, I'm more concerned with whether or not Math DF's integral calculator got it wrong than I am concerned with showing that two different solutions to ##\int{\ln\left(x\right)\,\sin\left(x\right)\,\cos\left(2\,x\right)}{\;\mathrm{d}x}## are equivalent. Math DF's solution is as follows (it'll be easier for me to just post screen shots than it will to put it all in LaTex code here, as some of the LateX code at Math DF can be copied, but much of it can't be copied):

int_001.jpg


The calculator chooses to go with Integration by Parts to start, and right away, in breaking the integrand up into a ##u## and a ##dv##, it doesn't account for the entire integrand. Specifically, it chooses ##u=sin~x## and ##dv=cos~2x~dx##, and leaves the ##ln~x## out completely. These IBP calculations would make sense for ##\int sin~x~cos~2x~dx##, but not for ##\int{\ln\left(x\right)\,\sin\left(x\right)\,\cos\left(2\,x\right)}{\;\mathrm{d}x}##...unless am I overlooking something.


int_002.jpg


As for this second part of their solution, the calculations I see here seem to make good sense so long as the calculations that got them to this point (performing IBP twice) are correct. But again, I can't be sure that this calculation is correct because I don't know that they got their integration by parts correct in the first place...and on the surface, it appears that they got the IBP calculations wrong.

In summary, are their IBP calculations correct and am I just overlooking something simple? Or did Math DF's integral calculator make a blatant error in leaving the ##ln~x## out of their IBP calculations?

Thanks in advance,
Eric
 

Attachments

  • int_002.jpg
    int_002.jpg
    43.7 KB · Views: 109
Last edited by a moderator:
Physics news on Phys.org
SmartyPants said:
As you know, the antiderivative of a function can often take more than one form (and sometimes several forms) depending on how one goes about solving the integral.
Yes. For a different example, for the indefinite integral ##\int \sin(x)dx##, both ##\frac 1 2 \sin^2(x) + C## and ##-\frac 1 2 \cos^2(x) + C## are correct antiderivatives. However, but I wouldn't call the different results "equivalent." For a fixed C, these two results will give different answers. What is true, though, is that the two functions differ by at most a constant; i.e., ##\frac 1 2\sin^2(x) = -\frac 1 2\cos^2(x) + \frac 1 2##. What else is true is that both have equal derivatives.

If two integration techniques result in different answers, you can confirm that they are correct by differentiating both. If both are correct, both derivatives will be equal.
 
  • Like
Likes   Reactions: SmartyPants
Mark44 said:
Yes. For a different example, for the indefinite integral ##\int \sin(x)dx##, both ##\frac 1 2 \sin^2(x) + C## and ##-\frac 1 2 \cos^2(x) + C## are correct antiderivatives. However, but I wouldn't call the different results "equivalent." For a fixed C, these two results will give different answers. What is true, though, is that the two functions differ by at most a constant; i.e., ##\frac 1 2\sin^2(x) = -\frac 1 2\cos^2(x) + \frac 1 2##. What else is true is that both have equal derivatives.

If two integration techniques result in different answers, you can confirm that they are correct by differentiating both. If both are correct, both derivatives will be equal.
Thanks for clarifying that much Mark. That makes much more sense, as I don't know that ##ln\left | sec~x \right |## (an antiderivative of ##tan~x##) can be manipulated into ##-ln\left | cos~x \right |## if the constants of integration are left out.

That said, as I mentioned before, I'm not particularly interested in showing that the two different results are both valid by differentiating them both and seeing if I come up with the same derivative. Rather I just want to know if Math DF's calculation of ##\int{\ln\left(x\right)\,\sin\left(x\right)\,\cos\left(2\,x\right)}{\;\mathrm{d}x}## is correct, particularly their Integration by Parts calculations, because at first glance it appears to be incorrect with the way they leave ##ln~x## out of the calculation entirely.
 
SmartyPants said:
Thanks for clarifying that much Mark. That makes much more sense, as I don't know that ##ln\left | sec~x \right |## (an antiderivative of ##tan~x##) can be manipulated into ##-ln\left | cos~x \right |## if the constants of integration are left out.
##\ln |\sec(x)| = \ln \frac 1{|\cos(x)|} = -\ln|\cos(x)|##
In this case, the different results are exactly equal.
SmartyPants said:
That said, as I mentioned before, I'm not particularly interested in showing that the two different results are both valid by differentiating them both and seeing if I come up with the same derivative. Rather I just want to know if Math DF's calculation of ##\int{\ln\left(x\right)\,\sin\left(x\right)\,\cos\left(2\,x\right)}{\;\mathrm{d}x}## is correct, particularly their Integration by Parts calculations, because at first glance it appears to be incorrect with the way they leave ##ln~x## out of the calculation entirely.
Seems to me that it would be easier to verify that their results are correct by differentiating than to try to ferret out a possible mistake in their work...
 
  • Like
Likes   Reactions: SmartyPants
Mark44 said:
Seems to me that it would be easier to verify that their results are correct by differentiating than to try to ferret out a possible mistake in their work...
Agreed...but even if I could show that two different antiderivatives have the same derivative, that doesn't help me understand how Math DF performed integration by parts in this particular example.

IBP is simple: ##\int u~dv = uv-\int v~du##. When performing it, one must choose a ##u## and a ##dv##, and ##u~dv## must represent the entire integrand (##ln~x~sin~x~cos~2x~dx##), not just part of it (##sin~x~cos~2x~dx##). Am I incorrect in this regard? Or is this statement true (and is Math DF screwing up its IBP calculation)? It seems to me that Math DF is only integrating part of the original integrand and just throwing back in the part it left out (##ln~x##) after having arrived at an answer for ##\int sin~x~cos~2x~dx##.
 
SmartyPants said:
Agreed...but even if I could show that two different antiderivatives have the same derivative, that doesn't help me understand how Math DF performed integration by parts in this particular example.
Right, but differentiating the two results and arriving at the same integrand should convince you that the technique chosen by Math DF was a valid one. If the two results didn't result in the same integrand, then you could see where they went wrong in their IBP technique.
SmartyPants said:
IBP is simple: ##\int u~dv = uv-\int v~du##. When performing it, one must choose a ##u## and a ##dv##, and ##u~dv## must represent the entire integrand (##ln~x~sin~x~cos~2x~dx##), not just part of it (##sin~x~cos~2x~dx##). Am I incorrect in this regard?
No, that is correct.
SmartyPants said:
Or is this statement true (and is Math DF screwing up its IBP calculation)? It seems to me that Math DF is only integrating part of the original integrand and just throwing back in the part it left out (##ln~x##) after having arrived at an answer for ##\int sin~x~cos~2x~dx##.
It's hard to say whether Math DF is screwing up, as the image you attached in post 1 doesn't show the complete equation in the first equation they show. This is the one in which the left side is ##1\int \ln(x)\sin(x)\cos(2x)dx = \dots## and the right side looks like ##\dots + \frac 1 4 \int 1##. That final character looks like the digit '1' but probably is 'l' (lower case L). I have not written the two fractional quantities that precede this integral. The complete final integral has to be ##\frac 1 4 \int \ln(x)\sin(x)\cos(2x)dx##.

As it says in the image, they have performed IBP twice, but it's difficult to determine exactly which substitutions they have used in each one.

Here's a link to a web page on integration by parts that includes a couple of examples where repeated IBP is appropriate - https://math.berkeley.edu/~ehallman/math1B/IntByParts.pdf.
 
  • Like
Likes   Reactions: SmartyPants
Yes, it's a bug. It only calculates \int \sin x \cos 2x\,dx by integrating by parts twice; the \ln (x) is completely ignored. It's not an issue with having three factors in the integrand, since it seems to do \int x \sin x \cos 2x\,dx correctly.

You can simplify the integrand by using <br /> \sin x \cos 2x = \frac12 (\sin 3x - \sin x). The calculator does produce the correct answer for \int \ln x \sin ax\,dx.
 
  • Like
Likes   Reactions: SmartyPants
Mark44 said:
It's hard to say whether Math DF is screwing up, as the image you attached in post 1 doesn't show the complete equation in the first equation they show. This is the one in which the left side is ##1\int \ln(x)\sin(x)\cos(2x)dx = \dots## and the right side looks like ##\dots + \frac 1 4 \int 1##. That final character looks like the digit '1' but probably is 'l' (lower case L). I have not written the two fractional quantities that precede this integral. The complete final integral has to be ##\frac 1 4 \int \ln(x)\sin(x)\cos(2x)dx##.

As it says in the image, they have performed IBP twice, but it's difficult to determine exactly which substitutions they have used in each one.

Here's a link to a web page on integration by parts that includes a couple of examples where repeated IBP is appropriate - https://math.berkeley.edu/~ehallman/math1B/IntByParts.pdf.
Hmm...I doctored that image to show the entire equation before posting it...weird that it's not showing you the entire equation. At any rate, you are correct - the part that got cut off is ##\frac 1 4 \int \ln(x)\sin(x)\cos(2x)dx##. Also, the picture does show what substitutions were made for ##u## and ##dv## in each IBP it performed, right in each "integration by parts" box...unless that part of the first picture got cut off as well.
 
pasmith said:
Yes, it's a bug. It only calculates \int \sin x \cos 2x\,dx by integrating by parts twice; the \ln (x) is completely ignored. It's not an issue with having three factors in the integrand, since it seems to do \int x \sin x \cos 2x\,dx correctly.

You can simplify the integrand by using <br /> \sin x \cos 2x = \frac12 (\sin 3x - \sin x). The calculator does produce the correct answer for \int \ln x \sin ax\,dx.
##\sin x \cos 2x = \frac12 (\sin 3x - \sin x)## - this is the trig manipulation I used to get to the final solution. And thank you for confirming for me that Math DF appears to be leaving something out of the IBP calculations, or at the very least skipping a number of steps that I wasn't able to visualize in my head. Math DF tends to sometimes skip steps that might be obvious to Albert Einstein, Terrence Tao, and Richard Feynman, while not realizing that they aren't always obvious to us mere mortals LOL. I just wanted to make sure that I wasn't going crazy haha.

*EDIT* - Also, I did exactly what you did and replaced ##ln~x## with ##x##, calculated \int x \sin x \cos 2x\,dx, and it did that one correctly...who knows why it's leaving the ##ln~x## out of the other integral.
 
Last edited:

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K