(THIS QUESTION HAD A MAJOR SIMPLIFICATION EDIT)
Lets suppose I want to convert the falling body equation, from one set of units to another.
I start with:
eqn = Quantity[d, "Feet"] == 1/2*Quantity[32.2, "Feet"/"Seconds"^2]*Quantity[t, "Seconds"]^2
(*Quantity[d, "Feet"] == Quantity[16.1 t^2, "Feet"]*)
And I apply the Map shortcut from suggestion Stephen Powell answer:
Solve[Map[UnitConvert, eqn], d]
(*{{d -> 16.1 t^2}}*)
Obviously, something went wrong, since, being this SI basis units, my weight has tripled!
Question, how can I easily convert equations or other type of expressions, between units?
I mean, imagine that I want to translate a book from US market to French. In the book, there are equations based on inch, feet, cfs, etc. And many times, all mixed together in the same equation, since applied engineering books have a lot of empirical thumb rule expressions (and everything gets homogenized by the constants, that not always show the units...). For these same reasons, I may want to express, in the translated book, a pipe diameter in mm, together with a flow rate in m3/h and a length in m (notice the mm instead of m, and the h instead of s...).
Question Is there a simple way I can do something like:
ExpressionUnitConvert[eqn, {d -> "mm", t -> "h"}]
Obviously, I can do it "by hand", starting by converting only the constant, and then, replacing the units (without converting them). But how to have Mathematica automatically return:
(* Quantity[d, "Meters"] == 1/2*Quantity[9.81, "Meters"/"Seconds"^2]*Quantity[t, "Seconds"]^2 *)
or...
(* Quantity[d, "Meters"] == Quantity[4.905, "Meters"/"Seconds"^2]*Quantity[t, "Seconds"]^2 *)
or...
(* Quantity[d, "Meters"] == Quantity[4.905 t^2, "Meters"] *)
(obviously, it will return something closer to 4.90728...)
Solve[Quantity[d, "Feet"] == Quantity[h, "Feet"]^(1/2)*Quantity[dc, "Feet"]^(1/3)/ Quantity[2, "Feet"^(-1/6)], d]
results in{{d -> 1/2 dc^(1/3) Sqrt[h]}}
. I don't think that meters is the problem, I think that d is not a quantity is the reason you are getting that result. $\endgroup$x=y
, wherex
andy
have the same dimensions, is independent of the choice of units. $\endgroup$Solve
of the feet expression is normal that it returns itself. But once you convert it to meters, the constant should change... (the constant has units... for the equation to be balanced). Please look at my edit (added example). $\endgroup$