A continuous function with positive and negative values but never zero?

Well, it is easy to prove that $e^z$ is never zero and $z$ is any complex number. Also, $e^z$ can be both positive and negative. On the other hand, $e^z$ is continuous. How that's possible that a continuous function can be negative and positive but never meets zero?

Detailed simple explanations would be much appreciated.

-
The intermediate value theorem is valid only for real valued continuous functions. – Paramanand Singh Feb 26 at 17:02
$e^z$ can't be positive or negative, those notions don't exist on the complex plane. – Adam Francey Feb 26 at 17:03
This can't happen for real functions since you can't go from positive to negative on the number line without going through zero. This can happen with complex functions because you can go around zero in the complex plane to go from positive real axis to the negative real axis. – Mark S. Feb 26 at 17:04
@Joanpemo the set of $x+0i$ for real $x$ is commonly referred to as the real axis in the complex plane. When $x$ is positive, you have the positive real (semi)axis. I don't think this is controversial, and was the convention in my courses from precalculus through graduate complex analysis. – Mark S. Feb 26 at 17:08
@L.G. Sure, you can call those numbers negative or positive since their imaginary part happens to be zero. In $\mathbb{R}$, numbers can be positive, negative, or zero. In that sense, numbers in $\mathbb{C}$ can be positive, negative, zero, or neither. – Adam Francey Feb 26 at 17:33

The function $f:\mathbb Q\setminus \{0\}\to \mathbb R$ defined by $f(q)=q$ is continuous at each rational number $q\neq 0$, takes positive and negative values, but is never $0$. The intermediate value theorem is valid for functions $f: I\subset \mathbb R\to\mathbb R$, where $I$ is a closed interval (i.e connected set in $\mathbb R$).

The example you give with $e^z:\mathbb C\to\color{red}{\mathbb C}$ actually doesn't show anything, because there is no total ordering on the complex numbers. Also you can read from Wikipedia:

The intermediate value theorem generalizes in a natural way: Suppose that $X$ is a connected topological space and $(Y, <)$ is a totally ordered set equipped with the order topology, and let $f : X → Y$ be a continuous map. If $a$ and $b$ are two points in $X$ and $u$ is a point in $Y$ lying between $f(a)$ and $f(b)$ with respect to $<$, then there exists $c$ in $X$ such that $f(c) = u$.

Edit: If $f$ is continuous, then the IVT can fail to apply either because the domain of $f$ is not connected, or because the codomain is not totally ordered:

In my example, $\mathbb R$ is totally ordered and the IVT fails to apply because $\mathbb Q\setminus \{0\}$ is not connected.

In the OP example $e^z:\color{blue}{\mathbb C}\to\color{red}{\mathbb C}$, $\quad \color{blue}{\mathbb C}$ is connected and the IVT fails to apply because $\color{red}{\mathbb C}$ is not totally ordered.

-
Thank you very much for your help, esp. for the MSE link and the last paragraph as well. – L.G. Feb 26 at 17:51
The OP doesn't mention connected sets, and satisfying the intermediate value theorem is not necessary to construct an example. All you need is a disconnected open set of reals, for example $S = \{s \in \mathbb R: 1 < |s| < 2\}$ and a function like $f : S \to \mathbb R$ defined by $f(s) = s$. (The set $S$ is the union of two open intervals, $-2 < s < -1$ and $+1 < s < +2$.) – alephzero Feb 26 at 20:00
@alephzero Obviously, if the problem satisfies the IVT then $f$ must take the value $0$. On the other hand, not satisfying the IVT can happen either because the domain of $f$ is not connected (as my example with $f:\mathbb Q\setminus \{0\}\to \mathbb R$, or your example) or because the codomain is not totally ordered, as it is in the OP example $e^z:\color{blue}{\mathbb C}\to \color{red}{\mathbb C}$ - here $\color{red}{\mathbb C}$ is not totally ordered, but $\color{blue}{\mathbb C}$ is connected. – Svetoslav Feb 26 at 20:07
A technical point: there are total orderings on the complex numbers. But the topology of the complex plane is not given by any of them. In terms of the Wikipededia quote, the complex plane is not "equipped with" an order topology. There is also no ordered field structure on the complex numbers. But the complex numbers are totally ordered for example by saying one complex number is less than another whenever the first has smaller real part, or if the real parts are equal and the first has smaller imaginary part. – Colin McLarty Feb 27 at 11:38
@ColinMcLarty Thanks for the clarification. Feel free to add something or edit my answer. – Svetoslav Feb 27 at 11:58

If you remove zero from $\mathbb{R}$ the result is a disconnected set whereas if you remove zero from $\mathbb{C}$, it is still connected.

If $f$ is a continuous function on a connected set $C$, then $f(C)$ is connected.

Hence if $f$ is a real valued continuous function that never takes the value zero, then we must have $f(C) \subset (-\infty, 0)$ or $f(C) \subset (0, \infty)$, so it cannot take both positive and negative values.

If $f$ is a complex valued continuous function that never takes the value zero, then all we can really say is that $f(C) \subset \mathbb{C} \setminus \{0\}$.

An analogy is that I can't pass a car on a single lane road (well, maybe...), but I can easily walk around an obstacle in the middle of a field.

-
Talking in analogy, if a car has to be always on the ground (~continuity) and on one line (~real numbers) so the intermediate value theorem in a sense means an obligation to go through the origin. But in complex field, possibility of walking around the origin means two facts: 1- "intermediate value theorem is valid only for real valued continuous functions", 2- our field is more than just positive and negative. Am I right? Thank you. – L.G. Feb 26 at 17:41
@L.G. Yes, the field of the complex numbers is more than just positive and negative numbers. It is not totally ordered set, and so the intermediate value theorem doesn't apply there. – Svetoslav Feb 26 at 17:45
Thank you very much for your help, esp. for the analogy. – L.G. Feb 26 at 17:52

It depends of the domain( for a real valued function)of the function. If it is connected, it is impossible, since the image of a connected space by a continuous function is connected. For a complex function the notion of positive and negative don't exist

-
The key point is that the complex plane with 0 deleted is connected but the real line with 0 deleted is not. – Mark S. Feb 26 at 17:09
This is misleading. C is connected!! – Dorebell Feb 26 at 17:12