Forum archive 2000-2006

David K. Watson - Standard option for fun_cmp isn't working for multivariate functions

David K. Watson - Standard option for fun_cmp isn't working for multivariate functions

by Arnold Pizer -
Number of replies: 0
inactiveTopicStandard option for fun_cmp isn't working for multivariate functions topic started 9/21/2005; 5:08:50 PM
last post 9/21/2005; 6:54:54 PM
userDavid K. Watson - Standard option for fun_cmp isn't working for multivariate functions  blueArrow
9/21/2005; 5:08:50 PM (reads: 333, responses: 1)
For some reason, fun_cmp is not working properly for multivariable answers.

For example, a professor here recently assigned the Rochester Library Problem

rochester_problib/setVmultivariable3ParDer/UR_VC_5_14.pg

in a homework assignment. Its answers are all the first and second partial derivatives of a multivariable function. When a student tries to enter in a function as an answer, they get the following error in the Messages box

 

Error: "x" does not make sense here There is an error in WeBWorK's answer to this problem, please alert your instructor. Error: "x" does not make sense here Error detected evaluating correct adapted answer at (0.110000078 ) There is an error in WeBWorK's answer to this problem, please alert your instructor. Error: "x" does not make sense here Error detected evaluating instructor answer at (0.110000078 )

 

For some reason, fun_cmp apparently is not recognizing that the option vars=>2 uses 'x' and 'y' as the default variables. For example, for this problem the code relating to the first answer is

ANS(fun_cmp($dfdx, vars=>2));

and if I replace

vars => 2

with

vars => ['x', 'y'],

then the problem works without errors. The same is true for all the problems in this teacher's problem set that have multivariable answers. These problems worked fine last year, and the ones I've checked work fine on your problem library page.

<| Post or View Comments |>


userDavide P. Cervone - Re: Standard option for fun_cmp isn't working for multivariate functions  blueArrow
9/21/2005; 6:54:54 PM (reads: 438, responses: 0)
This was a bug in pg/macros/PGanswermacros.pl until version 1.35 of that file, so it sounds like you are using a version older than that. It is probably not a good idea to update just this one file to the current version without updating all of WeBWorK, as there have been some fairly major adjustements to this file recently that are tied to changes in other files. You might be able to get away with just updating the pg directory, but I don't remember if there's any changes that are related to changes in the webwork2 directory.

The fix is a one-liner, however, and you may want to apply it to PGanswermacros.pl yourself. At around line 1378 (it may be different depending on the version you have), change

    unless ( ref($out_options{var}) eq 'ARRAY' ) {
to
    unless ( ref($out_options{var}) eq 'ARRAY' || $out_options{var} =~ m/^d+$/) {
That should takre care of it.

Davide

<| Post or View Comments |>