Forum archive 2000-2006

Sherman Wong - Same Exact Problems for All Students

Sherman Wong - Same Exact Problems for All Students

by Arnold Pizer -
Number of replies: 0
inactiveTopicSame Exact Problems for All Students topic started 9/13/2004; 9:16:57 AM
last post 9/13/2004; 4:24:44 PM
userSherman Wong - Same Exact Problems for All Students  blueArrow
9/13/2004; 9:16:57 AM (reads: 1949, responses: 9)
My department is trying out WeBWorK for the first time this semester and in particular, WeBWorK 2.0.1. I've conducted a brief overview of the program to some of my colleagues to get them interested.

During my introduction, I was asked if all the students could have exactly the same problems generated for a given assignment. The reason for the request was that, if the problems were to be discussed in class, then the attention of the class would be more focused on a problem common to them all, rather than one particular to one student. I've read in the discussion group that one can add a line to the PG script of a problem which will set the identical seed for that problem. However, I know that some of my other colleagues would not like to have the exact same problems for his/her students.

I assume that this topic has appeared before and would like a reference to the resolution of this dilemma.

Thank you. Sherman Wong

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 11:27:11 AM (reads: 2198, responses: 0)
You can disable randomizing in a WeBWorK problem by adding a line of the form
SRAND(#);
where # stands for a fixed integer (e.g. 0, 1, or 32415) before any random() statements in the problem. (SRAND sets the seed for the random number generator.)

However this defeats one of the major pedagogical advantages of WeBWorK - allowing students to collaborate with each other without just copying the answers (which some students end up doing without even realizing it).

One should be aware of a (teaching strategy)/(class management) issue when students ask questions about WeBWorK problems in class. The teacher should not work out the student's individual version of the problem, but rather the teacher's own version (or a practice user's version). If the teacher works out a student's individual version in class, then other students will start demanding that the teacher also do those students' versions and the class becomes unamanageable.

<| Post or View Comments |>


userMichael Gage - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 11:30:57 AM (reads: 2188, responses: 1)
Here is the kind of code you need:
TEXT(beginproblem());    # standard headline --
if ($sectionName eq "professorA") {
$newProblemSeed = 12345;
$PG_random_generator->srand($newProblemSeed);
} elsif ($sectionName eq "professorB" {
$newProblemSeed = 54321;
$PG_random_generator->srand($newProblemSeed);
} else {
# do nothing. The value of $problemSeed originally used
# to set $PG_random_generator will have been chosen
# differently for each student
}

This code segment should go near the top of the problem.

The section names will need to be filled in on the class list, not left blank and the spellings will need to be correct. :-)

Let me add that since this is perl "there is more than one right way to do this". I suggest this as a simple way to start out. One can make this fancier, neater and more general, but there is no rush.

-- Mike

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 11:42:07 AM (reads: 2182, responses: 0)
Hi Mike,

Does the earlier SRAND(#) still work in WW2?

Zig

<| Post or View Comments |>


userMichael Gage - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 11:50:57 AM (reads: 2198, responses: 0)
I suspect that it doesn't work on WW1.9 or WW2.0 (it will do the same thing on both). However I have not done an explicit test.

Several years ago we made the .pg random number generator depend on the code in PG_random.pm rather than on the internal rand() function provided by perl. This insures cross platform uniformity. Our pseudo-random generator defined in PG_random is pretty simple, taken from a number theory book, and probably doesn't meet rigorous statistical testing. However our need is for a string of number which is not easily predicted (pseudo-random) and that's what you get.

Changing SRAND() will change the underlying rand() function defined by perl, but will, to the best of my knowledge, not change the values of random().

-- Mike

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 12:20:42 PM (reads: 2192, responses: 0)
Hi Mike,

SRAND still works in WW1.9. A while ago, I wrote a bunch of projects which consisted of several problems, which had to have the same random numbers in each problem. I solved this by using SRAND($psvn) [Problem linking was not available then.] These projects still work in WW1.9.

BTW we will still be using WW1.9 this year, instead of upgrading to WW2.0. We have done quite a bit of WW1.x customization over the years, and it seems to be quite a bit of work to adapt these customizations to WW2.0 Besides the Moodle interface, we have also developed our own interfaces to the University Registrar's web pages for downloading rosters, authentication against the university popmail service for WW login, etc.

We are also finally expanding the use of WW (with Moodle) to cover all Calculus 1 and 2 courses, so we expect to have well over 2000 students using the system. This is also quite a bit of work, not leaving much spare time for other things.

Finally WW2.0 seems to have some quirks. To be sure WW1.x also does, but I am used to those.

Zig

<| Post or View Comments |>


userMichael Gage - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 1:10:55 PM (reads: 2196, responses: 0)
Hi Zig.

You are right -- it turns out we made SRAND backwards compatible when we made the change. (in PGbasicmacros.pl we find)

 

sub SRAND { # resets the main random generator -- use cautiously
my $seed = shift;
$main::PG_random_generator -> srand($seed);
}

so my remarks about using SRAND to reset the original perl rand() function are incorrect. Resetting the original perl rand() cannot be done using SRAND.

-- Mike

<| Post or View Comments |>


userSherman Wong - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 2:52:59 PM (reads: 2455, responses: 0)
Thank you Mike for the suggested script change to the PG file.

Can this code segment be used globally rather than locally? I.e., can I placed it in the program environment file so that a modification of each selected problem is not necessary?

Sincerely, Sherman

<| Post or View Comments |>


userMichael Gage - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 3:40:07 PM (reads: 2217, responses: 1)
It could be placed in PG.pl, but frankly I wouldn't advise it -- you are risking too much a chance of eventual and mysterious incompatibility. As you can see from the discussion above if you make many changes in the core code of webwork it becomes more difficult to keep up with the changes (improvements really, honest :-) ) made to the mainstream code.

The ideal is to make changes that will still allow you to be compatible with the mainstream code. In this case I could suggest that you put the code fragment described above in a file such as

myCourse/templates/macros/myPGmacros.pl

and add that to the macro packagages which are loaded before doing the problem. You'll need to look at the existing PG macro packages to see how to make sure the variables are properly initiated. Usually this means using $main::problemSeed rather than $problemSeed. For details you'll need to look at the existing packages, Learning Perl and the perl manual.

You will still need to add this macro package to each problem that you wish to have this dual behavior, but that is perhaps easier than adding the three lines of code.

-- Mike

<| Post or View Comments |>


userSherman Wong - Re: Same Exact Problems for All Students  blueArrow
9/13/2004; 4:24:44 PM (reads: 2519, responses: 0)
Hi Mike:

Thank you for the word of caution. I'll follow your advice. I'm just being lazy about having to modify the PG scripts.

Sherman

<| Post or View Comments |>