So I am trying to solve a triple integral in mathematica, but I am getting errors regarding my limits of integration.

This is my code:


Trying to solve this yields this error:

y = sqrt[{9000000(1-x^2/36000000-z^2/6250000)}] is not a valid limit of integration.

What can I do to get around this?

| improve this question | | | | |
  • $\begingroup$ You're integrating numerically, which requires that your limits are numbers. Try Integrate if you want a symbolic result. $\endgroup$ – IPoiler Nov 30 '15 at 23:29
  • $\begingroup$ Also, In Mathematica, all built-in functions start with capital letters: sqrt should be Sqrt. $\endgroup$ – march Nov 30 '15 at 23:29
  • $\begingroup$ Keep in mind also the the order of the limits for multiple integrals in Mathematica is that the first set of limits corresponds to the outermost integral and the last set of limits corresponds to the innermost integral. $\endgroup$ – IPoiler Nov 30 '15 at 23:33

I believe the following will solve your problem.

First we define a function that is 1 in the region of interest and zero elsewhere

    R[x_, y_, z_] := 
        If[y^2 < (1 - x^2/6000^2 - z^2/2500^2)*(3000^2), 
             If[x^2 < (1 - z^2/2500^2)*(6000^2), 1, 0], 0]

Then, we integrate

    NIntegrate[ 400 R[x, y, z], {y, -3000, 3000}, {x, -6000, 6000}, {z, -2500, 2500}]

In addition to the issue with sqrt, you were using {} where you should be using ()

| improve this answer | | | | |
  • $\begingroup$ Thanks! That seems to have worked. $\endgroup$ – therocketsmith Dec 1 '15 at 0:03

In addition to the syntax errors noted earlier, if you swap your limits of integration you should get a result.

NIntegrate[400, {z, -2500, 2500}, 
 {x, -Sqrt[(1-z^2/2500^2)*(6000^2)],Sqrt[(1-z^2/2500^2)*(6000^2)]}, 
 {y, -Sqrt[(1-x^2/6000^2-z^2/2500^2)*(3000^2)], Sqrt[(1-x^2/6000^2-z^2/2500^2)*(3000^2)]}]
| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.