[Jprogramming] waves
Bo Jacoby
bojacoby at yahoo.dk
Sun Jan 22 18:48:59 HKT 2012
Thank you, Ian Clark, for the solution!
I use J602.
I had in mind varying the phase keeping the wave length constant, like this.
animate=: 3 : 0
for_i. i.10 do.
'dot; pensize 4' plot 32+64|wave 64 29 32, _0.5*_1^i%32
pause 0.1
end.
)
animate ''
It works in the beginning but not for big values of the index i. The'32+64|' is in order to keep the wave inside the fixed coordinate system.
- Bo
>________________________________
> Fra: Ian Clark <earthspotty at gmail.com>
>Til: Programming forum <programming at jsoftware.com>
>Sendt: 9:46 søndag den 22. januar 2012
>Emne: Re: [Jprogramming] waves
>
>Right... I should have said I was using J602 jwd, where plot updates
>the existing window.
>
>On Sun, Jan 22, 2012 at 6:05 AM, Linda Alvord <lindaalvord at verizon.net> wrote:
>> Using Chrome and Windows I get all of the images separately.
>>
>> -----Original Message-----
>> From: programming-bounces at jsoftware.com
>> [mailto:programming-bounces at jsoftware.com] On Behalf Of Ian Clark
>> Sent: Saturday, January 21, 2012 4:21 PM
>> To: Programming forum
>> Subject: Re: [Jprogramming] waves
>>
>>> 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
>> ----------------------------------------------------------------------
>> 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
>
>
>
More information about the Programming
mailing list