Forums

Search results: 163

WeBWorK Problems -> Draggable proofs -> Re: Draggable proofs

by tim Payer -
Yes Peter,

I hope you have some success with debugging the draggable proofs.
I have been wanting to use the feature for some time but can't with its current bug. The draggable proof problems needs an automatic "refresh" with each successive attempt. Without a refresh the chosen word snippets are duplicated in the original column.

I wish I had more expertise to offer....:(

OPL Maintenance -> OPL keyword search not working

by Alex Jordan -
We are using 2.13. The keyword search feature for the OPL in the Library Browser appears to be not working. I just ran OPL-update and restarted apache to be sure.

If I go to advanced search and type in a keyword (concavity), I'm not sure what is supposed to happen. It doesn't auto-refresh like when you use the drop-down taxonomy menus. If I press ENTER it reacts as if I had clicked "Add All". If I directly click "View Problems", it says "There are no matching WeBWorK problems". But there are many, for instance Library/Union/setDervConcavity/4-3-49.pg.

Does anyone else experience this in their Library Browser?
Does it render properly when you act as the student and view the problem? If so, it's probably at least partly related to the browser.

This happens to me every once in a while, and usually refreshing the page fixes it. I suspect that in the cases I've seen it has been a result of the connection being interrupted while MathJax is being loaded. I think I've seen the same thing when the page load times out before MathJax is loaded.

If refreshing doesn't work, try holding down "shift" and refreshing the page. This forces a reload of not only the page itself, but all the dependencies including the javascript.

WeBWorK Main Forum -> Weird rendering problem occasionally

by Wesley Burr -
Hi, all,

My GoogleFu has failed me, and I can't find anyone else this has applied to. We're running ~ 600 quizzes per week in WeBWorK, and in the last two weeks I've had two students who've had questions not render properly. Refreshing / logging back in doesn't seem to work. It's a gateway/quiz setup, 15 minute limit. They've both seem something like the attached image, where all the options of the multiple choice are replaced by "[math]".

In the second case, I know the student's details: he was running the latest version of Google Chrome on Mac OSX 10.12. I don't recall the first time it happened.

Unfortunately, with the randomization of questions, it's hard to be able to tell what the solutions for a given student should be, so I've just overwritten the score for these two students. I'd like to figure out what's going on, though, so I can fix it in general, or at least have a workaround for the TAs to use.

Any thoughts?


Attachment ww_render.jpg

WeBWorK Problems -> Spontaneous answer reduction

by Olivia Henders -
What determines whether or not an answer gets reduced when it's displayed? In one problem (shown below), the answer displays as a "full" equation (no simplification), where in others, the answer gets simplified down to a single number. I know that using the reduce function can at least play a part in this, but I'm not using it anywhere. In fact, using it on the answer in the below example doesn't even change the answer, despite there being a coefficient of 1 in one place.


## DESCRIPTION
##
## ENDDESCRIPTION
## DBsubject()
## DBchapter()
## DBsection()

#############################################
# Initialization
DOCUMENT();
loadMacros(
 "PGstandard.pl",
 "MathObjects.pl",
 # Needed to support graph generation.
 "PGgraphmacros.pl",
 "unionTables.pl",
 # Used to provide contextual help for how to type answers.
 "AnswerFormatHelp.pl",
 # Provides greater control over the layout of the problem.
 "PGML.pl",
 # Used for course-specific initializations.
 "PGcourse.pl",
);
TEXT(beginproblem());
# Refreshes the graph image every time the page is loaded, as opposed to
# retrieving a cached version.
$refreshCachedImages = 1;
#############################
# Setup
Context("Numeric");
# Value initialization.
$a = random(0,3,1);
$f = Compute("sqrt(x)+$a");
# Graph values
$minX = -5;
$minY = -5;
$maxX = 5;
$maxY = 5;
$originX = 0;
$originY = 0;
$gridHoriz = $maxX-$minX;
$gridVert = $maxY-$minY;
$shadedMinX = 1;
$shadedMinY = 0;
$shadedMaxX = 4;
$shadedMaxY = $f->eval(x=>$shadedMaxX);
# Converts $f to LaTeX for display later.
$ftex = $f->TeX;
# Calculates the value for the answer.
$answer = Compute("(2/3) * (4^(3/2) - 1) + 3*$a");
# Initialize graph at the required size.
$gr = init_graph($minX,$minY,$maxX,$maxY,grid=>[$gridHoriz,$gridVert],axes=>[$originX,$originY],size=>[300,300]);
$gr->lb('reset');
# Initializes the x-axis positive and negative number labels.
foreach my $i (1..$maxX-1) {
 $gr -> lb(new Label ( $i,-0.25, $i,'black','center','middle'));
}
foreach my $i (1..-$minX-1) {
 $gr -> lb(new Label (-$i,-0.25,-$i,'black','center','middle'));
}
# Initializes the y-axis positive and negative number labels.
foreach my $i (1..$maxY-1) {
 $gr -> lb(new Label (-0.25,$i,$i,'black','center','middle'));
}
foreach my $i (1..-$minY-1) {
 $gr -> lb(new Label (-0.25,-$i,-$i,'black','center','middle'));
}
# Define new graph colors
# Not all of these are used, but they are defined for easier use later.
$gr->new_color("skyblue", 86,180,233); # RGB
$gr->new_color("darkskyblue", 38,79,233);
$gr->new_color("orange", 230,159,0);
$gr->new_color("darkorange", 182, 58, 0);
#
# Choose colors
#
$light = "skyblue";
$dark = "darkskyblue";
# Graph the function and the filled region
add_functions($gr, "$f for x in <0,5> using color:$dark and weight:4");
$gr->moveTo(1,$a+1);

# Draws lines below function line to form boundary of shaded area.
$gr->lineTo($shadedMinX,$shadedMinY,$dark,4);
$gr->lineTo($shadedMaxX,$shadedMinY,$dark,4);
$gr->lineTo($shadedMaxX,$shadedMaxY,$dark,4);
# Fills in area that needs to be shaded.
$gr->fillRegion([$shadedMinX + 0.1, $shadedMinY + 0.1,$light]
);
#############################
# Main Text
# Defines the problem text.
# Places the following information in column1 (the leftmost) of the layout table.
$column1 = PGML::Format(<<END_PGML);
Use the graph to find the area of the shaded
region under [``f(x) = $ftex``].
Area = [______________][@ AnswerFormatHelp("numbers") @]*
END_PGML
# Places graph image in right-hand column.
$column2 = image( insertGraph($gr),height=>300,width=>300,tex_size=>800 ).
$BR.$BCENTER.
$BR.
"Graph of \( y = f(x) \)".
$ECENTER;
TEXT(ColumnTable($column1, $column2, indent => 0, separation => 30, valign => "TOP"));
#############################
# Answer Evaluation

# Setting this to 1 means that students will receive feedback on whether their
# answers are correct.
$showPartialCorrectAnswers = 1;
ANS($answer->cmp());
#############################
# Solution
BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION
COMMENT('Uses PGML. Looks like pi.');
ENDDOCUMENT();

WeBWorK Problems -> arrays in PGML

by Valerio De Angelis -
In the following problem, I want to display four pictures in tabular form, so I tried to use (in PGML) [: Array( [$f0]*, [$f1]* ; [$f2]* , [$f3]* ) :]
but it did not work. I do not get an error message, but instead of a picture I get the code that defines it. So I just wrote

A [$f0]* [: quad quad :] B [$f1]*

C [$f2]* [: quad quad :] D [$f3]*

and this does the job well for the purpose of this problem, but I wonder how one could use Array in this situation.

A (maybe related?) problem I had in writing this problem was that in PGML, I could not display the images as [$fig[0]] [$fig[1]] [$fig[2]] [$fig[3]]
but had to instead define and use [$f0] [$f1] [$f2] [$f2]. I am guessing that it has something to do with how PGML interprets the square brackets.

Thanks for any information.




DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserPopUp.pl",
"PGML.pl",
"PGcourse.pl"
);
 
TEXT(beginproblem());

$refreshCachedImages=1;
 
$fig[0]=image("H1_1_1.png"); #the png files contain pictures of graphs
$fig[1]=image("H1_1_2.png");
$fig[2]=image("H1_1_3.png");
$fig[3]=image("H1_1_4.png");

$k = random(0,3,1); # $k, $a1,$a2,$a3 are a cyclic permutation of 0,1,2,3
$a1=($k+1)%4;
$a2=($k+2)%4;
$a3=($k+3)%4;


$f0=$fig[$k];
$f1=$fig[$a1];
$f2=$fig[$a2];
$f3=$fig[$a3];

$e=(1-$k)%4; # this selects fig[1] as the correct answer


@letter = ("A", "B", "C", "D");

$popup = PopUp(["?","A","B","C","D"], $letter[$e]);


BEGIN_PGML
Which picture A-D does *not* describe a function?
[$popup->menu() ]*

A [$f0]* [: quad quad :] B [$f1]*

C [$f2]* [: quad quad :] D [$f3]*

END_PGML


install_problem_grader(~~&std_problem_grader);
$showPartialCorrectAnswers = 0;

ANS( $popup->cmp() );

BEGIN_SOLUTION
$letter[$e] does not describe a function, because we can draw a vertical line that
intersects the graph twice.
END_SOLUTION



ENDDOCUMENT();

WeBWorK Problems -> Issues with re-randomization

by Eric Stroyan -
I am having an issue with problems re-randomizing on each access or reload of the browser page. This was not an issue in the past, having used these same problems from about 2005 to around 2011.
Basically, the problem accesses a macro to give students information about a particular element (atomic number, symbol, etc). They are then to answer some simple information about the element. What is happening now is that if a student answers incorrectly they get a new element and not the one thsy answered. If they simply refresh the page without any answer entry, they also get a new element.
Previously the student's numbers would persist as they do in most problems. I am wondering if the issue is with list_random or something else. Using ww and pg 2.12 on ubuntu 16.04.
Any help would be appreciated.

Here is the code I am referencing:
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PG.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl",
"isotopes.pl"
);
TEXT(&beginproblem);
$showPartialCorrectAnswers = 1;

@atomic_numbers = keys %isotopes;

$Z = list_random(@atomic_numbers);


$name = $isotopes{$Z}{name};
$symbol = $isotopes{$Z}{symbol};

for $who ( @{ $isotopes{$Z}{atomic_mass} } ) {
@atomic_mass = $who->{at_mass};
}

$A = list_random(@atomic_mass);

BEGIN_TEXT
How many protons are in a neutral atom of $name?
$BR

Number of protons = \{ans_rule(15)\} $BR

END_TEXT

$protons = $Z;

&ANS(num_cmp($protons,reltol=>1,format=>'%0.4g') );
ENDDOCUMENT();

The macro file has the basic structure:
%isotopes=( 1=>{name=>Hydrogen, symbol=>H, atomic_mass=> [{at_mass=>1}, {at_mass=>2}, ],}, 2=>{name=>Helium, symbol=>He, atomic_mass=> [{at_mass=>4}, {at_mass=>3}, ],}, 3=>{name=>Lithium, symbol=>Li, atomic_mass=> [{at_mass=>6}, {at_mass=>7}, ],}, 5=>{name=>Boron, symbol=>B, atomic_mass=> [{at_mass=>11}, {at_mass=>10}, ],},

WeBWorK Problems -> Issues creating Homework sets

by John Nicoletti -
Hello,

We have been using WebWork (v 2.8) at our campus for about two years now. Things have been going smoothly since the installation. Just recently, we migrated to use HTTPS/SSL. I am not sure if this is causing the issue, but that has been the only main change as of recent.

I do not work directly with WebWork, but rather am in IT and have set it up for our math department. One of the professors stopped down to show me an issue today.

He created a course 'Test'. Inside that course, he attempts to add home work sets. He goes to the library browser, picks a target set then chooses a subject. Normally, once the subject is picked, it refreshes with chapters he can choose on the next drop down. This is no longer happening. Nothing will auto-update. Instead, he has to go to 'Advanced Search' and hit 'Update Menus' every time he changes a drop down.

The other issue he is having is once he finally gets to problems he wants to add, if he clicks 'Add,' he doesn't get the normal confirmation which would typically appear in the white space across form the add button. Instead, all the way at the top of the page, it will say 'Added one problem to set xxxxx' with a green background. However, when you go look at the homework set, there are 0 problems added. 

So not only are the drop down menu's not auto-refreshing, but we also cannot add problems to homework sets.

Any help is appreciated!

Thank you, 
John
Hi Joel,

The image has a caching problem.  First the server is caching the image
so that the image is created only once.  This is usually what you want.
It can be turned off by: 
$refreshCachedImages =1;

But that is not enough because the browser is also caching the image. And I'm not sure how to turn that off easily.  You can see the true image using shift-reload which makes the browser request the image again instead of using the cache -- but that is annoying and hard to explain to students.

The best solution seems to be to add a time stamp to the image name -- so that every image is different.  I checked StackOverflow and this is at least one answer.  The downside is that stale images will pile up on your server so you might want to delete them from the tmp directory on a regular basis. 

Others may have cleverer ways to fool the browser into refreshing the image.

Anyway here is some code which works for me:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"scaffold.pl",
"PGcourse.pl",
"PGgraphmacros.pl",
"PGinfo.pl",
);
#$refreshCachedImages=1;
# the above line is not needed if we are adding random numbers to the image name

TEXT(beginproblem());

Context("Numeric");
Context()->variables->are(t=>'Real');
$answer1 = Compute("sin(t)");

Scaffold::Begin(
  can_open => "when_previous_correct",
  is_open  => "first_incorrect"
);

Section::Begin("Part 1: The first part");
BEGIN_PGML
Enter [` \sin(t) `] [________]{$answer1}
END_PGML
Section::End();

$answer1_student = $inputs_ref->{ANS_NUM_TO_NAME(1)}; # alternate, perhaps more direct method

$gr = init_graph(-4,-1,4,1,
axes=>[0,0],
grid=>[8,2],
size=>[400,400]
);
$gr->imageName($gr->imageName."-".time);
#TEXT( "graph name ", $gr->imageName);
#$V_out = Formula("cos(t )");
#$G0 = FEQ(qq! $V_out for t in <-4,4> using color:blue and weight:2!);
#($f1n) = plot_functions( $gr, $G0 );
add_functions($gr, "$answer1_student for t in <-4,4> using color:blue and weight:2");

Section::Begin("Part 2: The second part");
BEGIN_PGML
The student's first answer was [$answer1_student].  
Here's a graph of the student's answer:

[@ image( insertGraph($gr), width=>200,height=>200,tex_size=>800 ) @]*
END_PGML

Section::End();

Scaffold::End();

ENDDOCUMENT();