1

i plotted the number line which includes (0,1) interval

\begin{tikzpicture}
 \begin{axis}[
            axis x line=middle,
            axis y line=none,
            height=50pt,
            width=\axisdefaultwidth,
            xmin=0,
            xmax=1, ]
     \addplot coordinates {
                (1,0) (0.5,0) (0.3,0) (0.25,0) (0.625,0)
                }; 
      \end{axis}
\end{tikzpicture}  

So far i putted 5 dots on line but i want to put all elements of the sequence

$ \{ a_n \}=\frac{1}{n}$ which has infinitely many elements.

secondly i used xtick={0,0.125,0.250.5,1} and it was not give any good result, it corrupt the number line :)

Thanks in advance

  • Your sequence is a normal function, so you could plot the function 1/x. – TeXnician Mar 31 '17 at 15:38
  • it is not a function it is squence so, the elements of a squence must represented by points @TeXnician – Alper Erdem Mar 31 '17 at 15:41
  • as n is natural number which starts from 1,2,3,... graph must include the points that (1, 1\2, 1\3, 1\4, 1\5, .... ) @TeXnician – Alper Erdem Mar 31 '17 at 15:49
  • A sequence is a function whose domain is a subset of the integers: see here for example. – DJP Mar 31 '17 at 16:18
2

enter image description here

\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
  ymin = 0,
  ymax = 1,
  xmin = 0,
  xmax = 100,
  axis x line=center,
  axis y line=left]
    \addplot[samples at={1,...,100},only marks,mark size=0.2]{1/x};
  \end{axis}
\end{tikzpicture}
\end{document}
  • Excactly what I suggested and the OP rejected ;) – TeXnician Mar 31 '17 at 15:51
  • thanks , it was excatly what i want to do @TeXnician :P but i need the projection of the points onto y axis so it can be represented with (0,1) line which covered by number line – Alper Erdem Mar 31 '17 at 15:54
  • @TeXnician Maybe the misunderstanding was about "plotting a normal function". If one identifies normal or plotting with continuous, then this is not what the OP wanted. – gernot Mar 31 '17 at 16:07
2

Is this what you want then, or am I just confused as usual?

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
            axis x line=middle,
            axis y line=none,
            height=50pt,
            width=\axisdefaultwidth,
            xmin=0,
            xmax=1, ]
     \addplot[samples at={1,...,100},only marks,mark size=1,blue] (1/x,0);
\end{axis}
\end{tikzpicture}  
\end{document}
  • thanks @Torbjørn T. , you understand what i want better than me :) – Alper Erdem Mar 31 '17 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.