Is there a way to use FindMinimum
with quantities? For example:
FindMinimum[{Quantity[x, "cm"] + Quantity[y, "m"],
x >= Quantity[0, "cm"], y >= Quantity[0, "cm"]}, {x, y}]
but this throws an error. Any ideas?
Edit: I see now that this code is inconsistent (treating x
as a unitless variable in the objective, but as a quantity with units in the inequality constrains, see answers). But here is another example that also came up in my code and does not work. I think this is consistent.
FindMinimum[{y/(x + y),
x >= Quantity[1, "m"], y >= Quantity[2, "m"]},
{{x, Quantity[1, "m"]}, {y, Quantity[2, "m"]}}]