http://wwrk.maa.org/moodle/mod/forum/discuss.php?d=1888that describes several ways to do this.

I've also just entered changes in the CVS repository so that `Formula("z")->with(period=>2*pi)` will match `z`, `z+2pi`, `z-2pi` and so on.

Note that you do *not* include `2pi k` in this approach. If you want to require the students to include this in their answers, see the discussion listed above. If you go with one of the last two solutions on that page, note that it is now eaier to obtain the value of the parameter `a` than it was when I wrote that example. Before removing the parameter, you can do

$a = Context()->variables->get('a')->{value};to obtain the value of the parameter as it was set for the equality check. This prevents having to obtain it by dividing the difference of the correct and student answers by 2pi.

Davide