Edit and compile if you like:
\documentclass{article}%% File name: sphere.tex% Description:% A sphere of radius a is drawn% by means of its parametric equations% (in spherical coordinates.)%% Date of creation: April, 23rd, 2022.% Date of last modification: April, 23rd, 2022.% Author: Efraín Soto Apolinar.% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/% Terms of use:% According to TikZ.net% https://creativecommons.org/licenses/by-nc-sa/4.0/%\usepackage{tikz}\usepackage{tikz-3dplot}\usetikzlibrary{math}\usepackage[active,tightpage]{preview}\PreviewEnvironment{tikzpicture}\setlength\PreviewBorder{1pt}%\begin{document}%\tdplotsetmaincoords{60}{130}\begin{tikzpicture}[tdplot_main_coords]% Parametric equations of the sphere\tikzmath{function equis(\r,\p,\t) {return \r * sin(\p r) * cos(\t r);};}\tikzmath{function ye(\r,\p,\t) {return \r * sin(\p r) * sin(\t r);};}\tikzmath{function zeta(\r,\p,\t) {return \r * cos(\p r);};}\pgfmathsetmacro{\tcero}{0.0}\pgfmathsetmacro{\phiInit}{0.0}\pgfmathsetmacro{\phiMid}{0.5*pi}\pgfmathsetmacro{\phiEnd}{pi}\pgfmathsetmacro{\thetaInit}{0.5*pi}\pgfmathsetmacro{\thetaMid}{1.85*pi}\pgfmathsetmacro{\thetaEnd}{2.5*pi}%\pgfmathsetmacro{\step}{0.02}\pgfmathsetmacro{\next}{\tcero+0.5*\step}
Click to download: parametric-sphere.tex • parametric-sphere.pdf
Open in Overleaf: parametric-sphere.tex
See more on the author page of Efraín Soto Apolinar.