tag:blogger.com,1999:blog-2261985361614499342.post3506587369226879913..comments2023-10-18T09:08:37.942-07:00Comments on Fun math art (pictures) - benice equation: Using Trigonometry to Express the Equations of Piecewise Spiralsbenicehttp://www.blogger.com/profile/09841851785144902423noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-2261985361614499342.post-75501135601409951752016-07-07T22:42:59.084-07:002016-07-07T22:42:59.084-07:00Hi,
Here are two scripts for the circle spirals:
...Hi,<br />Here are two scripts for the circle spirals:<br /><br />script 1:<br /><br />k = 2.0<br /># If k is even:<br />g(x,y) = cos(pi*sqrt((x + k*sgn(y)/2)**2 + y**2))<br /># If k is odd:<br /># g(x,y) = cos(pi*sqrt((x + k*sgn(y)/2)**2 + y**2)) / y<br />set xrange [-10:10]<br />set yrange [-10:10]<br /><br />set samples 256<br />set isosamples 256<br />set contour base<br />set cntrparam levels discrete 0.0<br />unset surface<br /><br />set table "g.dat"<br />splot g(x,y)<br />unset table<br /><br />set size ratio -1<br />unset key<br />plot "g.dat" w l lw 1 lc rgb "red"<br /><br /><br />Note for script 1:<br />gnuplot gives wrong graph (on the x-axis) for the sin case.<br /><br /><br />script 2:<br /><br />k = 1.0<br />f_upper(x,y) = sin(pi*sqrt((x + k/2)**2 + y**2))<br />f_lower(x,y) = sin(pi*sqrt((x - k/2)**2 + y**2))<br />set xrange [-10:10]<br /><br />set samples 256<br />set isosamples 256<br />set contour base<br />set cntrparam levels discrete 0.0<br />unset surface<br /><br />set yrange [0:10]<br />set table "f_upper.dat"<br />splot f_upper(x,y)<br />unset table<br /><br />set yrange [-10:0]<br />set table "f_lower.dat"<br />splot f_lower(x,y)<br />unset table<br /><br />set yrange [-10:10]<br />set size ratio -1<br />unset key<br />plot "f_upper.dat" w l lw 1 lc rgb "red", \<br /> "f_lower.dat" w l lw 1 lc rgb "red"<br />benicehttps://www.blogger.com/profile/09841851785144902423noreply@blogger.comtag:blogger.com,1999:blog-2261985361614499342.post-85405088495350676132016-07-07T07:10:53.811-07:002016-07-07T07:10:53.811-07:00Hi Benice! I love this blog, the art here is amazi...Hi Benice! I love this blog, the art here is amazing. I just recently built a polargraph style window plotter and I'm setting it up so that it uses gnuplot to do it's drawing.<br /><br />I'm kind of a gnuplot newbie though and I'm having a little trouble translating your equations into gnuplot scripts. Would you mind sharing the full gnuplot script for one of these?Anonymoushttps://www.blogger.com/profile/10823806956841010467noreply@blogger.com