When I run the following code, Integrate throws Missing or incompatible quantities encountered in integration limits {x, xdummy, 10 m}. Yet the Plot runs successfully.

result = Integrate[Quantity[3, "kN/m"] (1 - x/Quantity[10, "m"]), {x, xdummy, Quantity[10, "m"]}]
Plot[result, {xdummy, Quantity[0, "m"], Quantity[10, "m"]}]

How can I make this message go away? I would prefer to hint to Mathematica that xdummy will be in meters, but I'm willing to use a hack if necessary.

  • $\begingroup$ It probably doesn't know that xdummy has units of meters. Why don't you just integrate without the Quantitys? It will be faster, it won't throw errors, and you already know what the numbers are anyway. $\endgroup$
    – march
    Commented Aug 4, 2015 at 16:13

1 Answer 1


The simplest method is to wrap xdummy in Quantity, e.g.

result = Integrate[Quantity[3, "kN/m"] (1 - x/Quantity[10, "m"]), 
  {x, Quantity[xdummy,"m"], Quantity[10, "m"]}]
 Quantity[(15000 - 3000 xdummy + 150 xdummy^2), 
  ("Kilograms" "Meters")/("Seconds")^2] 

Since xdummy is now effectively unitless, you no longer need to include units in Plot, e.g.,

Plot[result, {xdummy, 0, 10}]
  • $\begingroup$ @m_goldberg I'm just shaking my head the I wrote "know" when clearly it was "no". :P $\endgroup$
    – rcollyer
    Commented Aug 5, 2015 at 1:25
  • $\begingroup$ Perhaps some evil gremlin in your system's auto-correction software? It also just inserted "the" when you clearly meant "that" in your comment. $\endgroup$
    – m_goldberg
    Commented Aug 5, 2015 at 1:30
  • $\begingroup$ damn keyboard gremlins. Need to expose them to sunlight. $\endgroup$
    – rcollyer
    Commented Aug 5, 2015 at 1:42

Your Answer

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

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