I have a question which has three parametric equations as the answer. I then need to parse out variables from these equations and make sure the 3 equations satisfy 4 conditions. How do I have $response equal 3 different equations? My answer would be coming in as x=$a+$b*t, y=$c+$d*t, z=$f+$g*t.
I would then use the variables a-g in my tests.
maple graded
More context would be useful. Maybe post the .qu file. Without this, it is not easy to be too helpful.
My first reaction is that you should have $RESPONSE coming in as a list (or maybe a set):
[x=$a+$b*t, y=$c+$d*t, z=$f+$g*t] or something similar.
Then you get the parts by $RESPONSE[1], etc.
I've authored some MapleTA questions that have parametric equations as the "answer" and finessed them to allow for fairly general reparameterizations, so with more details, maybe I can be of more help.
Thanks for the help
I would love the help with my .qu file but i can't get it to upload to the mapleprimes site. It won't take this type of file. Below is the source code. I wrote it in Maple first but that does not help with the "type" of variable $response is.
question=Given the two planes:
$line1_show
$line2_show
Enter the parametric equations for the line of intersection:
(enter in the format: x=x0+a*t,y=y0+b*t,z=z0+c*t )@
maple=$x= subs(t = 0, $response[1]);
$y= subs(t = 0, $response[2]);
$z= subs(t = 0,$response[3]);
$a=subs(t = 1, $response[1])-($x);
$b=subs(t=1,$response[2])-($y);
$c=subs(t = 1,$response[3])-($z);
$line1sub := subs({x = $x, y = $y, z = $z}, $line1);
$check1= `if`($line1sub = $p1, true, false);
$line2sub= subs({x = $x, y = $y, z = $z}, $line2);
$check2= `if`($line2sub = $p2, true, false);
$check3= `if`(LinearAlgebra:-CrossProduct(Vector([$a, $b, $c]), $uvcross) = 0, true, false);
$check4= `if`($x1 = 0 and $x2 = 0 and $x3 = 0, false, true);
`if`(`and`(`and`(`and`($check1 = true, $check2 = true), $check3 = true), $check4 = true), true, false);@
type=maple@
mode=Maple@
name=dummy 2 plane@
editing=useHTML@
algorithm=$x1=1;
$y1=2;
$z1=3;
$x2=4;
$y2=1;
$z2=2;
$p1=6;
$p2=3;
$line1=$x1*x+$y1*y+$z1*z;
$line2=$x2*x+$y2*y+$z2*z;
$line1_show=maple("printf(MathML:-ExportPresentation(expand($x1*x+$y1*y+$z1*z=$p1)))");
$line2_show=maple("printf(MathML:-ExportPresentation(expand($x2*x+$y2*y+$z2*z=$p2)))");
$sol=maple("solve({$x1*x+$y1*y=$p1,$x2*x+$y2*y=$p2},[x,y])");
$xvalue=maple("(rhs($sol[1,1]))");
$yvalue=maple("(rhs($sol[1,2]))");
$uvect=maple("Vector([$x1,$y1,$z1])");
$vvect=maple("Vector([$x2,$y2,$z2])");
$ushow=maple("printf(MathML:-ExportPresentation(u=$uvect))");
$vshow=maple("printf(MathML:-ExportPresentation(v=$vvect))");
$pv_cross = maple("LinearAlgebra[CrossProduct]($uvect,$vvect)");
$pvshow=maple("printf(MathML:-ExportPresentation($pv_cross))");
@
MapleTA question: intersect two planes
Linda,
Try the question below. Here is the outline:
Generate linear functions f1(x,y,z) and f2(x,y,z) and associated linear equations.
Then take the student response, which is a list
$RESPONSE=[x=a+b*t,y=c+d*t,z=e+f*t] and have Maple turn these into function. For example, unapply(rhs($RESPONSE[1]),t);
Generate two points on the line defined by $RESPONSE using these functions.
Have Maple verify that each of the two points satisfies both linear equation, and that the two points are not equal. End of outline, MapleTA script follows.
...
question=Find parametric equations for the line of intersection of the two planes $eq1ml and $eq2ml.
Enter your answer as a list of equations, use the letter "t" for the parameter, and use * for multiplication. So your answer might look like
$exampleml@
maple=X:=unapply(rhs($RESPONSE[1]),t);
Y:=unapply(rhs($RESPONSE[2]),t);
Z:=unapply(rhs($RESPONSE[3]),t);
check1:=evalb(simplify($f1(X(0),Y(0),Z(0))-($d1))=0
and simplify($f2(X(0),Y(0),Z(0))-($d2)=0));
check2:=evalb(simplify($f1(X(1),Y(1),Z(1))-($d1))=0
and simplify($f2(X(1),Y(1),Z(1))-($d2)=0));
check3:=evalb(not([X(0),Y(0),Z(0)]=[X(1),Y(1),Z(1)]));
evalb(check1 and check2 and check3);@
type=maple@
mode=Maple@
name=Two planes intersect in a line@
algorithm=$a1=range(-5,5);
$b1=range(-5,5);
$c1=range(-5,5);
$d1=range(-5,5);
$a2=range(-5,5);
$b2=range(-5,5);
$c2=range(-5,5);
$d2=range(-5,5);
condition:ne($a1*($b2)-($a2)*($b1),0);
$f1=maple("proc(x,y,z) $a1*x+($b1)*y+($c1)*z end proc");
$f2=maple("proc(x,y,z) $a2*x+($b2)*y+($c2)*z end proc");
$eq1ml=maple("printf(MathML:-ExportPresentation($f1(x,y,z)=$d1))");
$eq2ml=maple("printf(MathML:-ExportPresentation($f2(x,y,z)=$d2))");
$exampleml=maple("printf(MathML:-ExportPresentation([x=3*t-1,y=4*t+5,z=2-4*t]))");@
THanks for the help
I want to make sure I totally understand your logic. Why do we have to unapply(rhs(response[1]))? Is that not equal to response[1]?
unapply and rhs
Linda,
$response[1] might look like
x(t)=4*t+3
What we want to do is grab the right hand side, which would be the expression 4*t+3 and turn it into a function X so that we can easily generate points on the line given by the student's parametric equations $response.
Maybe the unapply is confusing. If we had something like
ex:=4*t+3;
then to evaluate it at different values of t, we would have to do something awkward like
subs(t=0,ex);
But if we had instead setup things up by
X:=proc(t) 4*t+3 end proc;
then we could evaluate X to numbers by simply applying X (note the word "apply" here!) to the value of t:
X(1);
What unapply does is to take an expression like 4*t+3 and converts it to a procedure or function:
X:=unapply(4*t+3,t); results in
X:=proc(t) 4*t+3 end proc, which is set up nicely for evaluation.
X(0), X(1), etc.
I will answer the same as Mr
I will answer the same as Mr Smith, with maple Graded questions when the answer isn't too obvious (i.e. the area of these square is?) we use to add a camp called solution pattern, something like:
This use to help students... (be careful, if they can do something wrong they will.. )
evalb and equivalent unfactored or decimal-exponent answers
This should be easy for you veteran TA question bank writers. (I'm still a rank beginner so go slow on your answer please!) Students who enter the correct derivative but use 0.5 instead of 1/2 for an exponent or who enter a single-term answer (while MAPLE spits out some quotient rule derivatives with more than one term) get "incorrect answers" because evalb doesn't come up with a 0 (somehow) in the difference (literally speaking) between a student decimal or one-term answer and Maple's. I've gotten past some of this by using FACTOR for both the Maple and Student entries, but do not know how to get around the decimal exponent (aside from warning students in the problem they should avoid decimals for exponents.) Perhaps there is an entirely different approach here besides trying to anticipate differences between student answers and Maple's. Any thoughts most welcome.
did you try simplify?
Randy,
It's been a while since I have worked in MapleTA but my experience there - and in regular Maple - suggest that you need to use simplify (and sometimes normal or another command of this type) to force Maple to put all terms in the difference between the user's response and the "correct" answer.
Let me illustrate:
F1 := sqrt(x): F2 := x^(1/2): F3 := x^(0.5): S := {F1,F2,F3}; / 0.5 (1/2)\ S := { x , x } \ / simplify( S ); / (1/2)\ { x } \ / evalb( F1-F2=0 ); evalb( F1-F3=0 ); evalb( simplify( F1-F3 ) = 0 ); true false trueThe output from the definition of S indicates that Maple recognizes F1 and F2 as the same expression. After application of simplify, the set contains only a single element - so all three expressions are recognized as being equivalent.
Note that while it is not an issue in this example, it is generally better to check if a difference is zero than to ask if two expressions are equal to one another.
I hope this is helpful,
Doug