Quantcast
Channel: Active questions tagged units - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 41

How to "factor out" units?

$
0
0

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 case that includes slightly more of the original expression

Quantity[a, "Ohms"] / (Tanh@Sqrt[b] Quantity[1. c, "Ohms"] + Quantity[d, "Ohms"])

Viewing all articles
Browse latest Browse all 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>