Why is the magnitude of the unit circle only 1 for positive inputs?

71 Views Asked by At

During computations with Matlab (Symbolic Math) a formula with the absolute value of a complex number came up. The expression consists of $sin(x)$ and $cos(x)$ terms, which lead to the absolute value not being simplified. I tracked the problem down and found that the expression $|sin(x)+i\cdot cos(x)|$ only computes to equal $1$ if $x$ is assumed positive.

What is the explanation for this since the plot of this function equal $1$ for any $x$?

EDIT: As explained in the comments and first answer I understand that if $x$ is complex the expression doesn't necessarily equal $1$. But even if declaring $x$ to be real, Matlab cannot compute the absolute value. Only after saying $x>0$, similar to the answer that Wolfram|Alpha gives (under: Alternate form assuming x is positive): https://www.wolframalpha.com/input/?i=%7Csin%28x%29%2Bi*+cos%28x%29%7C

EDIT 2: Nevermind about the Matlab-Part of the question. It is indeed enough to specify that $x$ should be real.

1

There are 1 best solutions below

3
On BEST ANSWER

If $x$ is a complex number than this expression need not equal 1. If $x$ is real Matlab should be able to simplify this to $1$. It seems that in general Matlab assumes numbers to be complex if not told otherwise. If you tell it that $x>0$, this implicitly also means that $x$ is real, hence Matlab simplifies successfully.