Notifications
Clear all

[Closed] Zenon stadium paradox. What am I doing wrong?

You all know the Zenon stadium paradox (move half the distance at each step, and the runner never reachs the goal)…
I have tried to reproduce it using a position_script controller and… it really happen to me!
I don’t know why my teapot reachs quickly a distance and then stays at this distance and does not come any closer. What am I doing wrong?
(It’s just an exercise of using own last position in a position_script controller)
The code:


(
   -- Set Scene ----
   delete objects
   theRunner = teapot radius:10 pos:[0,0,0]
   theGoal = sphere radius:10 pos:[200,0,0]
   
   with animate on
   (
      for f = 10 to 100 by 10 do
      (
         with animate on at time f
         (
            angle = 36 * f/10
            theGoal.pos = [200 * cos angle, 200 * sin angle, 0]
         )
      )
   )
   ---------------
   
   pos0 = theRunner.pos
   sNode = nodeMonitor node:theRunner
   
   ctrl1 = Position_Script()
   ctrl1.addNode "goal" theGoal
   ctrl1.AddObject "sNode" sNode
   ctrl1.AddConstant "pos0" pos0
   ctrl1.AddConstant "lastPos" pos0
   
   theRunner.position.controller = ctrl1
   
   str1 = 
   ("
      if (F != 0) then
      (
         pos = (lastPos + goal.Pos) / 2.0
         sNode.node.position.Controller.SetConstant \"lastPos\" pos
         --print (distance pos goal.Pos)
         pos
      )
      else
      (
         sNode.node.position.Controller.SetConstant \"lastPos\" pos0
         pos0
      )
   ")
   
   ctrl1.script = str1
)

Edit: OK. I know the answer.

2 Replies

because after you’ve reached an ‘optimal’ distance say 10…next frame the goal moves away by 10 (meaning distance is 20)…you react by closing in to half that which is 10…next frame it moves away by another 10 (meaning distance is 20 again)…you close in by 10…rinse and repeat…

try this

        theGoal.pos = [50 * cos angle, 50 * sin angle, 0]

so you’ll get much closer…(but then you’re just effectively making the ‘optimal’ distance smaller)

The CONSTANT velocity of the runaway will determine the optimal distance.

If the runaway gets ‘tired’ and STOPS…then the chaser will get closer and closer and closer…but never reaches the end goal.

Yes, it’s a Math problem, not a code problem as I thought.