Precise definition of an "algebraic function" 
Remark. I'd like to avoid the "ring of formal expressions" viewpoint for this question. I know we can avoid these kinds of questions by working "purely algebraically" and in particular by taking the algebraic closure of $K(x).$ But I don't want to do this here.

If I understand the wikipedia article correctly, a function $f$ is algebraic iff there's a polynomial $P(x,y)$ such that the equation $P(x,f(x)) = 0$ is true for all $x$ in the domain of $f$. For example, the function $$[0,\infty) \rightarrow \mathbb{R}, x\mapsto \sqrt{x}$$ is algebraic because $y^2-x$ has this property.
However that article is pretty vague and I'm not sure I quite understand what's being said. In particular, which of the following functions would be considered algebraic?


*

*$(0,\infty) \rightarrow \mathbb{R}, x\mapsto \sqrt{x}$

*$(0,1) \cup (2,3) \rightarrow \mathbb{R}, x\mapsto \sqrt{x}$

*$(0,1) \cup (2,3) \rightarrow \mathbb{R}, x \mapsto \begin{cases}\sqrt{x} & x \in (0,1), \\ -\sqrt{x} & x \in (2,3)\end{cases}$

*$(0,e) \rightarrow \mathbb{R}, x\mapsto \sqrt{x}$

*$[0,\infty) \rightarrow \mathbb{R}, x \mapsto \begin{cases}\sqrt{x} & x \in \mathbb{Q}, \\ -\sqrt{x} & x \notin \mathbb{Q}\end{cases}$


These pertain to different issues, namely:


*

*Does a function have to be defined on the largest possible domain to be considered algebraic?

*Does it have to be defined on a connected set?

*If defined on a disconnected set, do we require that it be extensible to an algebraic function defined on a connected set?

*Can non-algebraic real numbers be used to define the domain of an "algebraic" function?

*Do they have to be continuous?



Question: What are the standards here?

 A: I think that wikipedia page is written for (and by) non-experts.  In fact, that definition is one that you may find frequently.  (In elementary math textbooks; and on-line.  But not in technical math papers.)  The predicament is similar to the definition of "continuous" in elementary calculus courses.
Students learning mathematics, not yet sophisticated enough to grasp the definitions used in more advanced studies, have to be given a simple definition to use.
When mathematicians use the term "algebraic function" they may in fact have in mind a specific situation.  And the definition may vary depending according to the situation.
One example may look like this...

Let $f$ be a holomorphic function defined on a connected open set $U$ in the complex plane.  We say that $f$ is an algebraic function iff there exists a polynomial $P(x,y)$ of two variables with complex coefficients such that $P(z,f(z))=0$ for all $z \in U$.  

There may be other definitions used in other settings.
the examples in the OP
If you take the simplistic definition of the Wikipedia page, then all 5 of your examples are algebraic functions.  Some of them (especially 5) show that the Wikipedia definition is not very useful.  And any instructor in such an elementary course who asks questions such as your 1 to 5 has missed the point: this is a "general idea" definition and not a technical definition.
another situation
Suppose we have the claim  

The function $\mathbb R \to \mathbb R$ defined by $x \mapsto \sin x$ is not an algebraic function 

A proof may go like this...  

A nonzero algebraic function on $\mathbb R$ can have only finitely many zeros.  But $\sin(\pi n) = 0$ for all $n \in \mathbb Z$, so this function has infinitely many zeros.  Therefore it is not algebraic.  

This is a good proof.  But not with the simplistic definiton of "algebraic function".  For example, the function
$$
\phi(x) = \begin{cases}1, \quad x \text{ rational}
\\
0, \quad x \text{ irrational}
\end{cases}
$$
has infinitely many zeros, and satisfies $\phi(x)^2 - \phi(x) = 0$ for all $x$.
A: The definition of algebraic functions in the Wikipedia article is correct. Each solution of an algebraic equation is an algebraic function and vice versa.
If the algebraic equation that defines the algebraic function can be explicitly solved, the algebraic function is explicitly defined. If not, the algebraic function is only implicitly defined.
If the solution of the algebraic equation is explicitly given, the algebraic function is explicitly given.
For the explicitly given algebraic functions, the following holds.
The solution of the algebraic equation gives the function term of the algebraic function. A restriction of an algebraic function is also an algebraic function. If you restrict the domain of the equation, you get another function therefore.
To decide if an explicitly given function is algebraic or not, it is sufficient to look at the function term of that function. The function term of an algebraic function is an algebraic expression of the function variables.
One characteristic property of algebraic functions is that for all algebraic places the function value is also algebraic.
Examples 3. and 5. are not algebraic functions because $\sqrt{x}$ and $-\sqrt{x}$ are different solutions of an algebraic equation.
