[Tex/LaTex] Mathematica code into TikZ code

tikz-pgfwolfram-mathematica

In my search to understand the creation of a guilloche and in relation to my post Recreating a guilloche with TikZ, I came about the code below,

 Guilloche[a_, b_, c_, d_, e_, f_] := 
 PolarPlot[Evaluate[Flatten[{ Table[(c + Sin[a x + d]) + ((b + Sin[b x + e]) - (c + Sin[a x + d]))(f + Sin[a x + n/ Pi])/2, {n, 0, 19}] }] ], {x, 0, 2 Pi}, PlotPoints -> 200, Axes -> None, Frame -> False]

 Guilloche[4, 8, 20, 4.7, 1.8, 1];

Written in Mathematica which should produce the following image:enter image description here

My attempt below compiles but with no image.

 \documentclass[11pt]{scrartcl}
 \usepackage[dvipsnames]{xcolor}     
 \usepackage{tkz-fct}


 \begin{document}
 \noindent\begin{tikzpicture}
 \foreach \i in {1,...,19}{%
 \tkzFctPolar[color=MidnightBlue,thick,domain=0:2*pi,samples=400]{(4 + sin(4*t + 4.7)) +((8 + sin(8*t + 1.8)) - (20 + sin(4*t + 4.7)))
 (1 + sin(4*t + \i/ Pi))/2}}   
 \end{tikzpicture} 

 \end{document}

Any assistance on how to convert the code appropriately will be highly appreciated. In general, the Mathematica code should produce different guilloches but I don't know how I would be able to implement it into TikZ to generate different guilloches from one piece of code.

Best Answer

It's a problem of units. You can use mathematica or excel or maxima or a free soft to calculate some values. After it's easy to find how to setup \tkzInit. Perhaps it's more easy with pgfplots.

enter image description here

 \documentclass{standalone}
 \usepackage[dvipsnames]{xcolor}     
 \usepackage{tkz-fct}


 \begin{document}
 \noindent\begin{tikzpicture}
 \tkzInit[xmin=-50,xmax=50,ymin=-50,ymax=50,xstep=5,ystep=5]
 \foreach \i in {1,...,19}{%
 \tkzFctPolar[color=MidnightBlue,thick,domain=0:4*pi,samples=400]{
 (20 + sin(4*t + 4.7)) +  ((8 + sin(8*t + 1.8)) - (20 + sin(4*t + 4.7)))*
 (1 + sin(4*t + \i/ 3.14))/2}}   
 \end{tikzpicture} 

 \noindent\begin{tikzpicture}
 \tkzInit[xmin=-50,xmax=50,ymin=-50,ymax=50,xstep=5,ystep=5]
 \foreach \i in {1,...,10}{%
 \tkzFctPolar[color=MidnightBlue,thick,domain=0:4*pi,samples=400]{
 (10 + sin(4*t + 4.7)) +  ((4 + sin(4*t + 1.8)) - (10 + sin(4*t + 4.7)))*
 (1 + sin(4*t + \i/ 3.14))/2}}   
 \end{tikzpicture} 

 \noindent\begin{tikzpicture}
 \tkzInit[xmin=-50,xmax=50,ymin=-50,ymax=50,xstep=5,ystep=5]
 \foreach \i in {1,...,19}{%
 \tkzFctPolar[color=MidnightBlue,thick,domain=0:4*pi,samples=400]{
 (15 + sin(4*t + 4.7)) +  ((8 + sin(8*t + 1.8)) - (15 + sin(4*t + 4.7)))*
 (1.5 + sin(4*t + \i/ 3.14))/2}}   
 \end{tikzpicture}       

 \end{document}