Question: How do you color a parametric curve as a function of parameter value?

Hi,

Here is the code I would like to complete:

with(plots):
theta:= s -> -2*Pi*n*s/ell;
v:=s->piecewise(And(0<=s,s<=ell/2), c*s, ell/2<s, c*(ell-s));
ell:=1;
c:=1;
n:=2;
spacecurve([cos(theta(s)),v(s),sin(theta(s))],s=0..ell,colorscheme = ["valuesplit",???????]);

What to put in place of the question marks so that the color of the curve is, for example, red if s is between 0 and ell/2, and green if s is between ell/2 and ell?

Thanks.

Please Wait...