Another path from the polar shamrock: polar paint roses
load 'plot'
d=: 13 :'(0{x)-(-/x)*(i.>:y)%y' NB. domain intervals
f=: 13 :'(0 1) d y'
rose=: 13 :'(1 o.x*y) (*"1) 2 1 o./y'
T=:2p1
plot ;/1 rose (0,-:T) d 385
plot ;/(1 rose (0,-:T) d 385)*/f 385
plot ;/2 rose (0,-:T) d 385
plot ;/(2 rose (0,-:T) d 385)*/f 385
plot ;/2 rose (0,T) d 385
plot ;/(2 rose (0,T) d 385)*/f 385
plot ;/3 rose (0,-:T) d 385
plot ;/(3 rose (0,-:T) d 385)*/f 385
Since the plots don't show up in the e-mail, I attached the script.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Tuesday, March 27, 2012 10:26 AM
To: 'Programming forum'
Subject: Re: [Jprogramming] Challenge 8 A Shamrock for St. Patrick
Here's an interesting aspect at the heart of David Ward Lambert's shamrock.
He creates one trifolium. He rotates the graph slightly clockwise and also
slightly counterclockwise. He then superposes one on the other and the
leaves look quite like the leaves of a real shamrock.
d=: 13 :'(0{x)-(-/x)*(i.>:y)%y' NB. domain intervals
T=:2p1 NB. Tau
tf=: 13 :'(1 o. ((3*x),3) p. y) (*"1) 2 1 o./y' NB. trifolium
e=:(_1 1) d 13 NB. grid domain
f=:%:(0,1) d 13 NB. frame domain
masks=: 0&$: : (4 : 0)"0 NB. shamrock masks
INDEXES=: ~. <"1 ,/ |: e I. (x tf (0,T) d 13)*/f
1 INDEXES } s=:0 $~ 2 # >: y
)
(1 _1*0.2) masks 13
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0 0
0 0 0 0 0 0 0 0 1 1 1 1 0 0
0 0 1 1 0 0 0 0 1 1 1 0 0 0
0 1 1 1 1 1 1 1 1 1 0 0 0 0
0 0 0 1 1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0 0
0 0 0 1 1 1 1 1 1 0 0 0 0 0
0 1 1 1 1 1 1 1 1 1 0 0 0 0
0 0 1 1 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
]shamrock=:' X'{~+./ (1 _1*0.2) masks 13 NB. combine masks
XX
XXXX
XXXXX
XXXXX
XX XXXX
XXXXXXXXX
XXXXXX
XXXXXXXXX
XX XXXX
XXXXX
XXXXX
XXXX
XX
1j1&#"1 shamrock NB. expand shamrock
X X
X X X X
X X X X X
X X X X X
X X X X X X
X X X X X X X X X
X X X X X X
X X X X X X X X X
X X X X X X
X X X X X
X X X X X
X X X X
X X
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Wednesday, March 21, 2012 7:49 PM
To: 'Programming forum'
Subject: Re: [Jprogramming] Challenge 8 A Shamrock for St. Patrick
Copy the expression below into ijix and run display. A lovely graph of a
trifolium appears. It seems that it is arriving by mental telepathy. There
is no sign of 'radar' anyhere. Use load 'plot' and there is no sign of
'radar'. It is not in names_j_ or names_z_ . So where and what is it?
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Henry Rich
Sent: Wednesday, March 21, 2012 7:29 AM
To: Programming forum
Subject: Re: [Jprogramming] Challenge 8 A Shamrock for St. Patrick
Cute! J version:
'radar' plot 0 2p1;'1 + (cos 3*y) + *: sin 3*y'
Henry Rich
On 3/21/2012 5:55 AM, Boyko Bantchev wrote:
> FWIW, the cleanest mathematical / programmable trefoil that I know of
> is the following (I am too lazy to do it in J, so Gnuplot):
>
> set size ratio 1.08
> set parametric
> set polar
> plot [0:2*pi] t,1+cos(3*t)+sin(3*t)**2
> ----------------------------------------------------------------------
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm