Local maximum definition What is  the  Analyse definition  of  local  maximum  point 
I am not talking  about this :
If  a function  f  is defined for  all $
\hspace{0.33em}{x}\mathrm{\in}{I}
$ Not indeed the full definition set 
 / I mean  ${I}$  can be a subset of the definition set of the function f/
then if $
{f}{\mathrm{(}}{a}{\mathrm{)}}\mathrm{\geq}{f}{\mathrm{(}}{x}{\mathrm{)}}
$
 For all $
\hspace{0.33em}{x}\mathrm{\in}{I}
$
Then  f(a) is  a local  maximum  point ..
But I read  a book  about this 
That said 
Again :If  a function  f  is defined for  all $
\hspace{0.33em}{x}\mathrm{\in}{I}
$
And  we have  the  OPEN interval J
Where  $
\hspace{0.33em}{a}\mathrm{\in}{J}
$
And  we take the Intersection $
{I}\mathrm{\cap}{J}
$  and  we  called it D
So if   $
{f}{\mathrm{(}}{a}{\mathrm{)}}\mathrm{\geq}{f}{\mathrm{(}}{x}{\mathrm{)}}
$
 for  all  $
\hspace{0.33em}{x}\mathrm{\in}{D}
$ then  f(a) is  local maximum point.
I want  to know  what is  the  difference  between the  above  definitions of a local maximum point?
indeed why  J is  an Open interval ?
I will be thankful for anyone who helps me 
 A: Let $f:D\rightarrow \mathbb{R}$ be a function with domain $D$.
When we say that $x_0$ is a local maximum (minimum) of $f$, intuitively, we want a neighborhood of $x_0$ satisfying that $f(x_0)$ gives the maximum value in that neighborhood. So here we need to think about what a neighborhood means. From the point of view in topology, $N$ is a neighborhood of $x_0$ if $\exists$ open set $G$ such that $x_0\in G\subset N$. 
In the case $D\subset \mathbb{R}$, an open set can be written into countable union of open intervals, so without loss of generality, we can regard $J$ as an open interval. Also, it does not necessarily be an open interval (as long as it is a neighborhood of $x_0$ is okay. i.e. $\epsilon>0$ s.t. $(x_0-\epsilon,x_0+\epsilon)\subset J$. Indeed they are equivalent statements.). Using $J$ as an open interval in some sense keeps the consistency with topology (I mean the more general case that $D$ may be a subset of a topological space rather than $\mathbb{R}$).
To answer your first question, $I$ is just an arbitrary subset of $D$, so it may not be a neighborhood of $x_0$, say $I=\{1\}\cup(2,3)$, and $f(x)=|x|$. Then it satisfies the first definition but not the second. However, we know that $1$ is not a local minimum nor a local maximum.
