## Forum archive 2000-2006

### Mark Schmitt - Follow-through points ### Mark Schmitt - Follow-through points

by Arnold Pizer -
Number of replies: 0 Follow-through points topic started 5/30/2001; 3:18:52 PMlast post 5/31/2001; 10:41:06 PM Mark Schmitt - Follow-through points 5/30/2001; 3:18:52 PM (reads: 1816, responses: 5) I'm looking for a way to write multiple part problems where a student's answers can "follow through" the problem. That way, a mistake at the beginning of a problem doesn't render all later work moot. I'd like to be able to base later answers off of the earlier answers from the student. That way a student can see if his/her method is right, despite an earlier mis-step. In looking around the site, it seemed that using $inputs_ref would be useful, but I'm not having any success implementing it. I would greatly appreciate help in solving this problem. Mark <| Post or View Comments |> Zbigniew Fiedorowicz - Re: Follow-through points 5/31/2001; 8:47:37 AM (reads: 2127, responses: 0) Hi Mark, I'm not sure about exactly what you want to do, but perhaps the following example is along the lines of what you are looking for. Zig ##DESCRIPTION #KEYWORDS('trig functions', 'inverse trig functions') ##Simplify expression involving trig and inverse trig functions ##Midterm 2 Review ##Authored by Zig Fiedorowicz 2/4/2000 ##Revised May 2001 ##ENDDESCRIPTION DOCUMENT(); loadMacros( );$showPartialCorrectAnswers = 1;  $AA = random(3,6,1); TEXT(&beginproblem); BEGIN_TEXT Simplify the expression [\tanleft(2cos^-1(x/$AA)right)] $PAR answer = {NAMED_ANS_RULE(first_answer,45)}$PAR END_TEXT  #First make sure that there are no trig functions in the expression $firstAnswer =$inputs_ref->{first_answer}; $firstAnswer = '' unless defined($firstAnswer);  if (($firstAnswer =~ /tan/) || ($firstAnswer =~ /cos/) || ($firstAnswer =~ /sin/)) {NAMED_ANS(first_answer,strict_str_cmp("2*x*sqrt($AA^2-x^2)/(2*x^2-$AA^2)"));} else {NAMED_ANS(first_answer,function_cmp("2*x*sqrt($AA^2-x^2)/(2*x^2-$AA^2)"));} ENDDOCUMENT(); <| Post or View Comments |> Zbigniew Fiedorowicz - Re: Follow-through points 5/31/2001; 8:55:04 AM (reads: 2056, responses: 0) Here's another example. Also Arnie and Mike have an example in their notes for their New Orleans short course, where the problem text changes, depending on the student's answer to the first part of the problem (basically do the same thing as below with appropriate if-else blocks). Zig #DESCRIPTION #KEYWORDS('limits', 'derivatives') ##Authored by Zig Fiedorowicz May 2001 ##for Math 151 #Find derivative by taking the limit lim_{tto x}(f(t)-f(x))/(t-x) #ENDDESCRIPTION #KEYWORDS('limits', 'derivatives') DOCUMENT(); # This should be the first executable line in the problem. loadMacros( ); TEXT(&beginproblem);$showPartialCorrectAnswers = 1;  $a = random(2,9,1);$b = random(2,7,1); $ans1 = "($b/(t- $a)-$b/(x- $a))/(t-x)";$num = "$b*(x-t)";$denom = "(t- $a)*(x-$a)*(t- x)"; #Allow two alternative cancellations $cancel = "t-x";$cancel_alt = "x-t"; $num2 = "-$b"; $num2_alt = "$b"; $denom2 = "(t-$a)*(x- $a)";$denom2_alt = "($a - t)*(x-$a)"; $ans2 = "-$b/(x- $a)**2"; BEGIN_TEXT Let (f(x)=frac{$b}{x- $a}). Then according to the definition of derivative$BR (f'(x) = lim_{tto x})\{ans_rule(45)}$BR (Your answer above and the next few answers below will involve the variables (t) and (x).)$BR The expression inside the limit simplifies to a simple fraction with $BR numerator (=) {ans_rule(30)}$BR and denominator (=) {ans_rule(40)} $BR We can cancel the factor {NAMED_ANS_RULE(first_answer,25)} appearing in the denominator against a similar factor appearing in the numerator leaving a simpler fraction with$BR numerator (=) {NAMED_ANS_RULE(second_answer,30)} $BR and denominator (=) {NAMED_ANS_RULE(third_answer,40)}$BR Taking the limit of this fractional expression gives us $BR (f'(x) = ) {ans_rule(30)} END_TEXT &ANS(multivar_function_cmp($ans1,["x","t"])); &ANS(multivar_function_cmp($num,["x","t"])); &ANS(multivar_function_cmp($denom,["x","t"]));  #Check whether we are cancelling t-x or x-t ($ans_eval1) = std_num_cmp(1);$firstAnswer = $inputs_ref->{first_answer};$firstAnswer = '' unless defined($firstAnswer);$firstAnswer =~ s/t/(2)/g; $firstAnswer =~ s/x/(1)/g;$rh_ans_hash = &$ans_eval1($firstAnswer);  #Check answers accordingly if (1 == $rh_ans_hash->{score}) { NAMED_ANS(first_answer,multivar_function_cmp($cancel,["x","t"])); NAMED_ANS(second_answer,multivar_function_cmp($num2,["x","t"])); NAMED_ANS(third_answer,multivar_function_cmp($denom2,["x","t"])); } else { NAMED_ANS(first_answer,multivar_function_cmp($cancel_alt,["x","t"])); NAMED_ANS(second_answer,multivar_function_cmp($num2_alt,["x","t"])); NAMED_ANS(third_answer,multivar_function_cmp($denom2_alt,["x","t"])); } &ANS(function_cmp($ans2));   ENDDOCUMENT(); <| Post or View Comments |> Zbigniew Fiedorowicz - Re: Follow-through points 5/31/2001; 8:55:11 AM (reads: 2033, responses: 0) Here's another example. Also Arnie and Mike have an example in their notes for their New Orleans short course, where the problem text changes, depending on the student's answer to the first part of the problem (basically do the same thing as below with appropriate if-else blocks). Zig #DESCRIPTION #KEYWORDS('limits', 'derivatives') ##Authored by Zig Fiedorowicz May 2001 ##for Math 151 #Find derivative by taking the limit lim_{tto x}(f(t)-f(x))/(t-x) #ENDDESCRIPTION  #KEYWORDS('limits', 'derivatives')  DOCUMENT(); # This should be the first executable line in the problem.  loadMacros( );  TEXT(&beginproblem); $showPartialCorrectAnswers = 1;$a = random(2,9,1); $b = random(2,7,1);$ans1 = "($b/(t-$a)-$b/(x-$a))/(t-x)"; $num = "$b*(x-t)"; $denom = "(t-$a)*(x- $a)*(t- x)"; #Allow two alternative cancellations$cancel = "t-x"; $cancel_alt = "x-t";$num2 = "- $b";$num2_alt = "$b";$denom2 = "(t- $a)*(x-$a)"; $denom2_alt = "($a - t)*(x- $a)";$ans2 = "- $b/(x-$a)**2";  BEGIN_TEXT Let (f(x)=frac{$b}{x-$a}). Then according to the definition of derivative $BR (f'(x) = lim_{tto x})\{ans_rule(45)}$BR (Your answer above and the next few answers below will involve the variables (t) and (x).)$BR The expression inside the limit simplifies to a simple fraction with$BR numerator (=) {ans_rule(30)} $BR and denominator (=) {ans_rule(40)}$BR We can cancel the factor {NAMED_ANS_RULE(first_answer,25)} appearing in the denominator against a similar factor appearing in the numerator leaving a simpler fraction with $BR numerator (=) {NAMED_ANS_RULE(second_answer,30)}$BR and denominator (=) {NAMED_ANS_RULE(third_answer,40)} $BR Taking the limit of this fractional expression gives us$BR (f'(x) = ) {ans_rule(30)}  END_TEXT &ANS(multivar_function_cmp($ans1,["x","t"])); &ANS(multivar_function_cmp($num,["x","t"])); &ANS(multivar_function_cmp($denom,["x","t"])); #Check whether we are cancelling t-x or x-t ($ans_eval1) = std_num_cmp(1); $firstAnswer =$inputs_ref->{first_answer}; $firstAnswer = '' unless defined($firstAnswer); $firstAnswer =~ s/t/(2)/g;$firstAnswer =~ s/x/(1)/g; $rh_ans_hash = &$ans_eval1($firstAnswer); #Check answers accordingly if (1 ==$rh_ans_hash->{score}) { NAMED_ANS(first_answer,multivar_function_cmp($cancel,["x","t"])); NAMED_ANS(second_answer,multivar_function_cmp($num2,["x","t"])); NAMED_ANS(third_answer,multivar_function_cmp($denom2,["x","t"])); } else { NAMED_ANS(first_answer,multivar_function_cmp($cancel_alt,["x","t"])); NAMED_ANS(second_answer,multivar_function_cmp($num2_alt,["x","t"])); NAMED_ANS(third_answer,multivar_function_cmp($denom2_alt,["x","t"])); }    &ANS(function_cmp(\$ans2));   ENDDOCUMENT(); <| Post or View Comments |> Arnold K. Pizer - Re: Follow-through points 5/31/2001; 11:43:40 AM (reads: 2084, responses: 0) The problem Zig refers to from our New Orleans Minicourse can be found as follows. Connect to http://webwork.math.rochester.edu/maa100/ Login as practice1, etc with password practice1, etc Look at Problem 16 in the set MAAtutorial <| Post or View Comments |> Mark Schmitt - Re: Follow-through points 5/31/2001; 10:41:06 PM (reads: 2120, responses: 0) Zig, Even though my question was not completely clear, I think you have given me the answer I was looking for. Thanks. One of my fellow teachers likes to give multi-part questions where the answer to part one is used to find the answer to part two (and the answer to part two is used to find the answer to part three...). When grading by hand, if a student gets the wrong answer to part one, we as teachers can still grade the method of the later parts, even though the numbers will be wrong. I was looking for a way to access the answers the student types in so that the later answers can be based on these values. That way, a correct method will still yield an acceptable answer. I'm working with the following code: TEXT(EV2(<{Answer1}; TEXT(EV2(<