So: a student tries an answer using c instead of C and gets it wrong. Later, student comes back to the problem and sees a pink screen with a compiler error at the bottom.
## Description ## First order ODE with xy ## EndDescription
DOCUMENT(); loadMacros(PG.pl, PGbasicmacros.pl, PGchoicemacros.pl, PGanswermacros.pl, PGauxiliaryFunctions.pl, PGgraphmacros.pl, "Dartmouthmacros.pl");
## Do NOT show partial correct answers $showPartialCorrectAnswers = 0;
## Generate some coefficients $m = non_zero_random(-6,6,1);
## Clean up stuff like -1 x $func = clean_scalar_string($m, "xy");
## Ok, we are ready to begin... ## TEXT(beginproblem());
BEGIN_TEXT $BR Solve the following first-order differential equation: \( \displaystyle frac {dy}{dx} = $func \). \break Simplify your answer $BBOLD completely$EBOLD. Your answer should look like \(y = f(x)\). \break If an arbitrary constant appears in your answer, you must enter it as an uppercase C. \break For example, a valid answer for the differential equation \( \frac{dy}{dx} = y \) would look like \( C e^x \). $BR \( y = \) \{ ans_rule(40) \} $PAR
END_TEXT
## The answer is
ANS(multivar_function_cmp("C*e**( $m * {x**2/2})",["x","C"]));
ENDDOCUMENT();
Susan J. Diesel
---------------------------------
Hi Susan,
There are a number of possible solutions to this problem.
One would be to make the
answer evaluator smarter, so for example variables named C and c are equivalent.
We're working on making it easier to make small changes to existing answer evaluators
to handle situations such as this one.
A different way to ask the question is to use fun_cmp() and have the student give
a specific solution, (but the instructor gives a general solution which adapts itself
to the students answer) see the params option and examples in fun_cmp. I wrote
fun_cmp to handle this type of question, but it may
not be the question you wanted to ask.
I'll keep thinking to see if there is a cleverer way to handle this problem.
One other question -- does your use of \break display properly in tth mode? and if so
how do you accomplish this? ($BR also gives a line break.)
-- Mike
<| Post or View Comments |>
|