我正在努力创建一个插图,我将在微分几何/流形理论等许多不同的领域中使用它。接着我之前的一个问题(已回答)如何才能画出从一个轴上的点到另一个轴上的点的箭头?,我想展示平面上的两条坐标线如何通过所选的映射从曲面上的两条曲线衍生而来:
\begin{tikzpicture}
\begin{axis}[
name=mfd,
declare function={
f(\x,\y)=10-(\x^2+\y^2);
},
declare function={
c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
},
declare function={
c_y(\t)=(sin(\t))/2-1;
},
declare function={
c_z(\t)=f(c_x(\t),c_y(\t));
},
]
\addplot3[surf,domain=-2:2,domain y=-2:2,]{f(x,y)};
\addplot3[black,opacity=1.0,variable=t,domain=0:360,dashed,thin] ({c_x(t)},{c_y(t)},{c_z(t)});
\addplot3[black,opacity=1.0,variable=t,domain=-2:2,thin] (t,-1.2,{f(t,-1.2)});
\addplot3[black,opacity=1.0,variable=t,domain=-2:2,thin] (0.8,t,{f(t,-1.2)});
\addplot3[black,opacity=1.0,only marks,mark=text,text mark=$\cdot$] (1,-1,{f(1,-1)}) coordinate (a);
\end{axis}
\begin{axis}[
at={($(mfd.north east)+(1cm,-2cm)$)},
anchor=north west,
declare function={
c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
},
declare function={
c_y(\t)=(sin(\t))/2-1;
}
]
\addplot[variable=t,domain=0:360]({c_x(t)},{c_y(t)});
\addplot[black,opacity=1.0,only marks,mark=text,text mark=$\cdot$] (1,-1) coordinate (b);
\addplot[variable=t,domain=0.6:1.4](t,-1.2);
\addplot[variable=t,domain=-1.5:-0.5](0.8,t);
\end{axis}
\draw [-stealth, shorten <= 3pt, shorten >= 3pt] (a) to[bend left] (b);
\end{tikzpicture}
但是,我有几个问题:
- 通过坐标图从平面拉回的表示坐标轴的曲线坚持用直线封闭 - 有没有办法避免这种情况?
- 我想用细虚线绘制所有黑色曲线,但我可能不明白如何设置这些选项。我做错了什么?
如果这些问题比较初级,我深感抱歉,但我发现相关手册很难查阅;它们似乎是用来从头到尾阅读的,而不是参考的。
答案1
我认为,问题的原因可以在pgfplots
手册中的这句话中找到:
mesh/rows
如果和 都没有值,mesh/cols
或者其中一个为 1,pgfplots
则将绘制一条线图。[...]为了
\addplot3 expression
,这需要设置samples y=0
为禁用网格生成。
(重点是我。)请注意,这samples y=1
也会起作用,并且手册在另一处说明了这一点:
如果使用
\addplot3 expression
,mesh/rows
和 则mesh/cols
根据值samples
和计算samples y
。默认情况下,\addplot3 expression
始终对网格进行采样。如果你想让它采样一行,设置samples y=1
(或者,等效地,y domain=0:0
)。
(再次强调,我不知道两者之间的技术差异。)
似乎线条规范不适用于网格,网格也是您获得封闭曲线的原因。因此,如果您samples y=0
为黑线设置,它会按预期工作。我在下面的示例中通过样式做到了这一点。
我实际上制作了三种不同的样式,一种用于点,一种用于坐标线,一种用于形状,一种用于点。第二条坐标线的 z 坐标也不正确,它应该f(0.8,t)
不是f(t,-1.2)
。
对于注释,您可以使用相对坐标。假设您有一个已保存的坐标c
,您可以执行以下操作
\draw [stealth-] (c) to[bend left] ++(2cm,1cm) node[right] {...};
这会将箭头尖端置于路径的起点,而末端节点则置于right
路径的终点。这样可以节省您的绝对坐标,也不必在 中重复使用这些坐标\node
。
我还修改了一些数学知识,特别是使用\dim
而不是dim
,以及例如$...$ for $...$
而不是$... \ for\ ...$
。
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{diagrams}
\usepackage[document]{ragged2e}
\usepackage{wasysym}
\usepackage{tensor}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\tikzset{
myarrow/.style={stealth-,shorten >=3pt,shorten <=3pt}
}
\pgfplotsset{
lineplot/.style={
black,
dashed,
very thin,
samples y=0
},
coordinate line/.style={
black,
samples y=0
},
point/.style={
only marks,
mark=*,
black,
mark size=0.5pt
}
}
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\begin{theorem}
Let $\mathbf{M}$ be a smooth manifold and $p \in \mathbf{M}$; then $\dim(\mathbf{T_pM}) = dim(\mathbf{M})$
\end{theorem}
\begin{proof}
To prove this, we construct a vector space basis for $\mathbf{T_pM}$ from a chart. Choose a chart $(U,x), with \ p \in U$. Consider $\dim(\mathbf{M})$ curves $\gamma_{(a)}$, with $a = 1, \dots, \dim(\mathbf{M}), \gamma_{(a)} \colon \mathbb{R} \rightarrow U$, so that $(x^b \circ \gamma_{(a)}) (\lambda) = \delta^b_a \cdot \lambda$ for some $\lambda \in \mathbb{R}$ -- like this:
\begin{tikzpicture}
\begin{axis}[
name=mfd,
axis lines=none,
declare function={
f(\x,\y)=10-(\x^2+\y^2);
},
declare function={
c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
},
declare function={
c_y(\t)=(sin(\t))/2-1;
},
declare function={
c_z(\t)=f(c_x(\t),c_y(\t));
},
declare function={
x_0(\t)=-1.2;
},
declare function={
x_1(\t)=0.8;
}
]
\addplot3[surf,domain=0:2,domain y=-2:0,]{f(x,y)};
\addplot3[lineplot,variable=t,domain=0:360] ({c_x(t)},{c_y(t)},{c_z(t)});
\addplot3[coordinate line,variable=t,domain=0:2] (t,{x_0(t)},{f(t,{x_0(t)})});
\addplot3[coordinate line,variable=t,domain=-2:0] ({x_1(t)},t,{f({x_1(t)},t)});
\addplot3[point] (1,-1,{f(1,-1)}) coordinate (a);
\addplot3[point](.5,{x_0(.5)},{f(.5,{x_0(.5)})}) coordinate (x_dot);
\addplot3[point]({x_1(-.5)},-.5,{f({x_1(-.5)},-.5)}) coordinate (y_dot);
\end{axis}
\draw [myarrow] (x_dot) to[bend left] ++(-2cm,-4cm) node[below] {$\gamma_{(0)}$};
\draw [myarrow] (y_dot) to[bend right] ++(2cm,0.5cm) node [right] {$\gamma_{(1)}$};
\begin{axis}[
at={($(mfd.north east)+(1cm,-2cm)$)},
anchor=north west,
axis lines=none,
declare function={
c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
},
declare function={
c_y(\t)=(sin(\t))/2-1;
},
declare function={
x_0(\t)=-1.2;
},
declare function={
x_1(\t)=0.8;
}
]
\addplot[lineplot,variable=t,domain=0:360]({c_x(t)},{c_y(t)});
\addplot[point] (1,-1) coordinate (b);
\addplot[coordinate line,variable=t,domain=0.6:1.4](t,{x_0(t)});
\addplot[coordinate line,variable=t,domain=-1.5:-0.5]({x_1(t)},t);
\addplot[point](.8,-.5) coordinate (P1);
\addplot[point](.6,-1.2) coordinate (P2);
\end{axis}
\draw [myarrow] (b) to[bend right] node [above=7pt] {$x$} (a);
\draw [myarrow] (P1) to[bend left] ++(-1cm,1cm) node[above] {$(x \circ \gamma_{(1)})$};
\draw [myarrow] (P2) to[bend left] ++(-3cm,-1cm) node[above] {$(x \circ \gamma_{(0)})$};
\end{tikzpicture}
Given $p \in \mathbf{M}$, choose a chart $(U,x)$, so that $x(p)=0_{\mathbb{R}^{\dim M}}$, and curves $\gamma_{(a)}$, with $p = \gamma_{(a)}(0)$, for $a = 1, \dots, \dim M$:
\begin{align*}
e_a &:= X_{\gamma_{(a)},p}, a = 1, \dots, \dim M \\
e_a f &= X_{\gamma_{(a)},p} f \\
&=(f \circ \gamma_{(a)})' (0) \\
&= (f \circ x^{-1} \circ x \circ \gamma_{(a)})' (0) \\
&= \partial_b (f \circ x^{-1}) \cdot (x(\gamma_{(a)}(0))) \cdot (x^b \circ \gamma_{(a)})' (0) \\
&= \partial_b (f \circ x^{-1})(x(p)) \cdot \delta^b_a \\
&= \partial_a (f \circ x^{-1})
\end{align*}
(to be continued ...)
\end{proof}
\end{document}
答案2
正如承诺的那样,这里有该插图的一些背景信息 - 它是证明的一部分,因此我在图片周围添加了一些内容:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{diagrams}
\usepackage[document]{ragged2e}
\usepackage{wasysym}
\usepackage{tensor}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\pgfplotsset{
lineplot/.style={
black,
dashed,
very thin,
samples y=0
},
coordinate line/.style={
black,
samples y=0
},
point/.style={
only marks,
mark=*,
black,
mark size=0.5pt
}
}
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\begin{theorem}
Let $\mathbf{M}$ be a smooth manifold and $p \in \mathbf{M}$; then $dim(\mathbf{T_pM}) = dim(\mathbf{M})$
\end{theorem}
\begin{proof}
To prove this, we construct a vector space basis for $\mathbf{T_pM}$ from a chart. Choose a chart $(U,x), with \ p \in U$. Consider $dim(\mathbf{M})$ curves $\gamma_{(a)}, with \ a = 1, \dots, dim(\mathbf{M}), \gamma_{(a)} \colon \mathbb{R} \rightarrow U$, so that $(x^b \circ \gamma_{(a)}) (\lambda) = \delta^b_a \cdot \lambda$ for some $\lambda \in \mathbb{R}$ - like this:\linebreak
\begin{tikzpicture}
\begin{axis}[
name=mfd,
axis lines=none,
declare function={
f(\x,\y)=10-(\x^2+\y^2);
},
declare function={
c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
},
declare function={
c_y(\t)=(sin(\t))/2-1;
},
declare function={
c_z(\t)=f(c_x(\t),c_y(\t));
},
declare function={
x_0(\t)=-1.2;
},
declare function={
x_1(\t)=0.8;
}
]
\addplot3[surf,domain=0:2,domain y=-2:0,]{f(x,y)};
\addplot3[lineplot,variable=t,domain=0:360] ({c_x(t)},{c_y(t)},{c_z(t)});
\addplot3[coordinate line,variable=t,domain=0:2] (t,{x_0(t)},{f(t,{x_0(t)})});
\addplot3[coordinate line,variable=t,domain=-2:0] ({x_1(t)},t,{f({x_1(t)},t)});
\addplot3[point] (1,-1,{f(1,-1)}) coordinate (a);
\addplot3[point](.5,{x_0(.5)},{f(.5,{x_0(.5)})}) coordinate (x_dot);
\addplot3[point]({x_1(-.5)},-.5,{f({x_1(-.5)},-.5)}) coordinate (y_dot);
\end{axis}
\draw [-stealth, shorten <= 3pt, shorten >= 3pt] (.5,-.5) to[bend right] (x_dot);
\node[below] at (.5,-.5) {$\gamma_{(0)}$};
\draw [-stealth, shorten <= 3pt, shorten >= 3pt] (5,5) to[bend left] (y_dot);
\node[right] at (5,5) {$\gamma_{(1)}$};
\begin{axis}[
at={($(mfd.north east)+(1cm,-2cm)$)},
anchor=north west,
axis lines=none,
declare function={
c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
},
declare function={
c_y(\t)=(sin(\t))/2-1;
},
declare function={
x_0(\t)=-1.2;
},
declare function={
x_1(\t)=0.8;
}
]
\addplot[lineplot,variable=t,domain=0:360]({c_x(t)},{c_y(t)});
\addplot[black,opacity=1.0,only marks,mark=text,text mark=$\cdot$] (1,-1) coordinate (b);
\addplot[coordinate line,variable=t,domain=0.6:1.4](t,{x_0(t)});
\addplot[coordinate line,variable=t,domain=-1.5:-0.5]({x_1(t)},t);
\addplot[point](.8,-.5) coordinate (P1);
\addplot[point](.6,-1.2) coordinate (P2);
\end{axis}
\draw [-stealth, shorten <= 3pt, shorten >= 3pt] (a) to[bend left] node [above=7pt] {$x$} (b);
\draw [-stealth, shorten <= 3pt, shorten >= 3pt] (9,4) to[bend right] (P1);
\node[above] at (9,4) {$(x \circ \gamma_{(1)})$};
\draw [-stealth, shorten <= 3pt, shorten >= 3pt] (5,-1) to[bend right] (P2);
\node[above] at (5,-1) {$(x \circ \gamma_{(0)})$};
\end{tikzpicture}
Given $p \in \mathbf{M}$, choose a chart $(U,x)$, so that $x(p)=0_{\mathbb{R}^{dim M}}$, and curves $\gamma_{(a)}, with \ p = \gamma_{(a)}(0), for \ a = 1, \dots, dim M$:
\begin{align*}
e_a &:= X_{\gamma_{(a)},p}, a = 1, \dots, dim M \\
e_a f &= X_{\gamma_{(a)},p} f \\
&=(f \circ \gamma_{(a)})' (0) \\
&= (f \circ x^{-1} \circ x \circ \gamma_{(a)})' (0) \\
&= \partial_b (f \circ x^{-1}) \cdot (x(\gamma_{(a)}(0))) \cdot (x^b \circ \gamma_{(a)})' (0) \\
&= \partial_b (f \circ x^{-1})(x(p)) \cdot \delta^b_a \\
&= \partial_a (f \circ x^{-1})
\end{align*}
(to be continued ...)
\end{proof}
\end{document}
还有一些未解决的问题 - 我对必须使用明确的坐标来表示箭头及其标签的方式不太满意;这似乎不太优雅,一定有更好的方法。此外,由于我放置了一个点作为箭头的终点,坐标曲线上出现了可见的斑点。不过,我希望这对人们有用。