Line Tracing

Roger Guay rogerguay at centurytel.net
Sun Feb 2 14:10:00 EST 2003


Thank you very much for your helpful suggestions,  Jim.  I going to 
start by getting an understanding of TurtleGraphics  and your 
TurtleGraphicDemo . . . right now!

> Roger,
>
> There is a real catch in solving the Foucault Pendulum problem. The
> equations of motion have no closed form solution. (Although there are
> approximate solutions for small amplitude and for small angular
> velocity.) But if you employ the method illustrated in the Turtle
> Graphics Demo you don't need the solution, you effectively solve the
> equations of motion with a very simple algorithm:
>
> repeat
>     xNew = xOld + velocityOld*t
>     velocityNew = velocityOld + acceleration*t
>     (put the  new x into the old x and draw the line)
>     (put the new velocity into the old velocity)
> end repeat
>
> where t is some fixed small time increment, and the acceleration is a
> known function.
>
> If for simplicity you take t = 1 (sec), the TG code for *any* problem
> in dynamics  is:
>
> Repeat forever --Or until you lose patience
>    IncrementXY vx, vy
>    add accx() to  vx
>    add accy() to vy
> end repeat
>
> The line "IncrementXY vx,vy" increments the x and y coordinates of
> the path by vx and vy, and simultaneously draws the  line.
>
> It doesn't get much simpler. This becomes a template for solving
> *all* such problems in dynamics. You  just  have to write different
> acceleration functions depending on the physical circumstances. You
> can see why I am promoting Transcript/TG as a mean of teaching
> programing to high school science students.
>
> This algorithm is in effect the solution to the differential equation
> of motion by the  method of finite differences, but I wouldn't tell
> anybody--they will shun you.
>
> May I suggest the two dimensional harmonic oscillator rather than the
> Foucault Pendulum. You get beautiful Lissajou figures (prettier than
> the  Foucault path) which are open or closed depending on the ratio
> of the x  and y spring constants. This is a very rich problem for
> exploration.
>
> Good luck. You look like you are having fun.
>
> Jim

I am indeed having fun . . . combining two loves; RR scripting and 
Physics.

Cheers, Roger




More information about the use-livecode mailing list