[math-fun] re; big sunflowers
The following small postscript program provides a similar graphic; %!PS 297 421 translate 0 .1 400{dup dup sqrt 4 div 0 360 arc fill 137.50775 rotate}for showpage 137.50775.. is the 'golden angle' If you gradually change the rotation angle and animate , you get this; http://www.youtube.com/watch?v=1GK1JfivJSU No editing was done, just a gradual change of angle. what interested me was the appearance and metamorphosis of different cycles. Stuart
Neat animation! Why did you make the "seeds" get bigger with radius? By the way, my calculator says the angle is 137.507764... And thank you for this post. I had long ago written some PostScript to produce the sunflower graphic, but for large values of n it produced unexpected (i.e., wrong) results due to PS reals being single precision in most implementations (including ghostscript), coupled with my naive multiplication of the magic angle by the loop index. It didn't occur to me to just use PostScript's internal CTM mechanism, which is double-precision in ghostscript and presumably other implementations, to do the rotation part of "seed" positioning. I'm embarrassed to say it didn't even occur to me to do a simple fixed point multiplication to preserve precision when multiplying the magic angle. For what it's worth, this is my corrected PS: %!PS-Adobe-3.0 % Replace just the first occurrence of 2048 by the desired n, or, in interactive mode, % type "/n 100000 def" before running the file to produce 100000 seeds. % Scaling is done automatically to keep the entire graphic centered on a letter-sized page. /default {1 index where {pop pop pop} {def} ifelse} bind readonly def /n 2048 default /s 5 n 2048 div sqrt div def currentpagedevice /PageSize get aload pop .5 mul exch .5 mul exch translate s s scale 1 setlinewidth 1 setlinecap /360phinv -137.50776405003785464634873962837 def /pt {sqrt 0} readonly bind def 1 1 n {360phinv rotate pt moveto closepath stroke} for showpage On 3/22/2012 10:24 PM, Stuart Anderson wrote:
The following small postscript program provides a similar graphic;
%!PS 297 421 translate 0 .1 400{dup dup sqrt 4 div 0 360 arc fill 137.50775 rotate}for showpage
137.50775.. is the 'golden angle'
If you gradually change the rotation angle and animate , you get this;
http://www.youtube.com/watch?v=1GK1JfivJSU
No editing was done, just a gradual change of angle. what interested me was the appearance and metamorphosis of different cycles.
Stuart _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
BTW, if you can find a Postscript printer with a serial port, you can log in via an ascii terminal & get a read-eval-print loop. The default is to _not_ echo the characters you type in, so unless you twiddle a bit somewhere inside the printer, you'll be typing blind. It may be possible to log into your Postscript printer over the network via telnet, although I haven't tried it. At 09:27 AM 3/23/2012, Mike Speciner wrote:
Neat animation! Why did you make the "seeds" get bigger with radius? By the way, my calculator says the angle is 137.507764...
And thank you for this post. I had long ago written some PostScript to produce the sunflower graphic, but for large values of n it produced unexpected (i.e., wrong) results due to PS reals being single precision in most implementations (including ghostscript), coupled with my naive multiplication of the magic angle by the loop index. It didn't occur to me to just use PostScript's internal CTM mechanism, which is double-precision in ghostscript and presumably other implementations, to do the rotation part of "seed" positioning. I'm embarrassed to say it didn't even occur to me to do a simple fixed point multiplication to preserve precision when multiplying the magic angle.
For what it's worth, this is my corrected PS:
%!PS-Adobe-3.0 % Replace just the first occurrence of 2048 by the desired n, or, in interactive mode, % type "/n 100000 def" before running the file to produce 100000 seeds. % Scaling is done automatically to keep the entire graphic centered on a letter-sized page.
/default {1 index where {pop pop pop} {def} ifelse} bind readonly def /n 2048 default /s 5 n 2048 div sqrt div def
currentpagedevice /PageSize get aload pop .5 mul exch .5 mul exch translate s s scale 1 setlinewidth 1 setlinecap
/360phinv -137.50776405003785464634873962837 def /pt {sqrt 0} readonly bind def
1 1 n {360phinv rotate pt moveto closepath stroke} for
showpage
On 3/22/2012 10:24 PM, Stuart Anderson wrote:
The following small postscript program provides a similar graphic;
%!PS 297 421 translate 0 .1 400{dup dup sqrt 4 div 0 360 arc fill 137.50775 rotate}for showpage
137.50775.. is the 'golden angle'
If you gradually change the rotation angle and animate , you get this;
http://www.youtube.com/watch?v=1GK1JfivJSU
No editing was done, just a gradual change of angle. what interested me was the appearance and metamorphosis of different cycles.
Stuart
* Henry Baker <hbaker1@pipeline.com> [Mar 24. 2012 07:44]:
BTW, if you can find a Postscript printer with a serial port, you can log in via an ascii terminal & get a read-eval-print loop. The default is to _not_ echo the characters you type in, so unless you twiddle a bit somewhere inside the printer, you'll be typing blind.
It may be possible to log into your Postscript printer over the network via telnet, although I haven't tried it.
[...]
With emacs, you can edit the ps, then ctrl-c ctrl-c renders the image (bound to 'doc-view-toggle-display'). The same keystrokes bring back the source code when viewing the image. Also works for pdf, pnm, svg (and others). Very convenient indeed! cf. http://xkcd.com/378/
Well, apparently you also have to have ghostscript ("gs") installed so that Emacs can find it... At 01:05 AM 3/24/2012, Joerg Arndt wrote:
* Henry Baker <hbaker1@pipeline.com> [Mar 24. 2012 07:44]:
BTW, if you can find a Postscript printer with a serial port, you can log in via an ascii terminal & get a read-eval-print loop. The default is to _not_ echo the characters you type in, so unless you twiddle a bit somewhere inside the printer, you'll be typing blind.
It may be possible to log into your Postscript printer over the network via telnet, although I haven't tried it.
[...]
With emacs, you can edit the ps, then ctrl-c ctrl-c renders the image (bound to 'doc-view-toggle-display'). The same keystrokes bring back the source code when viewing the image.
Also works for pdf, pnm, svg (and others). Very convenient indeed!
"HB" == Henry Baker <hbaker1@pipeline.com> writes:
HB> It may be possible to log into your Postscript printer over the network via telnet, although I haven't tried it. If it has port 9100 support, then just telnet to it on port 9100 and run the executive command. If the printer supports multiple page descrition languages and is configured to auto-detect them, you'll need to send a %! comment first to swtich to postscript: :; telnet printer 9100 %! executive %% it reports some comments, include a copyright PS> They generally will echo back what you send after you send it; most telnet clients send a line at a time and do local echoing, too, so it looks something like: PS>4 5 add sqrt 4 5 add sqrt PS>= = 3.0 PS> (Note that = pops the stack, so say dup = to non-destructively see what is on the stack.) -JimC -- James Cloos <cloos@jhcloos.com> OpenPGP: 1024D/ED7DAEA6
participants (5)
-
Henry Baker -
James Cloos -
Joerg Arndt -
Mike Speciner -
Stuart Anderson