# Integrate complains about incompatible quantities in integration limits

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.

• 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. – march Aug 4 '15 at 16:13

## 1 Answer

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}]

• @m_goldberg I'm just shaking my head the I wrote "know" when clearly it was "no". :P – rcollyer Aug 5 '15 at 1:25
• Perhaps some evil gremlin in your system's auto-correction software? It also just inserted "the" when you clearly meant "that" in your comment. – m_goldberg Aug 5 '15 at 1:30
• damn keyboard gremlins. Need to expose them to sunlight. – rcollyer Aug 5 '15 at 1:42