如何绘制布洛赫球?

如何绘制布洛赫球?

有没有什么好的方法可以画出如下所示的布洛赫球?特别是,我正在寻找一个透明的球体。

我知道有一个blochsphere包但它不透明。

通缉

答案1

blochsphere在问题中提到了该包,为什么不直接使用它呢?不透明度可以根据您的需要进行调整。

以下示例修改自http://mirrors.ctan.org/graphics/pgf/contrib/blochsphere/example.tex

\documentclass{standalone}

\usepackage{blochsphere}

\begin{document}

\begin{blochsphere}[radius=1.5 cm,tilt=15,rotation=-20,opacity=0]
    \drawBallGrid[style={opacity=0.1}]{30}{30}

    \drawGreatCircle[style={dashed}]{-60}{0}{0}
    \drawGreatCircle[style={dashed}]{60}{0}{0}

    \drawRotationLeft[scale=1.3,style={red}]{-60}{0}{0}{15}
    \drawRotationRight[scale=1.3,style={red}]{60}{0}{0}{15}

    \node at (-0.8,1.9) {\textcolor{red}{\tiny $J_{12}(t)$}};
    \node at (1.1,1.8) {\textcolor{red}{\tiny $J_{23}(t)$}};

    \labelLatLon{up}{90}{0};
    \labelLatLon{down}{-90}{90};
    \node[above] at (up) {{\tiny $\left|1\right>$ }};
    \node[below] at (down) {{\tiny $\left|0\right>$}};

    \labelLatLon[labelmark=false]{d}{15}{90};
    \node at (d) {\color{gray}\fontsize{0.15cm}{1em}\selectfont $60^\circ$};

    \labelLatLon[labelmark=false]{d2}{5}{78};
    \node at (d2) {\color{gray}\fontsize{0.15cm}{1em}\selectfont $60^\circ$};
\end{blochsphere}
\end{document}

在此处输入图片描述

答案2

我发布了我的答案。希望这对你有帮助。不幸的是,我没有设置不透明度。很抱歉。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usepackage{mathtools}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[line cap=round, line join=round, >=Triangle]
  \clip(-2.19,-2.49) rectangle (2.66,2.58);
  \draw [shift={(0,0)}, lightgray, fill, fill opacity=0.1] (0,0) -- (56.7:0.4) arc (56.7:90.:0.4) -- cycle;
  \draw [shift={(0,0)}, lightgray, fill, fill opacity=0.1] (0,0) -- (-135.7:0.4) arc (-135.7:-33.2:0.4) -- cycle;
  \draw(0,0) circle (2cm);
  \draw [rotate around={0.:(0.,0.)},dash pattern=on 3pt off 3pt] (0,0) ellipse (2cm and 0.9cm);
  \draw (0,0)-- (0.70,1.07);
  \draw [->] (0,0) -- (0,2);
  \draw [->] (0,0) -- (-0.81,-0.79);
  \draw [->] (0,0) -- (2,0);
  \draw [dotted] (0.7,1)-- (0.7,-0.46);
  \draw [dotted] (0,0)-- (0.7,-0.46);
  \draw (-0.08,-0.3) node[anchor=north west] {$\varphi$};
  \draw (0.01,0.9) node[anchor=north west] {$\theta$};
  \draw (-1.01,-0.72) node[anchor=north west] {$\mathbf {\hat{x}}$};
  \draw (2.07,0.3) node[anchor=north west] {$\mathbf {\hat{y}}$};
  \draw (-0.5,2.6) node[anchor=north west] {$\mathbf {\hat{z}=|0\rangle}$};
  \draw (-0.4,-2) node[anchor=north west] {$-\mathbf {\hat{z}=|1\rangle}$};
  \draw (0.4,1.65) node[anchor=north west] {$|\psi\rangle$};
  \scriptsize
  \draw [fill] (0,0) circle (1.5pt);
  \draw [fill] (0.7,1.1) circle (0.5pt);
\end{tikzpicture}
\end{document}

答案3

这是一个略微精简且适应性更强的版本,仅使用 TikZ 及其angles库。

在此处输入图片描述

\documentclass[tikz]{standalone}

\usetikzlibrary{angles, quotes}

\begin{document}
\begin{tikzpicture}

  % Define radius
  \def\r{3}

  % Bloch vector
  \draw (0,0) node[circle, fill, inner sep=1] (orig) {} -- (\r/3,\r/2)
    node[circle, fill, inner sep=0.7, label=above:$\vec{a}$] (a) {};
  \draw[dashed] (orig) -- (\r/3, -\r/5) node (phi) {} -- (a);

  % Sphere
  \draw (orig) circle (\r);
  \draw[dashed] (orig) ellipse (\r{} and \r/3);

  % Axes
  \draw[->] (orig) -- ++(-\r/5, -\r/3) node[below] (x1) {$x_1$};
  \draw[->] (orig) -- ++(\r, 0) node[right] (x2) {$x_2$};
  \draw[->] (orig) -- ++(0, \r) node[above] (x3) {$x_3$};

  % Angles
  \pic [draw=gray, text=gray, ->, "$\phi$"] {angle = x1--orig--phi};
  \pic [draw=gray, text=gray, <-, "$\theta$", angle eccentricity=1.4] {angle = a--orig--x3};

\end{tikzpicture}
\end{document}

答案4

这是我使用blochsphere+angles包/tikzlibrary 的版本。blochsphere 包提供了一些有用的功能,例如labelLatLon在球体上放置一个点、drawLatitudeCircle绘制赤道圆或直接在此平面上绘制角度/投影,从而提供“3D”角度。使用常用选项setDrawingPlane也可以轻松更改旋转/倾斜或球体。blochsphere

在此处输入图片描述

您还可以使用任何其他命令blochsphere(查看更多这里) 喜欢\drawBallGrid\drawRotationRight

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows,calc,math,angles,quotes}
\usepackage{blochsphere}
\usepackage{braket}

\begin{document}
%%%% Change these parameters to change the position of psi, or the size/rotation of the sphere
\def\rotationSphere{-110}
\def\radiusSphere{2cm}
\def\psiLat{45}
\def\psiLon{45}
\begin{blochsphere}[radius=\radiusSphere,opacity=0,rotation=\rotationSphere]
  % \drawBallGrid[style={opacity=.3}]{30}{45}
  % Draw the sphere...
  \drawLongitudeCircle[]{\rotationSphere} % draw the longitude that face us to delimit the sphere
  % ... and the equatorial plane
  \drawLatitudeCircle[style={dashed}]{0}
  % Define the different points on the bloch sphere
  \labelLatLon{ket0}{90}{0};
  \labelLatLon{ket1}{-90}{0};
  \labelLatLon{ketminus}{0}{180};
  \labelLatLon{ketplus}{00}{0};
  \labelLatLon{ketpluspi2}{0}{-90};  % Longitude seems to be defined in the "wrong" direction, hence the minus
  \labelLatLon{ketplus3pi2}{0}{-270};
  \labelLatLon{psi}{\psiLat}{-\psiLon};
  % Draw and label the axis
  \draw[-latex] (0,0) -- (ket0) node[above,inner sep=.5mm] at (ket0) {\footnotesize $z$};
  \draw[-latex] (0,0) -- (ketplus) node[below,inner sep=.5mm] at (ketplus) {\footnotesize$x$};
  \draw[-latex] (0,0) -- (ketpluspi2) node[below,inner sep=.5mm] at (ketpluspi2) {\footnotesize $y$};
  % Draw |psi>
  \draw[-latex] (0,0) -- (psi) node[above]{\footnotesize $\ket{\psi}$};

  % Draw the angles
  \coordinate (origin) at (0,0);
  {
    % Will draw the angle/projection one the equatorial plane
    \setDrawingPlane{0}{0}
    % Draw the projection: cos is used to compute the length of the projection
    \draw[current plane,dashed] (0,0) -- (-90+\psiLon:{cos(\psiLat)*\radiusSphere}) coordinate (psiProjectedEquat) -- (psi);
    % Draw the angle
    \pic[current plane, draw,fill=orange!50,fill opacity=.5, text opacity=1,"\footnotesize $\phi$", angle eccentricity=2.2]{angle=ketplus--origin--psiProjectedEquat};
  }
  { \setLongitudinalDrawingPlane{\psiLon}
    % Draw the angle
    \pic[current plane, draw,fill=orange!50,fill opacity=.5, text opacity=1,"\footnotesize $\theta$", angle eccentricity=1.5]{angle=psi--origin--ket0};
  }
\end{blochsphere}
\end{document}

相关内容