Different definitions of regular map (between affine varieties)? On Robin Hartshone's Algebraic Geometry book, on page 15, the concept of a regular function is given as follows:

A function $f$ from a affine variety $Y$ to the base field $k$ is regular at a point $x$ if there exists an open neighborhood $U$ of $x$ and $p,q\in k[x_1,x_2,\ldots , x_n]$ such that $f=p/q$ on $U,$ and $q\neq 0$ on $U.$

Now, the definition on Wikipedia looks a bit different. Let me summarise it as follows:

A regular map $Y \to \mathbb A^1(=k)$ is called a regular function. So, if we write out the entire definition, $f:Y \to k$ is regular at point $x$ if in a neighborhood $U$ of $x$, $f=p,$ where $p\in k[x_1,\ldots,x_n] /I(Y).$ $I(Y)$ is the ideal such that $Y=Z(I(Y)).$ (The quotient "$/Y(I)$" on the ring does not actually make a difference to the definition and can be ignored)

Why the definition of Wikipedia doesn't involve quotient polynomials of any sort, but the definition on the books allows the quotient $p/q$?
 A: Let $k$ be a field and let $\mathbb{A}^n(k)$ denote the set of all $n$-tuples
$(a_1,..,a_n)$ with $a_i\in k$ for all $i=1,..,n$.
Let $X:=Z(I)\subseteq \mathbb{A}^n(k)$ be the zero set of an ideal $I\subseteq k[x_1,..,x_n]$. Hence $X$ is by definition the set of $n$-tuples $a:=(a_1,..,a_n)\in \mathbb{A}^n(k)$ with $f(a)=0$ for all polynomials $f\in I$.
Let $Y:=Z(J)\subseteq \mathbb{A}^m(k)$ with $J\subseteq k[y_1,..,y_m]$.
Definition 1: Let $U\subseteq X \subseteq \mathbb{A}^n(k)$ be an open set (the complement of a Zariski closed set), and let $f: U \rightarrow k$ be a map of sets. The map $f$
is a "regular map" iff for any point $x\in U$ there is an open set $x\in U(x) \subseteq U$ and polynomials $p,q\in k[x_1,..,x_n]$ such that $f_{U(x)}=\frac{p}{q}$ on $U(x)$.
Here the notation $f_{U(x)}$ means "the restriction of $f$ to the open subset $U(x)$".
If $U\subseteq X$ is a Zariski open set, let $\mathcal{O}_X(U)$ denote the set of regular maps $f:U \rightarrow k$ in the sense of Definition 1.
Lemma. The set $\mathcal{O}_X(U)$ is a $k$-algebra for any open set $U\subseteq X$.
If $V\subseteq U\subseteq X$ are open sets, there is a canonical restriction map
$\rho_{U,V}: \mathcal{O}_X(U) \rightarrow \mathcal{O}_X(V)$.
This defines a sheaf of $k$-algebras $\mathcal{O}_X$ on $X$.
Proof. This holds because the definition of "regular map" in Definition 1 is local.
You may define $\mathcal{O}_{X,x}:= lim_{x\in U}\mathcal{O}_X(U)$ and it follows $\mathcal{O}_{X,x}$ is a local ring. The pair $(X, \mathcal{O}_X)$ is a locally ringed space.
Hartshorne defines a map $\phi: X \rightarrow Y$ to be a "morphism of algebraic varieties" iff for every open set $V\subseteq Y$ and every regular map $f:V\rightarrow k$, it follows the map
$f\circ \phi: \phi^{-1}(V) \rightarrow k$ is a regular map. This defines a map
$\phi^{\#}(V):\mathcal{O}_Y(V) \rightarrow \mathcal{O}_X(\phi^{-1}(V)):=\phi_*\mathcal{O}_X(V)$
by $\phi^{\#}(V)(f):=f \circ \phi$. This again corresponds to a map of sheaves
$\phi^{\#}: \mathcal{O}_Y \rightarrow \phi_*\mathcal{O}_X$.
Hence Hartshorne is implicitly defining a map of locally ringed spaces in chapter I in his book.
Your comment: "A function f from a affine variety Y to the base field k is regular at a point x if there exists an open neighborhood U of x and p,q∈k[x1,x2,…,xn] such that f=p/q on U, and q≠0 on U."
When Hartshorne defines "regular map", he implicitly defines the structure sheaf $\mathcal{O}_X$ on $X$. In this language you may speak of a morphism of varieties
$\phi: X \rightarrow \mathbb{A}^1(k)$. When $k$ is algebraically closed Hartshorne proves in Theorem I.3.5 the isomorphism
$Hom_{var}(X,Y) \cong Hom_{k-alg}(A(Y), A(X))$
where $A(X), A(Y)$ are the coordinate rings of $X,Y$. Hence in the case when $Y=\mathbb{A}^1(k)$ it follows
$Hom_{var}(X,Y)=Hom_{k-alg}(k[x], A(X)) \cong A(X)$.
Your question: "Why the definition of Wikipedia doesn't involve quotient polynomials of any sort, but the definition on the books allows the quotient p/q?"
Answer: You should not use wikipedia as a reference, instead you should use a book that has been in use "for a while". Most books contain errors, but the fact that a book is popular and has been reprinted several times is a sign it is a good book.
It seems to me you confuse the notion "regular map" and "morphism of algebraic varieties" when you write the equality $\mathbb{A}^1 (=k)$, and this confusion may be because of wikipedia.
Anyone can write on wikipedia, and there is noone checking the quality of what is written there.
Example: What happens when the base field $k$ is not algebraically closed?
Let $k:=\mathbb{R}$ be the field of real numbers and consider $X:=\mathbb{A}^1(k)$. What is the ring of global regular maps $\Gamma(X, \mathcal{O}_X)$ from Definition 1 in this case? Is it the polynomial ring $k[x]$?
Let $z:=a+ib$ with $a,b \in k$ and $b\neq 0$ and define
$p_z(x):=(x-z)(x-\overline{z})=x^2-2ax+a^2+b^2 \in k[x]$.
Let $S$ be the multiplicatively closed set of functions on the form $p_{z_1}(x)\cdots p_{z_l}(x)$ with $z_i \in \mathbb{C}-\mathbb{R}$. It follows we may construct the localization $B:=S^{-1}(k[x])$. Choose an element $f(x):=\frac{p(x)}{q(x)}\in B$. It follows the function $f(x)$ defines a regular map
$f(x): k \rightarrow k$
since $q(x)\neq 0$ on $X$. Hence there is a canonical inclusion
$B \subseteq \Gamma(X, \mathcal{O}_X):=A(X)$.
Hence the global sections $\Gamma(\mathbb{A}^1(k), \mathcal{O}_{\mathbb{A}^1(k)})$ is much larger than $k[x]$ when $k$ is not algebraically closed.
If you define the spectrum $Y:=Spec(\mathbb{R}[x])$, its topological space has as points prime ideals in $A:=\mathbb{R}[x]$ and the prime ideals in $A$
are the following: The zero ideal $(0)$ and maximal ideals. A maximal ideal
is on the form $(p(x))$ where $p(x)\in A$ is an irreducible polynomials
and $p(x)$ is irreducible iff $p(x)=(x-r)$ for $r\in \mathbb{R}$
or $p(x)=p_z(x)$ for $z\in \mathbb{C}-\mathbb{R}$. The ring of global sections $\Gamma(Y, \mathcal{O}_Y)=\mathbb{R}[x]$, hence in this case you "recover" the ring $\mathbb{R}[x]$ when calculating global sections of $\mathcal{O}_Y$. Hence the structure sheaf of the spectrum $Spec(\mathbb{R}[x])$ has fewer global sections than the structure sheaf of $\mathbb{A}^1(k)$. When studying "real algebraic geometry" one uses the construction in Definition 1 and the space $\mathbb{A}^n(k)$, since functions on the form $\frac{f(x)}{p_{z_1}(x)\cdots p_{z_l}(x)}$ with $f(x)\in \mathbb{R}[x]$ and $z_j \in \mathbb{C}-\mathbb{R}$ are algebraic functions.
Example. You may construct "real projective space" $\mathbb{P}^n(k)$ and its structure sheaf $\mathcal{O}:=\mathcal{O}_{\mathbb{P}^n(k)}$ using Definition 1. With this definition there is a closed embedding of "real algebraic varieties"
$j:\mathbb{P}^n(k) \rightarrow \mathbb{A}^d(k),$
hence "real projective space" is isomorphic to an affine real algebraic variety.
You may construct $\mathbb{P}^n_k:=Proj(k[x_0,..,x_n])$ using Hartshorne, and it follows $\mathbb{P}^n(k)$ is the topological subspace of $\mathbb{P}^n_k$ consisting of $k$-rational points. Hence there is a continuous inclusion of topological spaces
$u: \mathbb{P}^n(k) \rightarrow \mathbb{P}^n_k$.
But the structure sheaves differ much. If we let $U_i \subseteq \mathbb{P}^n(k), V_i\subseteq \mathbb{P}^n_k$ be the open subset where $x_i\neq 0$ it follows
$U_i\cong \mathbb{A}^n(k)$ and $V_i\cong \mathbb{A}^n_k:=Spec(k[y_1,..,y_n])$. And there is an inclusion of rings
S1. $S^{-1}k[w_1,..,w_n] \subseteq \Gamma(U_i, \mathcal{O}_{\mathbb{P}^n(k)})$
where $S$ is the multiplicative subset containing the functions $p_{z_1}(w_1)\cdots p_{z_n}(w_n)$ with $z_i\in \mathbb{C}-\mathbb{R}$.
There is an equality
S2. $\Gamma(V_i, \mathcal{O}_{\mathbb{P}^n_k})=k[y_1,..,y_n]$.
Hence the space $\mathbb{P}^n(k)$ has more local sections in its structure sheaf. The Whitney embedding theorem says that any (real) smooth manifold $M$ of dimension $n$ can be smoothly embedded in $\mathbb{R}^{2n}$. Hence if we view real projective space $\mathbb{P}^n(k)$ with its smooth structure, we can embed $\mathbb{P}^n(k)$ smoothly into $\mathbb{A}^{2n}(k)$. Hence the locally ringed space $(\mathbb{P}^n(k), \mathcal{O}_{\mathbb{P}^n(k)})$ - even though it is "algebraic" - "behaves" like a real smooth manifold in the sense that it can be (algebraically) embedded into affine real space.
Your title was "Different definitions of regular map (between affine varieties)?"
This post illustrates that when you change the notion "regular map" you may algebraically embed real projective space into real affine space, realizing real projective space as an affine algebraic variety of finite type over the real numbers. More generally if $X\subseteq \mathbb{P}^n(k)$ is any algebraic subvariety of real projective space, it follows we may realize $X$ as an affine algebraic sub-variety of real affine space $\mathbb{A}^d(k)$. This is not true if you consider an arbitrary
closed subscheme $Y \subseteq \mathbb{P}^n_k$.
The field "real algebraic geometry" is an independent field. By the above argument you may view real projective space $\mathbb{P}^n(k)$ as a topological subspace of $\mathbb{P}^n_k$ with an "enlarged" structure sheaf and a larger set of regular maps. This larger set of regular maps can be used to realize any real projective variety as a real affine variety.
https://en.wikipedia.org/wiki/Real_algebraic_geometry
