See also http://rosettacode.org/wiki/Animate_a_pendulum#J
On Fri, May 16, 2014 at 7:04 AM, Joe Bogner <[email protected]> wrote: > Brian- neat... It can also be plotted with > > GA =: 9.80665 NB. Gravitational Acceleration (meters per second squared) > NB. FORM = 'Time={:6.3f}, Angle={:6.3f}, Speed={:6.3f}' > > require 'plot' > sin =: 1&o. > pi =: 1p1 > main =: 3 : 0 > pos=: 0 $ 0 > length =: 9.0 NB. Of pendulum (meters) > ngol =: - GA % length NB. Negative G over L > total_time =: 0.0 NB. Seconds > angle =: 1.0 NB. Initial angle of pendulum (radians) > speed =: 0.0 NB. Initial angular velocity (radians/second) > time_step =: 0.05 NB. Seconds > while. total_time < 30.0 do. > total_time =: total_time + time_step > speed =: speed + ngol * (sin angle) * time_step > angle =: angle + speed * time_step > smoutput 'setheading :',":angle + pi > pos=: pos,(angle + pi) > end. > plot pos > ) > > It looks like a reasonably correct path to me > > > On Thu, May 15, 2014 at 1:46 PM, Joe Bogner <[email protected]> wrote: > > > On Thu, May 15, 2014 at 1:20 PM, Brian Schott <[email protected] > >wrote: > > > >> > >> I am not familiar with the dot() function used in the python > >> version. Does anyone know what the dot() function does? > >> > >> > > https://docs.python.org/2/library/turtle.html#turtle.dot > > > > "Draw a circular dot with diameter size, using color. If size is not > > given, the maximum of pensize+4 and 2*pensize is used." > > > > I ran the python version fine. It draws a swinging pendulumn > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
