Is there a way to work with angles in DMS without converting them to decimal degrees, that is to sum them, subtract them?
I do not know how to even enter it without using string. My idea is something like: 20°32'15.828'' - 22°32'12.8''
.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityIs there a way to work with angles in DMS without converting them to decimal degrees, that is to sum them, subtract them?
I do not know how to even enter it without using string. My idea is something like: 20°32'15.828'' - 22°32'12.8''
.
You may use either MixedRadixQuantity
or Quantity
with MixedMagnitude
and MixedUnit
.
In both cases the units you need are {"AngularDegrees", "ArcMinutes", "ArcSeconds"}
.
p1 = MixedRadixQuantity[{20, 32, 15.828}, {"AngularDegrees", "ArcMinutes", "ArcSeconds"}];
p2 = MixedRadixQuantity[{22, 32, 12.8}, {"AngularDegrees", "ArcMinutes", "ArcSeconds"}];
p1 - p2
(* Quantity[MixedMagnitude[{-1, -59, -56.972}],
MixedUnit[{"AngularDegrees", "ArcMinutes", "ArcSeconds"}]] *)
From the output above you can see the longer form using Quantity
.
Hope this helps.
dms=MixedRadixQuantity[#, {"AngularDegrees", "ArcMinutes", "ArcSeconds"}]&
$\endgroup$
– Edmund
Aug 27 '16 at 23:14