<jupyter_start><jupyter_text>Plotting a Torus    To plot a surface in 3D do you first need to find the parametrization of the surface you wish to plot. For a Torus the parametrization looks like this:\begin{align}x &= [c + a  \cos v] \cos u \\y &= [c + a  \cos v] \sin u \\z &= a \sin v\end{align}where $a$ represents the radius of the tube and $c$ is the radius of the center hole of the torus tube. See https://mathworld.wolfram.com/Torus.html for further information. Begin by activating matplotlib notebook and importing numpy and matplotlib<jupyter_code>%matplotlib notebook 
# This enables you to drag and rotate the figure

from mpl_toolkits.mplot3d import Axes3D # needed to do the 3D Plots
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection='3d')

u = np.linspace(0, 2*np.pi, 100)
v = np.linspace(0, 2*np.pi, 100)
u, v = np.meshgrid(u, v) # Make coordinate matrices from coordinate vectors.
a, c = 0.2, 1.0 # Set a and c from the torus parametrization

# Paramatrization
x = (c + a*np.cos(v))*np.cos(u)
y = (c + a*np.cos(v))*np.sin(u)
z = a*np.sin(v)


ax.plot_surface(x, y, z)

ax.set_xlim3d(-1, 1)
ax.set_ylim3d(-1, 1)
ax.set_zlim3d(-1, 1)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12236628849270664, 'fraction_numerical': 0.022690437601296597, 'mean_word_length': 4.082304526748971, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '612349', 'license': 'MIT', 'n_tokens_mistral': 495, 'n_tokens_neox': 468, 'n_words': 165, 'path': 'problem_candidates/Plotting surfacees.ipynb', 'repo_name': 'ilfreddy/seminars', 'size': '1234'}