Question: Worksheet code vs component code

I am very new to Maple and am trying to teach myself until next semester when I will be taking a course.

I am trying to make a GUI based worksheet to display a plot of a vector valued function (in R^2) and its velocity and acceleration vectors. I wrote code in a worksheet and it seems to work, but I am having trouble getting the plot to work when I put the code in a slider (to update continuosly as the value of t changes with the slider). I understand there are differences in code syntax between the worksheet and the component.

Can anyone take a look at the code (which seems to function in a worksheet) and give me tips on how it needs to be modified to work when embeded in a component.

Be gentle, I'm new. ;)

TIA

Rick

 

THIS IS WHAT SEEMS TO WORK IN THE WORKSHEET

 rlist := convert(r, list);     Vector valued equation, r(t) from MathContainer
 with(ListTools);
 i := SelectFirst(rlist);
 j := SelectLast(rlist);
 v := convert(diff(rlist, t), 'list');
 a := convert(diff(diff(rlist, t), t), 'list');
 Do (tValue = %SliderT);
 r := `<,>`(i, j);
 rEval := eval(r, [t = tValue]);
 vEval := eval(v, [t = tValue]);
 aEval := eval(a, [t = tValue]);
 with(plots);
 plot([i, j, t = -tValue-5..tValue+5],-5..5,-5..5, axes = normal, color = red);
 velocity := arrow([rEval], [vEval], color = blue, shape = arrow);
 acceleration := arrow([rEval], [aEval], color = green, shape = arrow);
 display(`%%%`, `%%`, %);

 

 THIS IS WHAT I ATTEMPTED IN THE COMPONENT - The r(t) function plots, but no vectors. Also, the range of   the axes does not seem to adjust.
 rlist := convert(r, list);
 with(ListTools);
 i := SelectFirst(rlist);
 j := SelectLast(rlist);
 v := convert(diff(rlist, t), 'list');
 a := convert(diff(diff(rlist, t), t), 'list');
 Do (tValue = %SliderT);
 r := `<,>`(i, j);
 rEval := eval(r, [t = tValue]);
 vEval := eval(v, [t = tValue]);
 aEval := eval(a, [t = tValue]);
 with(plots);
 Do(%plotWindow = (plot([i, j, t = -tValue-5..tValue+5],-5..5,-5..5, axes = normal, color = red)));
 Do(%plotWindow = (plot(arrow([rEval], [vEval], color = blue, shape = arrow))));
 Do(%plotWindow = (plot(arrow([rEval], [aEval], color = green, shape = arrow))));
 display(`%%%`, `%%`, %);

Please Wait...