[ww-bugs] Bug 2634: New: Overzealous reduction of constant formulas

bugzilla-daemon at webwork.maa.org bugzilla-daemon at webwork.maa.org
Thu Jun 13 15:40:52 EDT 2013


http://bugs.webwork.maa.org/show_bug.cgi?id=2634

           Summary: Overzealous reduction of constant formulas
           Product: Problem libraries
           Version: unspecified
          Platform: PC
               URL: /opt/webwork/courses/PREP13_Problem_Authoring/template
                    s/Library/FortLewis/Authoring/Templates/Trig/DisableFu
                    nctions1.pg_with_problemSeed=4050
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Library
        AssignedTo: jj at asu.edu
        ReportedBy: paultpearson at gmail.com
                CC: dpvc at union.edu
        Web browser ---
           version:


Hi Davide,

For some reason, the code below for $f1 and $f2 is reducing constant functions
such as cos(pi) and sin(pi/3) to numerical values -1 and 0.866 even though the
context flags reduceConstants and reduceConstantFunctions have both been set to
0.  Something has changed between ww2.5.1.1 (approximately) and ww.2.7 to cause
this to happen.

Thanks!

Paul

#######################################################################  

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"AnswerFormatHelp.pl",
"contextFraction.pl",
);

TEXT(beginproblem());


###########################
#  Setup

Context("Fraction-NoDecimals");
Context()->flags->set(
     reduceConstants => 0,
     reduceConstantFunctions => 0,
   );

$f1 = Compute("cos(pi)");
$f2 = Compute("sin(pi/3)");

Context()->functions->disable("All");
Context()->functions->enable("sqrt");

$answer1 = Compute("-1");
$answer2 = Compute("sqrt(3)/2");


###########################
#  Main text

Context()->texStrings;
BEGIN_TEXT
Enter your answers as simplified fractions.
$BR
$BR
\( $f1 = \)
\{ ans_rule(20) \}
\{ AnswerFormatHelp("fractions") \}
$BR
$BR
\( $f2 = \)
\{ ans_rule(20) \}
\{ AnswerFormatHelp("fractions") \}
END_TEXT
Context()->normalStrings;


###########################
#  Answer evaluation

$showPartialCorrectAnswers = 1;

ANS( $answer1->cmp() );

ANS( $answer2->cmp() );


###########################
#  Solution

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
The cosine of an angle is zero when 
the angle is an integer multiple of \( \pi \).
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

-- 
Configure bugmail: http://bugs.webwork.maa.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the webwork-bugs mailing list