namely?
I do see there were some problems in the display of verb "spiral"
(despite pasting the stuff to a text notepad file and then copying/
pasting into Thunderbird! - sorry again)
I've attempted some inline edits below. Maybe they'll work...
Also, I see I'd swapped the comments on the 2-d and 3-d plot examples!
I've just now thought of Googling "Fibonacci Helix" which revealed the
idea of drawing cylindrical quarter-spirals in successive nested cubes of
size 1 1 2 3 5... Needs a bit of work!
You mentioned just now trying:
'pensize 2;aspect 1'plot ((t^3)*sin t);(t^3)*cos t=:do 0,(o.4.5),100
but that suggests you should give Raul's proposal a shot,
something like
'pensize 2;aspect 1'plot [t;] ((phi^t)*sin t);(phi^t)*cos t
(ie with or without t; ^^^^ NOT J notation! )
It seems a lot simpler to draw the exact helix in some such fashion,
than to develop the fractal squares or cubes that I'd started on.
Mike
On 01/03/2017 08:18, Linda A Alvord wrote:
Mike,
Here's an error that I am getting.
Linda
-----Original Message-----
From: Programming [mailto:programming-boun...@forums.jsoftware.com] On Behalf
Of 'Mike Day' via Programming
Sent: Tuesday, February 28, 2017 11:03 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Explicit fib
That's the exact approach, as you know.
Meanwhile, I'd got the impression that Linda wished to present the
quarter-circle approximations, as shown in, eg,
https://en.wikipedia.org/wiki/Golden_spiral#/media/File:Fibonacci_spiral_34.svg
So I've amused myself for a while developing the following. As each quarter
circle has an offset centre, I've reverted to Cartesian coords.
It's ended up less transparent than I hoped. Also, given the fairly rapid
growth of the Fibonacci sequence, the later cycles dominate the plot.
(Cliff's reference to his article has just popped up while I was drafting this;
it might render all the following redundant!)
NB. Fibonacci spirals:
NB. radii 1 1 2 3 5 8 13 21 34
NB. centres (00) (00) (01) (_1 1) (_1 _1) (2 _1) (2 4) (_6 4) (_6 _9) NB.
differences between centres:
NB. diffs (00) (01) (_1 0) (0 _2) (3 0) (0 5) (_8 0) (0 _13)
NB. multipliers needed to derive these differences:
NB. mults (10) (01) (_1 0) (0 _1) (1 0) (0 1) (_1 0) (0 _1)
mults =: 1 0 0 1 _1 0 0 _1$~ ,&2
radii =: 0 1, fib2"0 @: i. @: -&2 NB. as defined elsewhere in thread
NB. Think I'd prefer a vector fib on a scalar input, but no matter, here!
centres =: +/\@ }:@: (0, radii * mults)
NB. set parameter running over y circles (sets of 2pi) in x steps per quadrant,
from pi/2
param =: (] (0.5p1+(2p1 * (#~>:&0))) @: i:@j. (*(8&*)))
xyvals =: cos,: sin NB. radius 1, centre 0 0
NB. set up approx Fibonacci Spiral for y[0] circles, y[1] steps per quadrant
spiral =: 3 : 0
'n s' =. 2{. y, 10
nt =. #t =. s param n
offsets =. nt{.s#centres 1+4*n NB. centres in each successive quadrant
rads =. nt{.s#}.radii 2+4*n NB. radii """"""
NB. slight inefficiency here, ^^^, in calling fib2 (or whatever) twice
xy =. (|:offsets) + rads *"1 xyvals t NB. cart coords of quarter
NB. circles
((4*s)%~ i.nt) , xy NB. return scale (fairly arbitrary)
NB. with x y coords
)
'pensize 2;aspect 1'plot <"1 spiral 2 10 NB. 3-d plot of spiral v
NB. circle counter
'pensize 2;aspect 1'plot <"1 }. spiral 2 10 NB. 2-d plot of spiral
I expect it would need simplifying for 10/11 year-olds, if they're who Linda
has in mind.
But a start, maybe
Mike
On 28/02/2017 15:07, Raul Miller wrote:
It is begining to sound like you might want this approach:
phi=: (1 + %: 5) % 2
spiralfib=: verb define
(phi^y) % %:5
)
fib=: verb define
<. 0.5 + spiralfib y
)
Is that where you were heading?
Thanks,
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm