Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I want to calculate with units, for example using Pythagoras theorem, I would do this:

c = Sqrt[(3m)^2 + (5m)^2]

The result will be 5 Sqrt[m^2].

How can I define that m = Sqrt[m^2] and so forth?

share|improve this question
up vote 10 down vote accepted

Take a look at this blog post by Jon McLoone:

Automatic Physical Units in Mathematica

where he explains how to use this package:

Automatic Units

which has over 1000 physical units. Also you can simply use Wolfram|Alpha integration in Mathematica. At the beginning of any input line type single equal sign and see it turn into a large orange equal sign, - then compute:

enter image description here

Using little plus sign at the top right corner you can do more complicated things, like mixed units computation for mechanical kinetic energy below, giving correct units of Joules:

enter image description here

Typing equal sign twice you can get a full Wolfram|Alpha query in your notebook with more relevant info:

enter image description here

share|improve this answer
Assuming[m > 0, Simplify[Sqrt[(3 m)^2 + (5 m)^2]]]

Sqrt[34] m

Or, if you want to have this assumption during your whole session you could define:

$Assumptions = {m > 0};

Now Simplify and any other function accepting the Assumptions option will use this assumption:

Simplify[Sqrt[(3 m)^2 + (5 m)^2]]

Sqrt[34] m

share|improve this answer
PowerExpand[] would also be useful here. – J. M. Aug 29 '12 at 11:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.