Why does Mathematica return twice this value?

In summary: As for the region of integration, it can be described as a quarter cylinder with radius 2 and height 4. Another way to describe it is as a quarter of the circle centered at the origin with a radius of 2.
  • #1
TheMercury79
24
5
Homework Statement
I have evaluated this integral and got 16. But when I do it in the Mathematica program, the answer comes out as 32. I'm wondering if there is some symmetry that I'm missing or if I'm just entering it incorrectly in Mathematica, but I can't seem to get around the missing factor 2.
Relevant Equations
Polar coordinates in triple integral
The integral is$$\int_0^4dz\iint xyz~dxdy$$Constricted to the quarter circular disk ##x^2+y^2=4## in the first quadrant.
First I switched to polar coordinates and integrated the double integral by first writing it as:$$\int_0^4z~dz \int_0^\frac{\pi}2\int_0^2 \frac{1}{2}r^3sin(2\theta)~drd\theta$$
Which leads to:$$2\int_0^4z~dz \int_0^\frac{\pi}2 sin(2\theta) d\theta = 2\int_0^4z~dz = 16$$
I have tried to figure out what's missing and why it comes out as twice this in Mathematica and I feel the textbook is
scarce with descriptions. For example, we're asked to describe the region of integration and I think it's a quarter cylinder
with radius 2 and height 4 but can't find any support in the textbook for it.

I also can't understand why Mathematica gives the answer 16 when ##\theta## is integrated from ##0## to ##\frac{\pi}4##
But that's not the quarter of the circle.
Btw, the code that I entered in Mathematica is: Integrate[x*y*z, {z, 0, 4}, {x, y} ##\in## Circle[{0, 0}, 2, {0, \[Pi]/2}]]

Any hints or pointers to what is missing in my reasoning?
Tnx.
 
Physics news on Phys.org
  • #2
TheMercury79 said:
The integral is$$\int_0^4dz\iint xyz~dxdy$$Constricted to the quarter circular disk ##x^2+y^2=4## in the first quadrant.
First I switched to polar coordinates and integrated the double integral by first writing it as:$$\int_0^4z~dz \int_0^\frac{\pi}2\int_0^2 \frac{1}{2}r^3sin(2\theta)~drd\theta$$
Which leads to:$$2\int_0^4z~dz \int_0^\frac{\pi}2 sin(2\theta) d\theta = 2\int_0^4z~dz = 16$$
I have tried to figure out what's missing and why it comes out as twice this in Mathematica and I feel the textbook is
scarce with descriptions. For example, we're asked to describe the region of integration and I think it's a quarter cylinder
with radius 2 and height 4 but can't find any support in the textbook for it.

I also can't understand why Mathematica gives the answer 16 when ##\theta## is integrated from ##0## to ##\frac{\pi}4##
But that's not the quarter of the circle.
Btw, the code that I entered in Mathematica is: Integrate[x*y*z, {z, 0, 4}, {x, y} ##\in## Circle[{0, 0}, 2, {0, \[Pi]/2}]]

Any hints or pointers to what is missing in my reasoning?
Tnx.
I get the same answer you did -- 16, and WolframAlpha agrees with this. See https://www.wolframalpha.com/input/?i=integrate+z+*+r^3+cos+t+sin+t+dr+dt+dz,+r=0..2,+t=0..pi/2,+z=0..4
My integral looks like this:
Code:
integrate z * r^3 cos t sin t dr dt dz, r=0..2, t=0..pi/2, z=0..4

My guess is that you misplaced a factor of 1/2 when you integrated ##\sin(2\theta)##.

BTW, questions about integrals belong in the Calculus & Beyond section, not in the Precalc section you originally posted in.
 
  • Like
Likes TheMercury79
  • #3
TheMercury79 said:
The integral is$$\int_0^4dz\iint xyz~dxdy$$Constricted to the quarter circular disk ##x^2+y^2=4## in the first quadrant.
First I switched to polar coordinates and integrated the double integral by first writing it as:$$\int_0^4z~dz \int_0^\frac{\pi}2\int_0^2 \frac{1}{2}r^3sin(2\theta)~drd\theta$$
Which leads to:$$2\int_0^4z~dz \int_0^\frac{\pi}2 sin(2\theta) d\theta = 2\int_0^4z~dz = 16$$
I have tried to figure out what's missing and why it comes out as twice this in Mathematica and I feel the textbook is
scarce with descriptions. For example, we're asked to describe the region of integration and I think it's a quarter cylinder
with radius 2 and height 4 but can't find any support in the textbook for it.

I also can't understand why Mathematica gives the answer 16 when ##\theta## is integrated from ##0## to ##\frac{\pi}4##
But that's not the quarter of the circle.
Btw, the code that I entered in Mathematica is: Integrate[x*y*z, {z, 0, 4}, {x, y} ##\in## Circle[{0, 0}, 2, {0, \[Pi]/2}]]

Any hints or pointers to what is missing in my reasoning?
Tnx.

I get the same answer as you, using rectangular coordinates instead of polar.
$$I = \int_{z=0}^4 \, dz \int_{x=0}^2 \, dx \int_{y=0}^{\sqrt{4-x^2}} xyz \, dy \\
= \int_0^4 \, dz \int_0^2 \frac 1 2 z x (4-x^2) \, dx\\
= \int_0^4 2z \, dz = 16$$
 

1. Why is Mathematica returning a value that is twice what I expected?

There could be a few different reasons for this. One possibility is that your input or formula is incorrect, causing Mathematica to give an incorrect result. Another possibility is that your input contains a factor of 2 that you may have missed, resulting in a doubled value. It's also possible that you are using a function or operator that inherently doubles the result, such as the "Double" function. Double-check your input and formula to ensure they are correct, and consider if any functions or operators may be causing the doubling effect.

2. How can I prevent Mathematica from returning twice the expected value?

If you are consistently getting a result that is twice what you expected, it's important to carefully check your input and formula to ensure they are correct. You can also use the "Trace" function in Mathematica to see the step-by-step evaluation process and identify where the doubling may be occurring. Additionally, consider using the "Precision" or "Accuracy" options to control the level of precision in your calculations, as this can sometimes affect the final result.

3. Is Mathematica designed to always return twice the value?

No, Mathematica is not designed to always return twice the value. It is a powerful software tool that can perform a wide range of mathematical operations, and the results it returns are based on the input and formula provided by the user. If you are consistently getting a result that is twice what you expected, it's important to carefully check your input and formula to ensure they are correct.

4. Can I change the settings in Mathematica to prevent it from returning twice the value?

Yes, there are a few different ways you can change the settings in Mathematica to prevent it from returning twice the value. One option is to use the "Precision" or "Accuracy" options to control the level of precision in your calculations. Another option is to use the "Trace" function to identify where the doubling may be occurring and adjust your input or formula accordingly. You can also consult the Mathematica documentation for specific functions or operators that may be causing the doubling effect.

5. Are there any common mistakes that can cause Mathematica to return twice the value?

Yes, there are a few common mistakes that can cause Mathematica to return twice the value. These include incorrect input or formula, using a function or operator that inherently doubles the result, and not properly accounting for factors of 2 in your calculations. It's important to carefully check your input and formula, use the "Trace" function to identify any issues, and consult the Mathematica documentation for guidance on specific functions or operators.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
884
  • Calculus and Beyond Homework Help
Replies
12
Views
995
  • Calculus and Beyond Homework Help
Replies
1
Views
677
  • Calculus and Beyond Homework Help
Replies
3
Views
285
  • Calculus and Beyond Homework Help
Replies
1
Views
954
  • Calculus and Beyond Homework Help
Replies
13
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
903
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
17
Views
2K
Back
Top