I wrote a problem which has the following glitch: In "images" mode, a particular line reads as follows when viewed on the web.
(e.g. if the answer is


The line reads as it should "...enter 9.123" in other display modes. The relevant part of the problem code is simply:
(e.g. if the answer is \(9.123 $PERCENT\) enter \(9.123\) )
The problem goes away if I remove the \( \)-delimiters. Even stranger, the number $4,260 is from the very first seed I used to view the problem, but has persisted even when I changed the problem seed. (The complete code for the problem is below.)
One more point: I've seen the $4,260 on two different computers. Another person looked at it and got similar behavior, but showing a different dollar amount -but when I view the problem as him, it shows 4,260.
Our installation is exhibiting another behavior which may be related: When I add a new blank problem to a set and edit it, the code in the "blank problem" is not the blank problem template code, but the code of the last problem I edited, with the code as it was when I last viewed the rendered problem, even if I did not save it in that state. So, for example, I took off the tex delimiters in the problem above to see if that fixed the problem, but I did not save that change. Even so, when I go to view the source of that problem now, it shows me the version without the delimiters, rather than the saved version with the delimiters (which it is using to actually generate the problem.)
Any ideas about what might be causing this?
Thanks,
Jason
Offending problem code:
##DESCRIPTION
## Simple Interest
##ENDDESCRIPTION
##KEYWORDS('financial mathematics', 'interest', 'simple')
## DBsubject('Financial Mathematics')
## DBchapter('Introduction to Interest')
## DBsection('Simple Interest')
## Date('')
## Author('Jason Aubrey')
## Institution('University of Missouri - Columbia')
## TitleText1('Finite Mathematics')
## EditionText1('11')
## AuthorText1('Barnett, Ziegler, Byleen')
## Section1('3.1')
## Problem1('51')
########################################################################
DOCUMENT();
loadMacros(
"PGstandard.pl", # Standard macros for PG language
"MathObjects.pl",
"contextCurrency.pl", #see webwork.maa.org/doc/cvs/pg_CURRENT/macros/contextCurrency.pl
"answerHints.pl", # To give hints --rac
#"source.pl", # allows code to be displayed on certain sites.
#"PGcourse.pl", # Customization file for the course
);
# Print problem number and point value (weight) for the problem
TEXT(beginproblem());
# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;
##############################################################
#
# Setup
#
#
Context("Numeric");
$index = random(0,4,1);
@days = (90, 120, 180, 240);
$days = @days[$index];
$days_2 = (1/3)*$days;
$t = $days - $days_2;
$rate = random(5,15, 1);
$orig_p = random(4000,6000,250);
$amt = $orig_p*(1 + ($rate/100)*($days/360));
$new_p = $orig_p + random(.1,.9,.1)*$orig_p*($rate/100)*($days_2/360); #inc by a fraction of interest earned over days_2
$new_rate = ($amt / $new_p - 1) * 360 / $t;
$answer = Real(spf($new_rate*100,"%.3f"));
Context()->flags->set(tolerance=>.0005,tolType=>"absolute");
ANS($answer->cmp->withPostFilter(AnswerHints(
sub {
my ($correct,$student,$ans) = @_;
return (abs($correct-$student)>=.001 && abs($correct-$student)<=.1);
} => ["Close, but your answer must be correct to three decimal places to be counted as correct.", score => 0, replaceMessage => 1]
)));
Context("Currency");
Context()->flags->set(trimTrailingZeros=>1);
$orig_p = Currency($orig_p);
$new_p = Currency($new_p);
$amt = Currency($amt);
##############################################################
#
# Text
#
#
Context()->texStrings;
BEGIN_TEXT
For services rendered, an attorney accepts a \($days\) day note for \($orig_p \) at \( $rate $PERCENT\) simple interest from a client. (Both interest and principal will be repaid at the end of \($days\) days.) Wishing to be able to use her money sooner, the attorney sells the note to a third party for \($new_p\) after \($days_2\) days. What annual interest rate will the third party receive for the investment? (Enter your answer as a percentage correct to three decimal places.)
$PAR
Annual simple interest rate for third party: \{ ans_rule(6) \}\($PERCENT\)
$BR
Note: Be sure that your answer is correct to three decimal places, and that it is expressed as a percentage (e.g. if the answer is \(9.123 $PERCENT\) enter \(9.123\) ) into the answer box.
END_TEXT
##############################################################
#
# Answers
#
#
SOLUTION(EV3(<<'END_SOLUTION'));
$PAR SOLUTION $PAR
Step 1: Compute the amount that will be paid at the end of \($days \) days to the holder of the note:
\[ A = P(1 + rt)\]
\[= $orig_p \left [ 1 + \left ( \frac{$rate}{100}\right ) \left ( \frac{$days}{360}\right ) \right ] \]
\[= $amt \]
Step 2: For the third party, we find the annual rate of interest \(r\) required to make \( $new_p \) grow to \( $amt \) in \( $t \) days; that is, we are to find \( r \) (which is to be converted to \(100r $PERCENT\) ), given \( A = $amt \), \( P = $new_p \) and \( t = \frac{$t}{360} \),
\[ A = P(1 + rt) \]
\[ $amt = $new_p \left[ 1 + r\left ( \frac{$t}{360} \right ) \right ] \]
Solving, we obtain \( r = $answer $PERCENT\).
END_SOLUTION
Context()->normalStrings;
ENDDOCUMENT();