MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

continuous updating

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122191] continuous updating
  • From: Luis Valero <luis.valero at mac.com>
  • Date: Thu, 20 Oct 2011 07:42:34 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Dear sirs,

I want to move a Point along a line (fun1) that depend of a parameter (x) with continuous updating (fun2) using Manipulate. 
The test file I have written is:


Module[{fun1, fun2, iniState, state, x, play},
 fun1[x_, z_] := x + z;
 fun2 := {#[[1]] + .1, #[[2]] + .1, #[[3]] + 1} &;
 iniState[x_] := {-1, -1 + x, 0};
 Manipulate[
  Show[{
    Graphics[{
      If[play == True,
       If[state[[3]] < 20, state = fun2[state], state = iniState[x]],
       state = Evaluate[iniState[x]]];
      PointSize[.02], Point[state[[{1, 2}]]]
      }, Axes -> True, PlotRange -> {{-2, 2}, {-2, 2}}],
    Plot[fun1[x, z], {z, -1, 1}]
    }],
  {{x, 0, "x"}, -1, 1, .1},
  {{play, False, "play"}, {True, False}}
  , SaveDefinitions -> True, TrackedSymbols -> {x, play, state}]]

but doesn't work correctly.

Please tell me what is wrong

Thank you



  • Prev by Date: R: Ticks without labels
  • Next by Date: Re: Clear all variables but not functions
  • Previous by thread: TIFF file tags
  • Next by thread: Initial value problem when using NDSolve for differential-algebraic system