3
$\begingroup$

I was trying to evaluate some intergal over some cube with variable side length, but for some reason Mathematica spit out the input. The interand was sufficiently nice that I couldn't believe it didn't have a closed form solution, moreover it took only a few seconds. I thought my syntax was wrong, so I tried integrating the constant 1. And to my surprise it still does not work. If I substitute the side length with a number it works, but for some reason with some paramenter it doesn't. I try using

Integrate[1, Element[{x, y, z}, Cube[l] ], Assumptions -> l > 0]

and it doesn't work, it just answers with the input. If instead I put a number $n$ it gives the obvious correct answer $n^3$. What is happening?

$\endgroup$
9
  • 2
    $\begingroup$ @tommy1996q, I think you've found another bug. Note Integrate[1, Element[{x, y}, Rectangle[-{l, l}, {l, l}]], Assumptions -> l > 0] and Integrate[1, Element[{x, y}, Rectangle[-{l, l}, {l, l}]], Assumptions -> l > 0] and RegionMeasure[Cube[l]] all work as expected. $\endgroup$ Commented Jul 7 at 17:55
  • 1
    $\begingroup$ Integrate[1,{x,-l/2,l/2},{y,-l/2,l/2},{z,-l/2,l/2}] Then estimate the amount of your time spent fighting how to do all this abstractly versus the amount of your time spent doing this concretely. $\endgroup$
    – Bill
    Commented Jul 7 at 18:00
  • 4
    $\begingroup$ @CraigCarter if Mathematica returns an integral unevaluated, that isn't really a bug. It hasn't given you a wrong answer. So I think this is an "opportunity for improvement" rather than a bug. $\endgroup$
    – mikado
    Commented Jul 7 at 19:29
  • 5
    $\begingroup$ Use Cuboid instead. Integrate[1, Element[{x, y, z}, Cuboid[{0,0,0},{l,l,l}] ]] (* l^3 *) $\endgroup$
    – LouisB
    Commented Jul 8 at 1:22
  • 1
    $\begingroup$ Interestingly: Volume[Cube[l]]gives l^3! $\endgroup$ Commented Jul 8 at 8:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.