MATHEMATICS

Minggu, 24 Juli 2011

About tori in Mathematica

There is no graphics primitive in Mathematica which enables us to plot a torus with one simple command. So we have to make it ourselves. If you read the post 'About spheres in Mathematica' you may have already tried it for yourself. In any case creating a torus in Mathematica is intuitively simple.

We use a red point, as a reference only and start ( again ) with a circle and view the graphical universe from a Left viewpoint.

point = {Red, AbsolutePointSize[10], Point[{0, 0, 0}]}
to1 = First[ ParametricPlot3D[{(1), (Cos[u]), Sin[u]}, {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]}]];
Graphics3D[{point, to1}, ViewPoint -> Left]



We move the circle 3 units in the y-direction.

to2 = First[ ParametricPlot3D[{(1), (3 + Cos[u]), Sin[u]}, {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]}]];
Graphics3D[{point, to2}, ViewPoint -> Left]



We can then simply rotate this circle as follows:

to3 = First[ParametricPlot3D[{(Cos[v]), Sin[v] (3 + Cos[u]), Sin[u]}, {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]}]];
Graphics3D[{point, to3}, ViewPoint -> Left]



But this is not entirely what we had in mind, but this can be easily corrected as follows.


to = First[ParametricPlot3D[{Cos[v] (3 + Cos[u]), Sin[v] (3 + Cos[u]), Sin[u]}, {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]}]];
Graphics3D[{point, to}, ViewPoint -> Top]


Finally, a torus, viewed from the top.


Tidak ada komentar:

Posting Komentar