Is there some modification of basis_cmp we can use to check for a vector to be a positive multiple of a given vector? (This is important for steepest ascent and for orientation in surface integrals, for example.)
My awkward solution in the past has been to specify one of the coordinates and ask them for the resulting unique vector. Anything better?
Hi Ted,
Yes, you can do that easily using MathObjects. There is a working example at
http://webwork.maa.org/wiki/VectorOperations1#.T9eKUJjh_Tp
Good luck!
Paul Pearson
Yes, you can do that easily using MathObjects. There is a working example at
http://webwork.maa.org/wiki/VectorOperations1#.T9eKUJjh_Tp
Good luck!
Paul Pearson
Paul,
Unfortunately, I already knew about that :)
The course is column-vector driven, so I'm having the students fill in a 3x1 array with their answer. I don't know how to code turning that array into a vector that MathObjects will recognize. Sigh.
Thanks!
Unfortunately, I already knew about that :)
The course is column-vector driven, so I'm having the students fill in a 3x1 array with their answer. I don't know how to code turning that array into a vector that MathObjects will recognize. Sigh.
Thanks!
Hi Ted,
I think that Davide Cervone thought of this and wrote some code for us to use :) Here's a bit of code I picked up somewhere that should create a column vector MathObject and have it printed as a column vector using ans_array (instead of ans_rule or ans_box). The code below ought to work if you drop it into a template like the one at
http://webwork.maa.org/wiki/VectorOperations1#.T9et3pjh_Tq
## begin pg code ###############
$vec = ColumnVector([$a,$b,$c]);
BEGIN_TEXT
Find the vector ... \{$vec->ans_array\}
END_TEXT
ANS($vec->cmp(parallel=>1,sameDirection=>1));
## end pg code ##################
Good luck!
Paul
I think that Davide Cervone thought of this and wrote some code for us to use :) Here's a bit of code I picked up somewhere that should create a column vector MathObject and have it printed as a column vector using ans_array (instead of ans_rule or ans_box). The code below ought to work if you drop it into a template like the one at
http://webwork.maa.org/wiki/VectorOperations1#.T9et3pjh_Tq
## begin pg code ###############
$vec = ColumnVector([$a,$b,$c]);
BEGIN_TEXT
Find the vector ... \{$vec->ans_array\}
END_TEXT
ANS($vec->cmp(parallel=>1,sameDirection=>1));
## end pg code ##################
Good luck!
Paul
Thanks, Paul and Davide. That's awesome. I should learn that technique!