I have a huge expression that makes use of Mathematica's units support (Quantity[]
) that I know evaluates to a dimensionless quantity. However, I'm unable to get Simplify[]
nor UnitSimplify[]
to simplify the expression to something not containing units.
Because the actual expression I'm trying to simplify is far too huge to include here, I've made a small example that reproduces this problem:
Quantity[a, "Ohms"] / (b Quantity[1. c, "Ohms"] + Quantity[d, "Ohms"])
Note the presence of variables, some within a Quantity[]
and some outside, as well as a machine-precision number.
But clearly the "Ohms" unit is a common factor in both the numerator and denominator, so it can be cancelled away.
How can I get Mathematica to simplify this down to:
a / (1. b c + d)
Note: I'm using Mathematica 12.0
Edit: Additional test cases that includes slightly more of the original expression
Quantity[a, "Ohms"] / (Tanh@Sqrt[b] Quantity[1. c, "Ohms"] + Quantity[d, "Ohms"])
Quantity[a, "Ohms"] / (Sqrt[b] Quantity[1. c, "Ohms"] + Quantity[1 / (1 - b), "Ohms"])