So I got a gift for a friend based on Mathematica code.
Rose[x_, theta_] :=
Module[
{phi = (Pi/2)Exp[-theta/(8 Pi)],
X = 1 - (1/2)((5/4)(1 - Mod[3.6 theta, 2 Pi]/Pi)^2 - 1/4)^2},
y = 1.95653 x^2(1.27689 x - 1)^2 Sin[phi];
r = X(x Sin[phi] + y Cos[phi]);
{r Sin[theta], r Cos[theta], X (x Cos[phi] - y Sin[phi]), EdgeForm[]}];
ParametricPlot3D[Rose[x, theta], {x, 0, 1}, {theta, -2 Pi, 15 Pi},
PlotPoints -> {25, 576},
LightSources -> {{{0, 0, 1}, RGBColor[1, 0, 0]}},
Compiled -> False]
And I want to translate this code to LaTeX. I have never used Mathematica before, but I've managed to find a computer with Mathematica, and I've managed to use the "copy as LaTeX" option. I couldn't figure out how to use TeXform, unfortumately :/
ANYWHO, I've managed to get this in my attempt to translate Rose(x,theta):
$\text{Rose}(x,\theta):=\left[\begin{array}{c}\left\{ \phi =\frac{1}{2} \pi \exp \left(-\frac{\theta }{8 \pi}\right), X = 1-\frac{1}{2}\left(\frac{5}{4} \left(1-\frac{((3.6 \theta ) \bmod (2 \pi ))}{\pi }\right)^2-\frac{1}{4}\right)^2\right\},\\ y=1.95653 x^2 (1.27689 x-1)^2 \sin(\phi );\\ r=X (x \sin (\phi )+y \cos (\phi ));\{r \sin (\theta ),r \cos (\theta ),X (x \cos (\phi )-y \sin (\phi ))\} \end{array}\right]$
(note the copy to latex option wasn't super helpful in formatting)
This is the result of directly pasting the copy result and trying to clean up the function. I'm wondering if this cleanup is correct, and also...what exactly is going on in the function?
What I think is going on:
1) We use $\theta$ to calculate $\phi$ and big $X$
2) We then calculate $y$ using $\phi$ and little $x$
3) Then $r$ is calculated using big $X$, little $x$, $y$, and $\phi$
4) The euclidean coordinates of points on the graph are represented by: $\{r \sin(\theta ),r \cos(\theta),X (x \cos(\phi )-y \sin(\phi ))\}$ , and that depends on big $X$, little $x$, $y$, $\theta$, $\phi$, and $r$
Is this right? Am I missing something? Did I translate something wrong? What does mod mean? Is it modding $3.6\theta$ by $2\pi$?
Also, what does the plot mean? I'm guessing LightSources and RGBcolor refer to how the graph looks aesthetically. Does the second part of the code mean that x ranges from 0 to 1, and theta ranges from -2 Pi and 15 Pi? What does PlotPoints mean? The fineness of the plot/ number of points in each variable?
I need to verify this specific equation with human eyes that know how to read Mathematica code. :/
EDIT: Sorry for the lack of citation-- this is Mathematica code from Paul Nylander -- a formula for the "Nylander Rose" -- I had no part in making this code at all.
TeXForm
, you need to prevent the evaluation ofSetDelayed (:=)
. To do that, simply putUnevaluated
around the entire code then putTeXForm
around it. However, I agree with @Jens that it is not a good idea to learn the Wolfram Language / Mathematica through $\LaTeX$. $\endgroup$