WeBWorK Problems

Custom checker extracting parts of a vector

Re: Custom checker extracting parts of a vector

by Davide Cervone -
Number of replies: 0
This works fine for constant vectors like <1,2,3>, but can be problematic when the answer is a vector formula. In that case, this only works if the student answers an explicit vector, like <x,y,x+y>, but will fail if the student enters 3<x,y,x+y> or <1,0,0>.<x,y,x+y>. So I recommend using the dot product unless you are using one of the restricted vector contexts that prevents vector formulas.

You can also do

rather than
to get just the first coordinate.

Note also that there is a Complex-Vector context, so no need to set that up yourself. Just use

There are also Complex-Point and Complex-Matrix contexts.