
Math & Science ⇒ Illustration of a mathematical progression
-
- Posts: 3
- Joined: Thu Jun 30, 2011 12:01 pm
Illustration of a mathematical progression
I want to know how to make an illustration that plots a sequence such as ${a_n} = 1/n^2$, where n is a natural number, using either pstricks or tikZ. I don't want to use Mathematica or Maple to do this since I want to heavily customize my diagram with specific labels and markers to illustrate the idea of a convergent sequence in real analysis. Any help would be deeply appeciated!! 

Last edited by Atticus_Freeze on Thu Jun 30, 2011 9:01 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

Illustration of a mathematical progression
One possibility is as follows:
I drew the dots within the nodes, this way they are not affected by the scaling factors of the beginning of the picture. To see this, replace the line with the node by simply
Note that this sequence is not a very nice sequence to draw, as it converges rather quickly to 0.
Code: Select all
\begin{tikzpicture}[xscale=0.5,yscale=4]
\draw[->] (0,0) -- (10,0) node[right] {$x$};
\draw[->] (0,0) -- (0,1) node[left] {$y$};
\foreach \n [evaluate=\n as \y using 1/\n^2] in {1,...,10}{
\node at (\n,\y) {\tikz{\fill[blue] (0,0) circle[radius=1pt];}};
}
\end{tikzpicture}
Code: Select all
\fill[blue] (\n,\y) circle[radius=1pt];
-
- Posts: 162
- Joined: Wed Jun 17, 2009 10:18 pm
Illustration of a mathematical progression
You could also write it as
Another possibility using pgfplots:
Code: Select all
\begin{tikzpicture}[xscale=0.5,yscale=4]
\draw[->] (0,0) -- (10,0) node[right] {$x$};
\draw[->] (0,0) -- (0,1) node[left] {$y$};
\foreach \n [evaluate=\n as \y using 1/\n^2] in {1,...,10}{
\node at (\n,\y) [fill=blue,circle,inner sep=0pt,minimum size=1pt] {};
}
\end{tikzpicture}
Code: Select all
\documentclass[a4paper]{article}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[samples at={1,2,...,10},ymin=0]
\addplot+[only marks,mark size=1pt] {1/x^2};
\end{axis}
\end{tikzpicture}
\end{document}
-
- Posts: 3
- Joined: Thu Jun 30, 2011 12:01 pm
Re: Illustration of a mathematical progression
Thank you very much, both of you. Also, 1/n^2, wasn't a good choice. I picked it hastily, but really, I just wanted an example for any convergent sequence. Thanks alot!