Forum archive 2000-2006

Robin Cruz - Problem with number_list_cmp in v1.9

Robin Cruz - Problem with number_list_cmp in v1.9

by Arnold Pizer -
Number of replies: 0
inactiveTopicProblem with number_list_cmp in v1.9 topic started 10/8/2004; 5:19:21 PM
last post 10/12/2004; 11:21:45 AM
userRobin Cruz - Problem with number_list_cmp in v1.9  blueArrow
10/8/2004; 5:19:21 PM (reads: 1044, responses: 3)
I have a problem that worked in an earlier version of WebWork, but not longer works in 1.9. It shows a pink screen and will only accept the list of values if they are entered in the order given in the answer.

--rac

The error given is: ------------------------------------------------------------


Compiler warnings: * Use of uninitialized value in numeric comparison (<=>) at (eval 161) line 660. ##More details: -------- Number_List::__ANON__ called at /opt/webwork/system/lib//PGtranslator.pm line 1527 ---- PGtranslator::PGsort called at (eval 161) line 660 ---- Number_List::cmp_numlists called at (eval 161) line 612 ---- Number_List::__ANON__ called at (eval 188) line 1 ---- main::__ANON__ called at /usr/lib/perl5/5.8.1/i386-linux-thread-multi/Safe.pm line 223 ---- Safe::reval called at /opt/webwork/system/lib//PGtranslator.pm line 934 ---- PGtranslator::process_answers called at /opt/webwork/system/cgi/cgi-scripts/processProblem8.pl line 542

-------------------------------------------------------------


The problem template is:

DOCUMENT(); # This should be the first executable line in the problem.

loadMacros( PG.pl, PGbasicmacros.pl, PGchoicemacros.pl, PGanswermacros.pl, PGgraphmacros.pl, PGnumericalmacros.pl, PGstatisticsmacros.pl, extraAnswerEvaluators.pl #"JJ_ans-eval.pl" );

TEXT(beginproblem()); $showPartialCorrectAnswers = 1;

$x1 = random(2, 5, 1); @x = ($x1, $x1 + random(1, 2, 1), $x1 + random(3, 5, 1), $x1 + random(6, 8, 1)); @xBar = (($x[0]+$x[1])/2, ($x[0]+$x[2])/2, ($x[0]+$x[3])/2, ($x[1]+$x[2])/2, ($x[1]+$x[3])/2, ($x[2]+$x[3])/2);

$mu = ($x[0] + $x[1] + $x[2] + $x[3]) / 4;

BEGIN_TEXT Consider the population of four juvenile condors. Their weights in pounds are : $x[0], $x[1], $x[2], $x[3] END_TEXT

BEGIN_TEXT $PAR (a) Let ( x ) be the weight of a juvenile condor. Write the possible unique values for (x): (NOTE: Separate each value in the list with a comma.) {ans_rule(30)}. $BR

END_TEXT

ANS(number_list_cmp("$x[0], $x[1], $x[2], $x[3]"));

BEGIN_TEXT $PAR (b) Find the mean of the population: {ans_rule(10)} $BR END_TEXT

ANS(num_cmp($mu,tol=>0.01));

BEGIN_TEXT $PAR (c) Let ( bar x ) be the average weight from a sample of two juvenile condors. List all possible unique values for ( bar x ). This is the sampling distribution for samples of size 2: (NOTE: Separate each value in the list with a comma.) {ans_rule(30)}. $BR END_TEXT

ANS(number_list_cmp("$xBar[0], $xBar[1], $xBar[2], $xBar[3], $xBar[4], $xBar[5]"));

BEGIN_TEXT $PAR (d) Find the mean of the sampling distribution: {ans_rule(10)} $BR END_TEXT

ANS(num_cmp($mu,tol=>0.01));

ENDDOCUMENT(); # This should be the last executable line in the problem.

<| Post or View Comments |>


userJohn Jones - Re: Problem with number_list_cmp in v1.9  blueArrow
10/8/2004; 5:27:49 PM (reads: 1296, responses: 0)
It sounds like this could be related to the sort/perl problem discussed at earlier times. There may have been updates to webwork 1.* to fix this.

John

<| Post or View Comments |>


userArnold K. Pizer - Re: Problem with number_list_cmp in v1.9  blueArrow
10/12/2004; 11:19:45 AM (reads: 1267, responses: 0)
Hi,

John Jones is correct. The discussion he refers to is at http://webhost.math.rochester.edu/webworkdocs/discuss/msgReader$1917

In short the problem arrises when Perl 5.8 is compiled with ithreads as it normally is. As a work-around we rewrote WeBWorK's PGsort (in Translator.pm) and changed slightly how it is called (which required changes to num_sort, etc. in PGbasicmacros.pl). These changes are contained in the most recent releases of both WeBWorK 1.9 (1.9.05) and WeBWorK 2 (2.0.1).

Last year people fixed the problem by compliling perl without ithreads enabled.

Arnie

PS. I have posted another email about this problem below

<| Post or View Comments |>


userArnold K. Pizer - Re: Problem with number_list_cmp in v1.9  blueArrow
10/12/2004; 11:21:45 AM (reads: 1277, responses: 0)
WeBWork seems to be unable to sort numeric lists for us. It generates the following error message when asked to do so:

*

Current time: 10/11/04 at 12:55 PM (reload page to update time)

Compiler warnings: * Use of uninitialized value in numeric comparison (<=>) at (eval 133) line 1644. ##More details: -------- main::__ANON__ called at /usr/local/webwork/system/lib//PGtranslator.pm line 1527 ---- PGtranslator::PGsort called at (eval 133) line 1644 ---- main::num_sort called at (eval 53) line 28 ---- main::__ANON__ called at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/Safe.pm line 223 ---- Safe::reval called at /usr/local/webwork/system/lib//PGtranslator.pm line 733 ---- PGtranslator::translate called at /usr/local/webwork/system/cgi/cgi-scripts/processProblem8.pl line 445

*

Then, of course, it refuses to accept lists of solutions given, as instructed, in increasing order.

[........... skipping problem code .............]

As you can see, the error seems to arise from the call to num_sort. This happens consistently in problems that call that macro (from PGbasicmacros.pl). I've looked at this file, but I don't know enough perl to guess what's going on.

I can "fix" these problems by replacing this call to num-sort with a quick and dirty sort based on a few if/else constructions--but even for lists of just three numbers, that's a royal pain.

--Lou Talman Department of Mathematical & Computer Sciences Metropolitan State College of Denver

<http://clem.mscd.edu/~talmanl>

<| Post or View Comments |>