Context()->variables->remove('x','y','z');Another would be
Context()->variables->clear();But if you are adding new variables, the easier is to use
add(), which first removes all the existing variables and adds the new ones. So replace
Context()->variables->remove(x); # only variables should be n Context()->variables->add(n=> 'Real'); # how to remove y and z from Vector context?with
Context()->variables->are(n => 'Real');There are several other things you probably want to change as well. First, you probably want to disable a coupe of reduction rules that reorder or regroup the terms of your expressions. You can use
Context()->noreduce("(-x)+y","(-x)-y");to do that. This should keep your terms in the same order you gave them originally.
Next, it looks like you have used a pretty old problem as a starting point, so have some old-style code that should be updated.
TEXT(EV2(<<EOT)); ... EOTto
BEGIN_TEXT ... END_TEXTand
BEGIN_SOLUTIONand that will being you more up to date.