So, take the procedure d := proc (n) options operator, arrow; piecewise(n = 0, 1, `mod`(n, 2) = 1, 2, `mod`(n, 4) = 2, 4, `mod`(n, 8) = 4, 8, `mod`(n, 16) = 8, 16, 32) end proc I tried to use unapply, but it doesn't work at all and gives strange results.. it appears to evaluate the mod beforehand. So, just evaluting d(n) above works fine > l := [seq(d(n), n = 0 .. 16)]; l := [1, 2, 4, 2, 8, 2, 4, 2, 16, 2, 4, 2, 8, 2, 4, 2, 32] However, simplify(d(n)) destroys the function. Also, prod(d(n),n=0..m) returns the wrong values, mul(d(n),n=0..5) works for a finite value such as 5, but does not work symbolically... what gives, why is maple behaving so badly with the mod operator? Any help would be greatly appreciated. Thanks, Stephen

Please Wait...