3

siunitx accepts complex numbers given in rectangular format. In LaTeX, a polar complex number can be written as <number>\angle<angle value>^{<degree symbol>}, but siunitx does not accept such format, simply because it contains symbols rather than numbers.

Of course, I can convert a value from polar to rectangular, but in electrical engineering, polar formats may contain important information that we cannot see directly in a rectangular one. Is there a command or custom code that I can use to let siunitx accept commands in polar format? Ideally, the command should be as follows

\polar[<angle options>]{<magnitude>}{<angle>} where <angle options> specify whether the angle is in degrees or radians and the possibility to enter the angle in one unit but convert it to another when typeset.

siunitx should then process the magnitude just as it process any other number (e.g., by adding an exponent or decimal digits). It should process the angle only by approximating it to certain decimal digits or significant figures, but without converting it to an exponential format.

Here is an example of what I am looking for. However, instead of entering the number manually and adding \si{<unit>}, I would like to use \SI{<value>}{<unit>}.

enter image description here

\documentclass{book}

\usepackage{mathtools}

\usepackage{siunitx}
\sisetup{scientific-notation=engineering,exponent-product=\cdot,exponent-to-prefix=true}
\sisetup{add-decimal-zero=true,add-integer-zero=true,round-integer-to-decimal=false,zero-decimal-to-integer=true}

\renewcommand{\deg}{\SIUnitSymbolDegree}

\begin{document}

The output I get $3000\angle-36.9^{\deg} \si{\ampere}$

\vspace{0.5\baselineskip}

The output I want $3\angle-36.9^{\deg} \si{\kilo\ampere}$

\SI{value}{unit commands}

\end{document}
  • Why not use $3\exp(-36.9j/180)$ (or i for non-electrical engineers)? – John Kormylo Apr 29 at 15:55
  • A number in polar form with angle symbol is more readable because it does not have power (even if you decide to use power in singe line, then the expression will stretch over long horizontal space resulting in different kind of non-readability). The existence of an multiple exponents can make the work look more complex than it really is. Also, we sometimes use exponents to capture damping characteristics. Thus, when multiple exponents exist in the text, it would be harder to (at a glance) distinguish exponents related to damping and the ones that are operators for a complex number. – Al-Motasem Aldaoudeyeh Apr 29 at 16:23
4

i suspect that you like to have something like this:

\documentclass{book}
\usepackage{mathtools}

\usepackage{siunitx}

\begin{document}

The output I want $3\angle-36.9^{\deg} \si{\kilo\ampere}$:

\SIrange[range-units=single,range-phrase = \angle]{3}{-36.9}{\degree\;\kilo\ampere}

\end{document}

option for \SIrange you can move to sistup.

enter image description here

  • This workaround provides a systematic way to enter raw data then process them. However, you are using the range to substitute angle for a range-phrase. It works for single entry. For the sake of completion, what if I want to enter a range of polar complex numbers with and each being formatted according to siunitx? [it is not entirely valid to say a range of complex numbers, but I mean, for example, a set of complex numbers of different magnitudes but the same angle]. Also, the solution you suggest cannot convert exponents to prefixes, e.g., does not convert \SI{3000}{\ampere} to 3 kA – Al-Motasem Aldaoudeyeh Apr 29 at 14:40
4
\documentclass[border=12pt,12pt]{standalone}

\usepackage{steinmetz}
\usepackage{siunitx}

\begin{document}
Playing with $3 \phase{-36.9^\circ} \; \si{\kilo\ampere}$ is fun!
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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