# Displaying a vector as a length at an angle

This may prove to be simple, but i have not been able to figure it out (nor am i sure if it can even be done in Mathematica).

I use vectors in electrical engineering as a polar, length and angle (in degrees). But Mathematica insist on displaying vectors in polar as a length and angle (in radians or something) and i need the degrees for my results.

URg = AngleVector[{UnitConvert[I*Rg, "Volts"],
Quantity[30, "AngularDegrees"]}]
{Quantity[2.07846, "Volts"], Quantity[1.2, "Volts"]}


I have tried something like this, but as far as i can see and understand, the program recognizes the degrees in the formula, but won't display it as degrees in the result.

I looked up function like ToPolarCoordinates, but it still doesn't work properly.

Hooping someone has some guidance or at least some good suggestions.

• I'm not totally sure I understand the problem. From what I understand, AngleVector[{r,theta}] gives the Cartesian coordinates of the polar coordinate {r,theta}, so to get the angle "back", one would have to do something like N[ArcTan @@ (QuantityMagnitude@URg)/Degree]. Please correct me if I've misunderstood, though! – Anne Nov 15 '17 at 21:46
• Try "Degree" not "AngularDegrees". – David G. Stork Nov 15 '17 at 21:47
• You could probably modify the solutions here so that angles are shown in degrees instead of radians. – J. M.'s discontentment Nov 16 '17 at 1:30
• @Anne That way i can calculate the angle afterwards yea, but i want the initial definition to recognize the angle in degrees Something like this {Quantity[2.07846, "Volts"] \[Angle] Quantity[30, "AngularDegrees"]} Basiclly i need the polar coordinates displayed as {r,Degree} – Jamie Nov 16 '17 at 7:20
• @DavidG.Stork That didn't change anything sadly, tried it before posting here and just double checked. – Jamie Nov 16 '17 at 7:23

Putting this in an answer for space/formatting capabilities.

If you're starting with some complex number, say $z=1+i\sqrt{3}$ for example, AbsArg will get you the polar representation of $z$ (in radians):

z = 1 + Sqrt*I;
AbsArg[z]

(*{2, \[Pi]/3}*)


You can then convert this to degrees (many ways to do this of course):

zpolar = MapAt[#*180/Pi &, AbsArg[z], 2]

(*{2, 60}*)


If you want the end results to be "Quantities":

MapThread[Quantity, {zpolar, {"Volts", "AngularDegrees"}}]

(*{Quantity[2, "Volts"], Quantity[60, "AngularDegrees"]}*)


You can also do something similar if you use Quantities in your z, I believe.

Hopefully this is something along the lines of what you had in mind!

vec={4,5};

{r, Theta} = ToPolarCoordinates[vec]
(*{Sqrt,ArcTan[5/4]}*)

polarvec = {r, N[Theta]/°}
(*{Sqrt,51.3401}*)


Now your vector is in {r, theta} with theta in degrees.

If you want to add two vectors, or do about any other operations on them, Mathematica really wants the vector in rectangular coordinates. Kind of kludgy, but you can do something like:

polarURG = {2.4  V, 30 °}
polarUXL = {4.8 V, 60 °}

$Assumptions = V > 0 (FromPolarCoordinates[polarURG] + FromPolarCoordinates[polarUXL]) // ToPolarCoordinates[#] & // Simplify PolarSum = {%[], N[%[]]/°} (*{6.982350 V,0.874478}*) (*{6.9823509 V,50.103909}*)  • Okay, so i got that to work for the most part. But i ran into the problem, that with having to different vectors defined this way, i couldn't get mathematica to add them togehter as vectors? it just adds the values togehter as in polarURg={2.4V,30\[Degree]}; polarUXL={4.8V,60\[Degree]}; Esys=polarURg+polarUXL; Esys={7.2V,90\[Degree]} – Jamie Nov 19 '17 at 17:36 • So this mostly works, but it seems like i can't use Quantity values this way? I am guessing that it's because of the $Assumption=V>0 which i tried to use as $Assumption="Volts">0, but i don't fully understand what this is supposed to do (i believe it is used for the simplify function?). – Jamie Nov 20 '17 at 11:03 • I have it setup as polarURg={Quantity[2.4,"Volts"],30\[Degree]} polarUXL={Quantity[4.8,"Volts"],60\[Degree]} $Assumption="Volts">0 and this gives me {Quantity[6.98235, "Volts"], ArcTan[Quantity[4.47846, "Volts"], Quantity[5.35692, "Volts"]]} and Quantity[6.98235, "Volts"], ArcTan[Quantity[4.47846, "Volts"], Quantity[5.35692, "Volts"]]/\[Degree] – Jamie Nov 20 '17 at 11:03