How do you represent this illustration of the Bolzano-Weiestrass theorem with tikz or pgfplots?
The result is similar to Sebastiano's answer but it is made without drawing tool but with plots instead. The rationale for that is that, if you have an actual series, you can also plot it with something like
\draw[only marks,mark=*]
plot[samples at={1,...,15}] ({-1+5*(1+5*pow(-1,\x)/(2+\x))/\x},0);
Full code:
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\begin{document}
\begin{tikzpicture}[decoration={calligraphic brace, amplitude=6pt}]
\draw (-6,0) -- (6,0) (0,0.2) -- (0,-0.2) node[below]{$0$}
foreach \X in {-,} {(\X5.5,0.2) -- (\X5.5,-0.2) node[below] {$\X M$}} ;
\draw[only marks,mark=*]
plot[samples at={1,...,15}] ({-1+5*(1+5*pow(-1,\x)/(2+\x))/\x},0)
plot[samples at={1,...,5}] ({-\x},0);
\draw[decorate,thick] (-5.5,0.4) -- node[above=1ex](I1){$I_1$} (0,0.4);
\draw[decorate,thick] (0,-0.8) -- node[below=1ex]{$I_2$} (I1|-0,-0.8);
\draw[latex-] (-4,-0.1) --++ (0,-1) node[below]{$a_{n_1}$};
\draw[latex-] (-1,0.1) --++ (0,1) node[above]{$a_{n_2}$};
\end{tikzpicture}
\end{document}
This is only a draw created with Mathcha (https://www.mathcha.io/editor) that I like very much. This tool does not create perfect drawings or very short code as you can see. For a user who wants to create simple images this tool can be used as a help if you need to have a code quickly. Obviously I invite you to read the TikZ
manual with its commands to create more beautiful drawings than this that I am attaching. It is only an idea of your image.
%% Compile and read me!
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,tikz}
\begin{document}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Straight Lines [id:da9924624130587041]
\draw (112.33,111.33) -- (519.67,110) ;
%Straight Lines [id:da8964467018788844]
\draw (130.67,101.67) -- (130.67,117.67) ;
%Straight Lines [id:da11386151785300402]
\draw (270.67,102.33) -- (270.67,118.33) ;
%Straight Lines [id:da13122160840712382]
\draw (375.67,102) -- (375.67,118) ;
%Straight Lines [id:da3445450640481962]
\draw (491,102) -- (491,118) ;
%Shape: Brace [id:dp6200800570089593]
\draw (375.5,97) .. controls (375.5,92.33) and (373.17,90) .. (368.5,90) -- (265.09,90) .. controls (258.42,90) and (255.09,87.67) .. (255.09,83) .. controls (255.09,87.67) and (251.76,90) .. (245.09,90)(248.09,90) -- (138.5,90) .. controls (133.83,90) and (131.5,92.33) .. (131.5,97) ;
%Shape: Circle [id:dp6841067146425215]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (147.33,110) .. controls (147.33,107.97) and (148.97,106.33) .. (151,106.33) .. controls (153.03,106.33) and (154.67,107.97) .. (154.67,110) .. controls (154.67,112.03) and (153.03,113.67) .. (151,113.67) .. controls (148.97,113.67) and (147.33,112.03) .. (147.33,110) -- cycle ;
%Shape: Circle [id:dp6659880770508297]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (177.33,110.33) .. controls (177.33,108.31) and (178.97,106.67) .. (181,106.67) .. controls (183.03,106.67) and (184.67,108.31) .. (184.67,110.33) .. controls (184.67,112.36) and (183.03,114) .. (181,114) .. controls (178.97,114) and (177.33,112.36) .. (177.33,110.33) -- cycle ;
%Shape: Circle [id:dp9504700751081823]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (206.67,110.33) .. controls (206.67,108.31) and (208.31,106.67) .. (210.33,106.67) .. controls (212.36,106.67) and (214,108.31) .. (214,110.33) .. controls (214,112.36) and (212.36,114) .. (210.33,114) .. controls (208.31,114) and (206.67,112.36) .. (206.67,110.33) -- cycle ;
%Shape: Circle [id:dp09029872211584267]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (236.67,110.33) .. controls (236.67,108.31) and (238.31,106.67) .. (240.33,106.67) .. controls (242.36,106.67) and (244,108.31) .. (244,110.33) .. controls (244,112.36) and (242.36,114) .. (240.33,114) .. controls (238.31,114) and (236.67,112.36) .. (236.67,110.33) -- cycle ;
%Shape: Circle [id:dp8167826233391373]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (386.67,109.67) .. controls (386.67,107.64) and (388.31,106) .. (390.33,106) .. controls (392.36,106) and (394,107.64) .. (394,109.67) .. controls (394,111.69) and (392.36,113.33) .. (390.33,113.33) .. controls (388.31,113.33) and (386.67,111.69) .. (386.67,109.67) -- cycle ;
%Shape: Circle [id:dp8722255959836276]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (427.33,109.67) .. controls (427.33,107.64) and (428.97,106) .. (431,106) .. controls (433.03,106) and (434.67,107.64) .. (434.67,109.67) .. controls (434.67,111.69) and (433.03,113.33) .. (431,113.33) .. controls (428.97,113.33) and (427.33,111.69) .. (427.33,109.67) -- cycle ;
%Shape: Circle [id:dp3361929558883294]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (447.33,109.67) .. controls (447.33,107.64) and (448.97,106) .. (451,106) .. controls (453.03,106) and (454.67,107.64) .. (454.67,109.67) .. controls (454.67,111.69) and (453.03,113.33) .. (451,113.33) .. controls (448.97,113.33) and (447.33,111.69) .. (447.33,109.67) -- cycle ;
%Shape: Circle [id:dp28390041233762386]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (474,109.67) .. controls (474,107.64) and (475.64,106) .. (477.67,106) .. controls (479.69,106) and (481.33,107.64) .. (481.33,109.67) .. controls (481.33,111.69) and (479.69,113.33) .. (477.67,113.33) .. controls (475.64,113.33) and (474,111.69) .. (474,109.67) -- cycle ;
%Shape: Circle [id:dp9615854303539904]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (279.33,111) .. controls (279.33,108.97) and (280.97,107.33) .. (283,107.33) .. controls (285.03,107.33) and (286.67,108.97) .. (286.67,111) .. controls (286.67,113.03) and (285.03,114.67) .. (283,114.67) .. controls (280.97,114.67) and (279.33,113.03) .. (279.33,111) -- cycle ;
%Shape: Circle [id:dp20494776974825157]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (312.33,110.67) .. controls (312.33,108.64) and (313.97,107) .. (316,107) .. controls (318.03,107) and (319.67,108.64) .. (319.67,110.67) .. controls (319.67,112.69) and (318.03,114.33) .. (316,114.33) .. controls (313.97,114.33) and (312.33,112.69) .. (312.33,110.67) -- cycle ;
%Shape: Circle [id:dp5303366846344186]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (321.67,110.67) .. controls (321.67,108.64) and (323.31,107) .. (325.33,107) .. controls (327.36,107) and (329,108.64) .. (329,110.67) .. controls (329,112.69) and (327.36,114.33) .. (325.33,114.33) .. controls (323.31,114.33) and (321.67,112.69) .. (321.67,110.67) -- cycle ;
%Shape: Circle [id:dp24820017851669074]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (330,110.33) .. controls (330,108.31) and (331.64,106.67) .. (333.67,106.67) .. controls (335.69,106.67) and (337.33,108.31) .. (337.33,110.33) .. controls (337.33,112.36) and (335.69,114) .. (333.67,114) .. controls (331.64,114) and (330,112.36) .. (330,110.33) -- cycle ;
%Shape: Circle [id:dp7653236409981055]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (303.33,110.67) .. controls (303.33,108.64) and (304.97,107) .. (307,107) .. controls (309.03,107) and (310.67,108.64) .. (310.67,110.67) .. controls (310.67,112.69) and (309.03,114.33) .. (307,114.33) .. controls (304.97,114.33) and (303.33,112.69) .. (303.33,110.67) -- cycle ;
%Shape: Circle [id:dp36351648225964683]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (344.33,110.67) .. controls (344.33,108.64) and (345.97,107) .. (348,107) .. controls (350.03,107) and (351.67,108.64) .. (351.67,110.67) .. controls (351.67,112.69) and (350.03,114.33) .. (348,114.33) .. controls (345.97,114.33) and (344.33,112.69) .. (344.33,110.67) -- cycle ;
%Shape: Circle [id:dp294024717030013]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (351.67,110.67) .. controls (351.67,108.64) and (353.31,107) .. (355.33,107) .. controls (357.36,107) and (359,108.64) .. (359,110.67) .. controls (359,112.69) and (357.36,114.33) .. (355.33,114.33) .. controls (353.31,114.33) and (351.67,112.69) .. (351.67,110.67) -- cycle ;
%Straight Lines [id:da6272191786740566]
\draw (210.67,159.67) -- (210.67,120.67) ;
\draw [shift={(210.67,117.67)}, rotate = 450] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (8.93,-4.29) -- (0,0) -- (8.93,4.29) -- cycle ;
%Shape: Brace [id:dp24141832145418474]
\draw (270.67,120.33) .. controls (270.7,125) and (273.04,127.32) .. (277.71,127.29) -- (313.38,127.07) .. controls (320.05,127.02) and (323.39,129.33) .. (323.42,134) .. controls (323.39,129.33) and (326.71,126.98) .. (333.38,126.94)(330.38,126.96) -- (369.04,126.72) .. controls (373.71,126.69) and (376.03,124.34) .. (376,119.67) ;
%Shape: Circle [id:dp2950234401571059]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (359,110.67) .. controls (359,108.64) and (360.64,107) .. (362.67,107) .. controls (364.69,107) and (366.33,108.64) .. (366.33,110.67) .. controls (366.33,112.69) and (364.69,114.33) .. (362.67,114.33) .. controls (360.64,114.33) and (359,112.69) .. (359,110.67) -- cycle ;
%Straight Lines [id:da5496324871117824]
\draw (334,61.67) -- (334,100) ;
\draw [shift={(334,103)}, rotate = 270] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (8.93,-4.29) -- (0,0) -- (8.93,4.29) -- cycle ;
% Text Node
\draw (126,126.67) node {$-M$};
% Text Node
\draw (378,132) node {$0$};
% Text Node
\draw (488.67,124.67) node {$M$};
% Text Node
\draw (256,75) node {$\scriptstyle I_{1}$};
% Text Node
\draw (210.67,168.67) node {$\scriptstyle a_{n_1}$};
% Text Node
\draw (325.33,142) node {$\scriptstyle I_{2}$};
% Text Node
\draw (344.67,55.33) node {$\scriptstyle a_{n_2}$};
\end{tikzpicture}
\end{document}