WeBWorK Problems

graph images are not displaying

graph images are not displaying

by tim Payer -
Number of replies: 2
Hello,

About 25% of my students are not having the graph images displayed in their homework assignment. Combinations of Mac Pro laptops and Safari browsers are a common denominator, but some PC are also having problems.
Most of the class are getting the intended images though.

I have included a sample problem below.

Is there something I can do for these students beside direct them to campus computer labs?
A preferred browser? a change in the pg code that would make the problems more accessible? 

Thanks for any guidance...
Tim

## DBsubject(Algebra)
## DBchapter(Functions)
## DBsection(Piecewise functions)
## Date(01/01/10)
## Institution(Fort Lewis College)
## Author(Paul Pearson)
## MLT(piecewise_graph_looks_like_this)
## Level(3)
## MO(1)
## TitleText1('Functions Modeling Change')
## TitleText2('Functions Modeling Change')
## TitleText3('Functions Modeling Change')
## AuthorText1('Connally')
## AuthorText2('Connally')
## AuthorText3('Connally')
## EditionText1('3')
## EditionText2('4')
## EditionText3('5')
## Section1('2.3')
## Section2('2.3')
## Section3('2.3')
## Problem1('3')
## Problem2('3')
## Problem3('3')
## KEYWORDS('functions','piecwise')

DOCUMENT();

loadMacros(
"PGstandard.pl",
"PGunion.pl",
"PGgraphmacros.pl",
"PGcourse.pl",
"PGchoicemacros.pl",
"parserPopUp.pl",
);

TEXT(beginproblem());


$refreshCachedImages=1;

##############################################
#  Setup


$a = random(1,2,1);
$vshift = random(0,2,1);
while ($vshift==$a) { $vshift = random(0,2,1); }
$s = random(-1,1,2);

$amv = $a - $vshift;
$vma = $vshift - $a;

if ($s == 1) {
$f1 = Formula("-x+$vma")->reduce;
$f2 = $vshift;
$f3 = Formula("x+$vma")->reduce;
} else {
$f1 = Formula("x-$vma")->reduce;
$f2 = -$vshift;
$f3 = Formula("$amv - x");
}

#
#  make graphs
#
foreach my $i (0..3) {
  $G[$i] = init_graph(-4,-4,4,4,grid=>[8,8],axes=>[0,0],size=>[200,200]);
}


plot_functions($G[0],"$s*(abs(x)-$a+$vshift) for x in <-4,-$a> using color:blue and weight=2"); # correct answer
plot_functions($G[0],"$s*($vshift) for x in <-$a,$a> using color:blue and weight=2"); # correct answer
plot_functions($G[0],"$s(abs(x)-$a+$vshift) for x in <$a,4> using color:blue and weight=2"); # correct answer
$G[0] -> stamps( closed_circle(-$a,$s*$vshift,'blue') );
$G[0] -> stamps( closed_circle( $a,$s*$vshift,'blue') );
$G[0] -> lb(new Label ( 3.5,0,'x','black','left','bottom'));
$G[0] -> lb(new Label ( -0.5,3.5,'y','black','middle','center'));

plot_functions($G[1],"$s*(abs(x)-$a+$vshift) for x in <-4,-$a> using color:blue and weight=2"); # correct answer
plot_functions($G[1],"$s*($vshift) for x in <-$a,$a> using color:blue and weight=2"); # correct answer
plot_functions($G[1],"$s(abs(x)-$a+$vshift) for x in <$a,4> using color:blue and weight=2"); # correct answer
$G[1] -> stamps( open_circle(-$a,$s*$vshift,'blue') );
$G[1] -> stamps( open_circle( $a,$s*$vshift,'blue') );
$G[1] -> lb(new Label ( 3.5,0,'x','black','left','bottom'));
$G[1] -> lb(new Label ( -0.5,3.5,'y','black','middle','center'));

$bogus = random(-1,1,2);

plot_functions($G[2],"$s*(abs(x)-$a+$vshift) for x in <-4,-$a> using color:blue and weight=2"); # correct answer
plot_functions($G[2],"$s*($vshift)+$bogus for x in <-$a,$a> using color:blue and weight=2"); # correct answer
plot_functions($G[2],"$s(abs(x)-$a+$vshift) for x in <$a,4> using color:blue and weight=2"); # correct answer
$G[2] -> stamps( closed_circle(-$a,$s*$vshift,'blue') );
$G[2] -> stamps( closed_circle( $a,$s*$vshift,'blue') );
$G[2] -> stamps( open_circle(-$a,$s*$vshift+$bogus,'blue') );
$G[2] -> stamps( open_circle( $a,$s*$vshift+$bogus,'blue') );
$G[2] -> lb(new Label ( 3.5,0,'x','black','left','bottom'));
$G[2] -> lb(new Label ( -0.5,3.5,'y','black','middle','center'));

plot_functions($G[3],"$s*(abs(x)-$a+$vshift) for x in <-4,-$a> using color:blue and weight=2"); # correct answer
plot_functions($G[3],"$s*($vshift)+$bogus for x in <-$a,$a> using color:blue and weight=2"); # correct answer
plot_functions($G[3],"$s(abs(x)-$a+$vshift) for x in <$a,4> using color:blue and weight=2"); # correct answer
$G[3] -> stamps( open_circle(-$a,$s*$vshift,'blue') );
$G[3] -> stamps( open_circle( $a,$s*$vshift,'blue') );
$G[3] -> stamps( closed_circle(-$a,$s*$vshift+$bogus,'blue') );
$G[3] -> stamps( closed_circle( $a,$s*$vshift+$bogus,'blue') );
$G[3] -> lb(new Label ( 3.5,0,'x','black','left','bottom'));
$G[3] -> lb(new Label ( -0.5,3.5,'y','black','middle','center'));



foreach my $i (0..3) {
  $graph[$i] = image(insertGraph($G[$i]),width=>"200",height=>"200",tex_size=>"210");
}


@perm = shuffle(4);
@fig = @graph[@perm];
@inv = invert(@perm);

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

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



##############################################
#  Main text

BEGIN_TEXT
On a piece of paper, sketch a graph of the piecewise-defined function below.
\[
f(x) =
\left\lbrace
\begin{array}{lcl}
$f1, &&  x \leq -$a, \\
$f2, && -$a < x < $a, \\
$f3, && x \geq $a.
\end{array}
\right.
\]
$PAR
Which graph A-D below most closely matches
the graph you drew?
\{ $popup->menu() \}
$PAR
$BCENTER
\{
BeginTable().
  AlignedRow([$fig[0],$fig[1],$fig[2],$fig[3]]).
  TableSpace(5,0).
  AlignedRow(["A","B","C","D"]).
EndTable();
\}
$BR
(Click on a graph to enlarge it.)
$ECENTER
END_TEXT

##################################################
#  Answers

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

ANS($popup->cmp() );

SOLUTION(EV3(<<'END_SOLUTION'));
$PAR
$BBOLD SOLUTION $EBOLD
$PAR
The correct graph is \{ $popup->correct_ans \}.

END_SOLUTION

ENDDOCUMENT();

In reply to tim Payer

Re: graph images are not displaying

by Arnold Pizer -
Hi Tim,

This almost certainly has nothing to do with the problem code.

Most likely the trouble is with security settings on the browsers (or network) the students are using. Images are served by lighttpd (not apache) on port 8080, e.g.
https://ftcourses.webwork.maa.org:8080/wwtmp/ft-humboldt-42560//gif/apizer-973-setDemoprob2image1.png

where as the url of the problem is https://ftcourses.webwork.maa.org/webwork2/ft-humboldt-42560/Demo/2/

Maybe the browsers are blocking the redirection to a different port or possibly some network at Humboldt is blocking this.

Arnie
In reply to Arnold Pizer

Re: graph images are not displaying

by Arnold Pizer -
Hi,

Students can test whether or not port 8080 is the problem by trying to connect to http://portquiz.net:8080/