Question: How to write a "conditional Explore" procedure?

Hi, 

I would like to enable/disable the Explore(plot(...), parameters=[...]) command according to some boolean value.
First idea (note that ending the previous command by : instead of ; doesn't prevent a figure to be displayed) was to encapsulated this Explore command within a conditional structure:
if T then Explore(...) end if.

But I prefered trying to define my own command by doing something like this:

EXPLORE := proc(TF::boolean)
  if TF then 
    Explore(_passed[2..-1])
  end if:
end proc:

with a call made this way:
EXPLORE(true, 'plot(a*x, x=0..1)', 'parameters=[a=-1.0 .. 1.0]');
wich ended with this error
Error, (in Explore) No parameters to explore


I also tried this without any more success:
EXPLORE := proc(TF::boolean)
  if TF then 
    Explore(_passed[1], parameters=_passed[2])
  end if:
end proc:

with a call made this way:
EXPLORE(true, 'plot(a*x, x=0..1)', [a=-1.0 .. 1.0]);
I get no more error but this warning and an inactive Explore
Warning, expecting only range variable x in expression a*x to be plotted but found name a

 


Can you help me to fix this?

Thanks in advance

 

 

Please Wait...