Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

I have a bunch of data to which I've assigned units using Quantity, including some angular measurements in degrees. I'd like to be able to use these measurements with trigonometric functions, but it seems that trig functions don't "know" about Quantity, so I'm forced to convert those measurements to radians and then apply the trig function to the magnitudes, like this:

x = Quantity[23.4, "AngularDegrees"]
Cos[QuantityMagnitude @ UnitConvert[x, "Radians"]]

This works, but it's slow and seems clunky, at best. Is there a more elegant (and hopefully faster) approach?

share|improve this question
What happens if you try x /. Quantity[a_, "AngularDegrees"] :> a °? – J. M. Apr 20 '13 at 1:27
Have you tried using N? – Spawn1701D Apr 20 '13 at 1:40
@J.M.: That's certainly faster--more than an order of magnitude in my quick check. – Cassini Apr 20 '13 at 3:36
@Spawn1701D: How would I use N? – Cassini Apr 20 '13 at 3:36
I don't have installed v9 yet so I can't verified it directly but i was thinking of something like N[Cos[x]]. – Spawn1701D Apr 20 '13 at 3:48

Your Answer


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

Browse other questions tagged or ask your own question.