Message Boards Message Boards


Radians as Dimensionless Unit?

Posted 2 years ago
10 Replies
3 Total Likes

I'm using Mathematica to teach a Physics course (Theoretical Mechanics) this fall, and am having lots of trouble with units (Quantity...). My most recent issue is this: Mathematica doesn't seem to recognize that Radians are a dimensionless unit. So if I type:

QuantityMagnitude[5, "Radians"]

I get the error message: Quantity::compat: DimensionlessUnit and Radians are incompatible units

You might wonder why I would like to do something like this anyway. The issue is that NDSolve doesn't seem to work with Quantities, so I need to strip units off of everything before running it through there. But if I have an angle, I don't know if it is in Degrees, Radians or without any specific angular unit which means the dimensionless angular unit of Radians if coming out of some calculation like

\[Phi] = \[Sqrt](k/m) t

Is there some way for me to tell Mathematica that Radians are compatible with DimensionlessUnit? Or do I need to write some wrapper that checks if compatible and if not then don't try to convert?

Thanks, Eric

10 Replies

QuantityMagnitude acts on Quantity objects:

In[1761]:= QuantityMagnitude[Quantity[5, "AngularDegrees"], "Radians"]

Out[1761]= \[Pi]/36

I have never tried NDSolve with quantities.

Thanks for the quick response. I probably should have given a better example. This works:

QuantityMagnitude[Quantity[1, "AngularDegrees"/"Seconds"], 

but this doesn't:

QuantityMagnitude[Quantity[1, 1/"Seconds"], "Radians"/"Seconds"]

Either way, the point is that you should be able to convert a dimensionless quantity to a quantity with units of Radians, because Radians are unitless (they are defined as the ratio of two lengths)

Posted 2 years ago

I understand the concept that "radians" are a "dimensionless" angle measure. But, "radians" are an SI derived unit. There is a conversion to/from angular degrees. In practice, it is treated like a quantity. I think Mathematica is trying to accommodate unit based calculations by treating them as a Quantity. With that said...

One way to convert angular quantities to dimensionless "radians" expressions is to use a replacement rule like:

radrule = q_Quantity :> QuantityMagnitude[q, "Radians"]
Quantity[1, "Radians"] /. radrule
(* 1 *)
Quantity[1, "AngularDegrees"] /. radrule
(* \[Pi]/180 *)
1 /. radrule
(* 1 *)

Note: I've edited the code example above to show that the replacement rule, radrule, leaves purely numeric expressions unchanged. I think this would be helpful for the 3 cases mentioned ("Radians", "AngularDegrees", or with no unit specified (dimensionless). In the dimensionless case, the assumption would be that the implied units are radians.


QuantityMagnitude[Quantity[1, 1/"Seconds"], "Radians"/"Seconds"],

you can use the following to see the units are not compatible:

CompatibleUnitQ[1/"Seconds", "Radians"/"Seconds"]
(* False *)

I think this make sense because it would seem incorrect to assume that 1/"Seconds" can be unambiguously converted to "Radians"/"Seconds". However, the following is true:

CompatibleUnitQ[Quantity[1, "Hertz"], 1/"Seconds"]
(* True *)

The following links are a good starting point for working with units:

Symbolic Calculations with Units

Numerical Calculations with Units

Thank you for the radrule suggestion and comments. You are absolutely right that as far as Mathematica is concerned Radians are not Dimensionless. That is the problem. Because Radians ARE dimensionless. An angle, in radians, is defined as the length of an arc on a circle subtended by that angle divided by the length of the radius. Length/Length = Dimensionless.

If that is unconvincing then think about a simple pendulum. It has an angular frequency of \Sqrt[g/L] (g is the gravitational constant with dimensions [Length]/[Time]^2; L is the length of the pendulum with dimensions [Length]). So the angular frequency has dimensions 1/[Time]. But angular frequency has to be in [AngularUnit]/[Time]. The "angular unit" here is Radians.

To be explicit: 1/"Seconds" is unambiguously converted to "Radians"/"Seconds". You are free to add in Radians units or remove them at any point you want, because they are dimensionless.

For a quick fix I've written a routine that tests whether they are compatible and if not throws in Radians to try to make them compatible. But I hope Wolfram can just fix this. Do they ever read these discussions?

In my humble opinion (I have not thouth a lot about this), radians are a unit for measuring angles, just like degrees. They are independent of the units for length (metres, feet etc) and time (seconds, years etc), but they depend on an arbitrary choice of angular dimension, which could be done continuosly. Hertz means cycles per second, rather than radians per second. Cycles are more reasonably dimensionless because they are a matter of counting discrete objects, for which there is an obvious, privileged choice of unit. I am interested in hearing more informed opinions on this.

Yes, radians are a unit of measuring angles, like degrees. But they are not at all arbitrary - they are defined in a very particular way (as I mentioned, as a ratio of arc length to radius) which is why they end up having 2Pi as one revolution.

Also, yes, Hz means cycles (revolutions, periods,...) per second, not radians per second. So perhaps counter-intuitively writing Hz is NOT the same as writing 1/s, because 1/s is the same as radians/second. You need to explicitly put in "cycles" or "revolutions" or something like that when you write it out.

You ask for informed opinions. I've been teaching this for the past 30 years but here are some other sources: "Although the radian is a unit of measure, it is a dimensionless quantity... the units of angular velocity ... are s^{?1}" Or maybe better, a paper from NIST (National Institute of Standards and Technology) "Dimensionless units in the SI" ( which says "Here we consider dimensionless units as defined in the SI, e.g. angular units like radians...In particular, we argue that the radian is the appropriate coherent unit for angles and that hertz is not a coherent unit in the SI."

Posted 2 years ago

I too am interested in hearing from others. I'm not an expert in metrology by any measure. I've simply had to work with units in practice. From what I've read, there is still a bit of discussion going on about the most appropriate treatment of the angle measures (2D/3D) and the SI derived unit of Hertz. In my personal case, I see what I would call circular arguments (eg, radians has the unit-like symbol rad, but it is dimensionless being equivalent to m m^-1). If it is dimensionless, why does it have a unit?

In the case of Hz, this SI derived unit is defined to be equivalent to s^-1, but radian/sec is also defined to be equivalent to s^-1. That seems to be an ambiguity. Also, if I'm counting the rate that some event is occurring, I normally think that using Hz or s^-1 are acceptable ways of describing that rate. That rate may have no connection to a rotational/wave process. So, it would seem inappropriate to apply an angular measure.

Interesting discussion. My guess is that WL had to make some practical design decisions about computational use of units/quantities. The best practice that I've found is to be consistent with handling units/quantities. And, using units/quantities is not the most efficient (wrt, execution time) way to perform a every computation. I hope someone from WRI can provide some additional information.

Besides the interesting discussion about radians considered or not as dimensionless units (just read about why they shouldn't be dimensionless [1]), you can have your own simple QuantityMagnitude that effectively normalizes radians:

quantityMagnitudeRadians[q_, unit_] := QuantityMagnitude[q/Quantity[1, unit]]

This would work for all these cases:

In[64]:= quantityMagnitudeRadians[5, "Radians"]
Out[64]= 5

In[59]:= quantityMagnitudeRadians[Quantity[4, "Radians"], "Radians"]
Out[59]= 4

In[60]:= quantityMagnitudeRadians[Quantity[4, 1/"Seconds"], "Radians"/"Seconds"]
Out[60]= 4

In[61]:= quantityMagnitudeRadians[Quantity[4, "AngularDegrees"], "Radians"]
Out[61]= \[Pi]/45

In[62]:= quantityMagnitudeRadians[Quantity[4, 1/"Seconds"], "Radians"/"Seconds"]
Out[62]= 4

In[63]:= quantityMagnitudeRadians[Quantity[4, "AngularDegrees"/"Seconds"], "Radians"/"Seconds"]
Out[63]= \[Pi]/45


First of all, thanks very much for the code - this essentially solves my problem (I don't like that it doesn't yell at me if I try to "drop" units that shouldn't be dropped, but the original function doesn't do that either so I'll just have to add that functionality). It's both obvious in retrospect (which is good, since it is easy to explain to students!) but also very clever, so thank you for that!

In case there are any non-mathematica experts who are as confused by how it could work as I was, I think you must have changed your notation part way through (or I am still confused). To make it work I had to rewrite it as:

qmr[q_, unit_] := QuantityMagnitude[q/Quantity[1, unit]]

Is there a better/more standard way of doing this with your args__ argument?

As for the reference, thank you. I had read a longer (earlier) paper by the same authors (the one I referenced) where it seems that they were making a slightly different case - that radians are the natural (coherent) unit that should be treated as dimensionless (and that Hz should be treated as cycles/second and not 1/s). But I was wrong in my belief that this opinion was anywhere near unanimous - I'm sorry about that.

So thanks again, Eric

Thanks, that's what I meant (sorry, I had a couple of versions, and I mixed when copy/pasting). I edited my version with the right definition too.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract