[Jprogramming] waves
Ian Clark
earthspotty at gmail.com
Sun Jan 22 05:21:15 HKT 2012
> Do anyone know how to animate this such that the waves are rolling?
Not with the parameters you've chosen.
But if it's just animation you want, this works for me (on the mac):
animate=: 3 : 0
for_i. >:i.40 do.
'dot; pensize 4' plot wave 65 29, i, _0.5
pause 0.2
end.
)
pause=: 3 : 0
NB. pause for y seconds
if. y-: 0 do. return. end.
t1=. (|y) + t=. 6!:1''
while. t<t1 do. t=. 6!:1'' end.
i.0 0
)
animate''
Needs some tuning, though. (Plus specifying a vertical range.)
On Sat, Jan 21, 2012 at 10:51 AM, Bo Jacoby <bojacoby at yahoo.dk> wrote:
> Hello J-ers.
> Consider this
> wave=: 3 : 0
> ('N';'D';'L';'S')=.y
> A=.,(i.N)j./-i.D
> k=.(0j_2p1%L)&*
> c=.S&*&^&+
> (+ c&.k)A
> )
>
> 'dot; pensize 4' plot wave 65 29 32 _0.5
>
> Maximize the plot window to get the proportions right.
> This shows the power of J, arrays, and the complex number exponential function.
> Do anyone know how to animate this such that the waves are rolling?
>
> -Bo
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list