How to plot a donut whose Fig is attached herewith
The donut looks very nice. I want to plot it. The parametric equation of the torus is
$$x = (R + a cos(p)) cos(t);$$ $$y = (R + a cos(p)) sin(t);$$ $$z = a sin(p);$$ where $t,p\in [0, 2\pi]$ How to do that? EDIT: What I have tried is given below:
\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{comment}
\usepackage{pgfplots}
\pgfplotsset{width=10cm, compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
view={60}{30},
]
\addplot3[surf,shader=interp,
domain=0:2*pi,
p domain=0:2*pi,
samples=101,
samples x=2,R=5,a=2
]
({(R + a*cos(deg(p)))*cos(deg(x))},
{(R + a*cos(deg(p)))*sin(deg(x))},{a*sin(deg(x))});
\end{axis}
\end{tikzpicture}
\end{document}
$$
in LaTeX and/or MathJax is not enabled on this site.\includegraphics
is your friend. If you need to modify it, try Inkscape or equivalent. (Inkscape can produce TikZ code, though it is not very wieldy in my experience.)