multiples of a vector  topic started 9/12/2006; 12:05:54 PM last post 9/13/2006; 7:39:31 PM 



Davide P. Cervone  Re: multiples of a vector 9/13/2006; 7:39:31 PM (reads: 294, responses: 0) 
Gavin's suggestion of using the Parser's Vector object is a good one. Here is one way to do what you ask:
loadMacros( Here, we use a custom checker to provide out own function that determines if the student's answer is correct. The subroutine is passed the correct and student answers, and the first thing it does is check if the two are equal. If so, it returns 1 (for correct), but the real reason for this is to have the Parser create test points and evaluate the two formulas at those points. The resulting vectors are stored in the {text_values} array in each answer, and so we extract the first one from the professor's and student's answers. If the two answers are going to be multiples of each other, then every pair of tested points will have the same factor, and we determine that factor by comparing the first coordinates of the student's and professor's first tested vectors. (This assumes that the professor's vector does not have a zero first coordinate. You could set the limits for t to avoid zero for example.)
Finally, we check to see if the student's answer really is
this multiple of the professor's answer. We rule out a multiple of
zero, otherwise a student's answer of <0,0,0> would always be
marked as correct. (Note that since the coordinates of the vectors are
Parser Real objects, the Hope that is what you are looking for. Davide 