答案1
类似这样的事?
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
% from https://tex.stackexchange.com/questions/3161/tikz-how-to-draw-an-arrow-in-the-middle-of-the-line
\begin{document}
\begin{tikzpicture}
\begin{scope}[very thick,decoration={
markings,
mark=at position 0.5 with {\arrow{>}}}
]
\foreach \x in {1,2,...,8}
{\pgfmathsetmacro{\myx}{3*pow(-1,\x)/pow(\x,2/3)}
\pgfmathsetmacro{\myy}{3*pow(-1,\x+1)/pow(\x+1,2/3)}
\pgfmathsetmacro{\myz}{\myx+0.6*pow(-1,\x)}
\pgfmathsetmacro{\myk}{\x-2}
\draw[postaction={decorate}] (\myx,\x) -- (\myy,\x+1);
\draw[black, fill=black] (\myx,\x) circle(2pt);
\node at (\myz,\x) {$u^{k+\x}$};}
\end{scope}
\end{tikzpicture}
\end{document}
\myx
请添加和的定义系列\myy
。
答案2
起点:
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
>={Triangle[length=2mm, width=2.5mm]},
]
% Coordinates
\path
(0, 0) coordinate (a)
(2, 1.5) coordinate (b)
(0, 3) coordinate (c)
% ...
;
% Points
\fill[radius=1mm]
\foreach \p in {a, ..., c} {
(\p) circle[]
}
;
% Lines and middle points
\draw
(a) -- coordinate (ab)
(b) -- coordinate (bc)
(c)
;
% Arrows
\draw[->] (a) -- (ab);
\draw[->] (b) -- (bc);
% Labels
\path[inner sep=.3333em + 1mm]% Added: radius of the points
(a) node[left] {$u^{k-1}$}
(b) node[right] {$u^{k}$}
(c) node[left] {$u^{k + 1}$}
;
\path
(a)
-- node[below right] {$s^{k-1}$}
(b)
-- node[above right] {$s^{k}$}
(c)
;
\end{tikzpicture}
\end{document}