fib=: 3 : 0 M. NB. 0-indexed if. y <: 1 do. y else. (fib y-1) + fib y-2 end. )
fib 14 5!:1 <'fib' 5!:5 <'fib' 5!:2 <'fib' 5!:6 <'fib' 5!:4 <'fib' Linda -----Original Message----- From: Programming [mailto:[email protected]] On Behalf Of Linda A Alvord Sent: Wednesday, March 1, 2017 11:20 AM To: [email protected] Subject: Re: [Jprogramming] A Slinky Hi Ben, (from fib explicit) I found that seeing your code dissected has made it clearer what is happening here. The viewmat is impressive. fiba =: 3 : 0 'height width' =. $y if. (height>:width) do. y,.(height,height)$height else. y,(width,width)$width end. ) fibb =: 3 : 'y (,`,.) @.(>:/$y) (s,s) $ s=.>./$y' dissect 'fiba^:7 (1 1$1)' dissect '5 | fibb^:10 (1 3$1)' load 'viewmat' viewmat 5 | fibb^:10 (1 3$1) NB. Lucas mod 5 Thanks, Linda -----Original Message----- From: Programming [mailto:[email protected]] On Behalf Of Linda A Alvord Sent: Tuesday, February 28, 2017 9:17 PM To: [email protected] Subject: [Jprogramming] A Slinky load 'plot' do=: 13 :'({.y)+(i.{:>:y)*(--/}:y)%{:y' t=:do 0 10 1000 sin=:1&o. cos=:2&o. 'pensize 2;aspect 1'plot (sin t);cos t NB. TWO poolar circles 'pensize 2;aspect 1'plot t;(sin t);cos t NB. Slinky from two circles over time Cliff, I'm trying to create a Fibonacci spiral in 2-D. I wonder how it might be extended to 3-D and appear like an actual seashell. Somehow it might be based upon the slinky created above Thanks for you article. Linda ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
