# Understanding Spiral Function (potentially 3D) for tikz

I am trying to create a tikz diagramm that shows the precession movement of the LLG equation. Here is an example from wikipedia:

So far I have managed the spiral and centre arrow like this:

\begin{tikzpicture}
\draw plot[domain=0:25,variable=\t,smooth,samples=100] ({\t r}: {0.004*\t*\t} and {-0.002*\t*\t} );

% H_eff
\draw[->] (0,-4) -- (0,2);

% Calculate the endpoint of the arrow at the tip of the spiral
\pgfmathsetmacro{\xTip}{0.004*25*25} % X-coordinate of the tip
\pgfmathsetmacro{\yTip}{-0.002*25*25} % Y-coordinate of the tip

% Draw arrow from y-axis origin to the tip of the spiral
\draw[->] (0,-4) -- (\xTip, \yTip);
\end{tikzpicture}


I am struggling to make the arrow for M intersect (touch) the spiral. I assume this has to do with the 'r' in the \draw command. I am not quite sure how this works but I think it changes the \t parameter to radians. The function doesn't work so well without it. Can someone help?

Also, I haven't found a good manual for tikz yet so I don't really know what syntax etc is good for \draw command. Can you share an online manual for tikz that has all the tikz commands and functions and the syntax for them?

Lastly, in the ideal case the spiral should be 3D and follow the path along the top of a sphere. Something like this:

Considering my lack of experince in tikz this may be a difficult task so I'll settle if the spiral is flat. My idea would be to add a z coordinate that graphs about the top quarter of a circle, but once again I have no idea how to implement this.

tikz's local document name is "pgfmanual.pdf". You can also view the online document at http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf

\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}

\begin{document}

\begin{figure}
\centering
\tdplotsetmaincoords{60}{0}
\begin{tikzpicture}[tdplot_main_coords]
\pgfmathsetmacro{\T}{22}

\draw plot[domain=0:\T,variable=\t,smooth,samples=100] ({4*cos(deg(\t))*sin(-deg(0.01*\t))},{4*sin(-deg(\t))*sin(-deg(0.01*\t))},{4*cos(-deg(0.01*\t))});

\draw[->] (0,0,0) -- (0,0,6) node[left]{$H_\mathrm{eff}$};

\draw[->] (0,0,0) -- ({4*cos(deg(\T))*sin(-deg(0.01*\T))},{4*sin(-deg(\T))*sin(-deg(0.01*\T))},{4*cos(-deg(0.01*\T))}) node[midway,right]{$M$};
\end{tikzpicture}
\end{figure}
\end{document}


• There is a very handy fully hyperlinked version of the manual at tikz.dev Commented Jun 28 at 9:18