WeBWorK Problems

/maCalcDB/setDerivatives7Log/mec8.pg

/maCalcDB/setDerivatives7Log/mec8.pg

by Jason Aubrey -
Number of replies: 1
Hi All,

We are seeing problems with the problem /maCalcDB/setDerivatives7Log/mec8.pg (code copied in below), and I can't see how to fix it although it is a very simple problem.

The seed 1420 gives an example of the problem we're seeing. The student does give a correct answer, but it is not counted correct and gives the message "Can't generate enough points for comparison."

Any ideas? I've run it with diagnostics on, but the output wasn't helpful (to me).

Thanks,
Jason

##DESCRIPTION ##KEYWORDS('derivatives', 'logarithmic functions')
## tcao tagged and PAID on 12-12-2003
## DBsubject('Calculus')
## DBchapter('Differentiation')
## DBsection('Derivatives of Logarithmic Functions')
## Date('6/3/2002')
## Author('')
## Institution('')
## TitleText1('Calculus: Early Transcendentals')
## EditionText1('6')
## AuthorText1('Stewart')
## Section1('3.6')
## Problem1('18')
## differentiation of log function b sin(x) + a x^{x}
##ENDDESCRIPTION

DOCUMENT();
# This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl",
"MathObjects.pl");

TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context("Numeric");
$a = random(1,9,2);
$c = random(2,8,2);
$b = random(1,9,1);
$d = random(1,9,1);

Context()->flags->set(x=>{limits=>[Compute("$d/$c"),Compute("($d/$c)+10")]}); Context()->flags->set(x=>{limits=>[5,10]});

$Funct = Formula("ln(sqrt(($a*x + $b)/($c*x - $d)))")->reduce;
$Deriv1 = $Funct->D; Context()->texStrings;

BEGIN_TEXT

Let \[ f(x) = $Funct \] $PAR \( f'( x ) = \) \{ans_rule(60) \}

END_TEXT
Context()->normalStrings;
ANS($Deriv1->cmp(diagnostics=>1));
ENDDOCUMENT(); # This should be the last executable line in the problem.
In reply to Jason Aubrey

Re: /maCalcDB/setDerivatives7Log/mec8.pg

by Davide Cervone -
Looking at the diagnostics told me that the limits are not being properly applied, since the graphs run from -2 to 2 (the default limits) rather than 5 to 10, as expected. That made me look more carefully at where they are set, and I noticed that they are being set improperly. It should be
    Context()->variables->set(x=>{limits=>[5,10]});
with variables rather than flags.

Unfortunately, changing this didn't fix the problem either (though is should have) and I don't have the time at the moment to look into it further. In the meantime, you can do

    Context()->flags->set(limits=>[5,10]);
to set the default limits for EVERYTHING (and yes, this one IS flags), or you can use
    ANS($Deriv1->cmp(limits=>[5,10]));
or
    $Deriv1 = $Funct->D->with(limits=>[5,10]);
as any of these do work.

Davide