Is there any good way of drawing a bloch sphere as shown below? In particular, I am looking for a transparent sphere.
I am aware there is a blochsphere package but it is opaque.
Is there any good way of drawing a bloch sphere as shown below? In particular, I am looking for a transparent sphere.
I am aware there is a blochsphere package but it is opaque.
You mentioned the blochsphere package in you question, why not simply use it? The opacity can simply be adjusted to your needs.
The following example is modified from 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}
I post my answer. I hope this is helpful for you. Unfortunately I did not put the opacity. I'm sorry.
\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}
\bf in LaTeX. They are 20+ years obsolete and not part of the NFSS introduced with LaTeX 2e. They ought not now be used in LaTeX documents at all. And why the $$ to end and immediately begin maths mode?
– cfr
Dec 24 '16 at 04:14
LaTeX for almost 15 years, and some old habits have remained. If the editor I had used written \ [... \] instead of $$ ... $$. I did not understand the part "And why the $$ to end and immediately begin maths mode?"
– Sebastiano
Dec 24 '16 at 11:56
$ ...$$...$ so the $$ wasn't for display maths but just ending and then starting maths mode. Nadolig Llawen / Merry Christmas! I hope it is not too sad a holiday for you.
– cfr
Dec 24 '16 at 13:19
Here is a slightly stripped down and more adaptable version using only TikZ and its angles library.
\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}
Here is my version using the blochsphere+angles package/tikzlibrary. The blochsphere package provides some useful functions like labelLatLon to put a dot on the sphere, drawLatitudeCircle to draw the equatorial circle, or setDrawingPlane to draw the angles/projection directly in this plane, which provides "3D" angles. It is also easy to change the rotation/tilt or the sphere using usual blochsphere options.
You can also use any other command of blochsphere (see more here) like \drawBallGrid or \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}
blochspherepackage has the option to adjust theopacity. – samcarter_is_at_topanswers.xyz Dec 23 '16 at 19:51https://www.ctan.org/pkg/blochsphere. – Svend Tveskæg Dec 23 '16 at 19:58