Forums

Search results: 163

This was a bug in previous versions of webwork.  The only fix is to update to WeBWorK 2.17 in which this bug is fixed.

Although you should also note that even with the bug fixed, refreshing the page immediately after logging in probably will not do what you expect.  When you refresh a page the browser resubmits the last request.  If you just logged in via LTI authentication, then the last request would be the request from the LMS containing the authentication parameters.  Since those will no longer be valid for another request what will happen is you will get the message that your authentication failed.

Hello,

I ran into a weird problem that occurs after logging into a course on webwork. After logging in, if I refresh the page I get the Error:

"Failed to validate Service Ticket ST-243968-tCQCVnarEWAnKGOh93504Frm2K8-cas4 : Ticket 'ST-243968-tCQCVnarEWAnKGOh93504Frm2K8-cas4' not recognized


The course PETRY-888-TEST uses an external authentication system (). You've authenticated through that system, but aren't allowed to log in to this course."

If I do not refresh the page I can navigate around the course page as expected. It is only if I do a refresh as my first action after logging into the course. If i navigate somewhere then refresh it will refresh normally with no errors. 

I am using CAS for the instructors that are logging into their course pages.



A similar problem arises for the students that access web work via external tool on Moodle. If the students click on the link it takes them to the webwork site using LTI to create their account and log them in. But if the student refreshes the page immediately after getting to webworks an error page comes up saying: 

"

Error record identifier

94b42b0d-0686-5865-bf90-d928862fea60::232b3aad-172c-11ed-b167-c4965dc31cb6

Warning messages

Error messages

Can't locate object method "put" via package "WeBWorK::DB" at /opt/webwork/webwork2/lib/WeBWorK/Authen/LTIAdvanced.pm line 811.

"

If the student navigates to a question then refreshes, the site does not throw any errors. 


Any help would be appreciated. 




WW/pg 2.16
PGgraphmacros.pl

Here's one I've been working on.

##DESCRIPTION
## Point-slope form of a linear function
## Two points are randomly chosen to form the line. The points and
## the line are plotted.
##
##ENDDESCRIPTION
## DBsubject(Algebra)
## DBchapter(Linear equations and functions)
## DBsection(Equations of lines: point-slope form)
## Level(2)
## KEYWORDS('linear function', 'point-slope form')

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGgraphmacros.pl",
"contextFraction.pl",
"PGML.pl",
"PGcourse.pl"
);

$refreshCachedImages=1;

TEXT(beginproblem());
Context("Fraction");
Context()->noreduce("(-x)-y");
Context()->noreduce('-n');

######################################

$xmin = -5;
$ymin = -5;
$xmax = 5;
$ymax = 5;

# Choose two points so that:
# neither is on the y-axis
# each at least 2 units apart in each direction
# the line through the points does not go through the origin
# the slope is not +1 or -1
do {
$x1 = non_zero_random(-4,4,1);
$b1 = random(-4,4,1);
do {$x2 = non_zero_random(-4,4,1);} until (abs($x2-$x1)>1);
do {$b2 = random(-4,4,1);} until ((abs($b2-$b1)>1) and ($b1*$x2-$b2*$x1 !=0));
$a1 = min($x1,$x2);
$a2 = max($x1,$x2);
$m = Fraction($b2-$b1,$a2-$a1);
} until (abs($m) != 1);

$f = Formula("$m*(x-$a1)+$b1")->reduce;
$f1 = Formula("$m*(x-$a2)+$b2")->reduce;
$f2 = Formula("$b2-$m*$a2 + $m*x")->reduce;

#----Build the graph
$graph = init_graph($xmin,$ymin,$xmax,$ymax,axes=>[0,0],size=>[400,400],grid=>[10,10]);
$graph->lb('reset');
add_functions( $graph,"$f for x in [$xmin,$xmax] using color:red and weight=2");
$graph->stamps( closed_circle($a1,$b1,'blue') );
$graph->stamps( closed_circle($a2,$b2,'blue') );

$i = 0; # Number the axes
do {
$xtick = $i + $xmin + 1;
$labelx[$i] = new Label($xtick,0, "$xtick",'black','center');
if ($xtick!=0) {$graph->lb($labelx[$i]);}
$i =$i+1;
} while ($i<($xmax-$xmin)-1);

$i = 0;
do {
$ytick = $i +$ymin + 1;
$labely[$i] = new Label(-.2,$ytick+.2, "$ytick",'black','center');
if ($ytick!=0) {$graph->lb($labely[$i]);}
$i =$i+1;
} while ($i<($ymax-$ymin)-1);

######################################

BEGIN_PGML

[@ image(insertGraph($graph),width=>400, height=>400, tex_size=>400) @]*

Use the graph given above to find the slope and equation for the line. Give the slope as an integer or fraction, no decimal values.

a) The slope of the line is [`m =`][______]{$m}

b) The equation of the line is [`y =`][__________________]{$f}

END_PGML

BEGIN_PGML_SOLUTION

Use the coordinates of the two blue dots to find the slope [`\ \displaystyle \frac{\Delta y}{\Delta x} = [$m]`]. The slope and one of the blue dots can be used to find the equation of the line using the point-slope form.

The solution, after simplifying, is [`y = [$f2]`]. Note: it is *not* necessary to simplify your equation.

END_PGML_SOLUTION

ENDDOCUMENT();

Hi everyone,

I just updated our WW server from 2.15 to 2.16. My colleague contacted me saying that a problem that worked just fine is now not rendering  by the system. 

Is there anything that changed with the upgrade that would cause the error with the PG code?

I may be wrong but lines 124 and 125 of the code, which are indicated in the error message, don't seem to be needed. So after commenting them, the problem is rendered when seen it individually on a page of the assignment. Though it is still doesn't show in the Hmwk Set Editor view of the instructor.

screenshot

I really would like to know why it is now having issues. Is there anything to be adjusted after the upgrade?

Thank you.

-------

WeBWorK Error

WeBWorK has encountered a software error while attempting to process this problem. It is likely that there is an error in the problem itself. If you are a student, report this error message to your professor to have it corrected. If you are a professor, please consult the error output below for more information.

Error messages

ERRORS from evaluating PG file:
Alias 'R' doesn't exist for string 'All real numbers' at line 124 of (eval 3075)

Error details

        Problem11
1. ERROR caught by Translator while processing problem file:MA119/ES/BeforeTest1Graph1.pg
****************
ERRORS from evaluating PG file: 
Alias 'R' doesn't exist for string 'All real numbers' at line 124 of (eval 3075)
****************
------Input Read 1 ##DESCRIPTION 2 ## Introduction to Functions 3 ## 4 ##ENDDESCRIPTION 5 ## DBsubject(Algebra) 6 ## DBchapter(Functions) 7 ## DBsection(Domain and range) 8 ## Institution(The College of Idaho) 9 ## Author(RA Cruz) 10 ## MLTleader(1) 11 ## MLT(algebra_functions_domain_range_graph_linear) 12 ## Level(2) 13 ## MO(1) 14 ## TitleText1('Essentials of Intermediate Algebra') 15 ## AuthorText1('Blitzer') 16 ## EditionText1('1') 17 ## Section1('2.1') 18 ## Problem1('') 19 ## KEYWORDS('functions') 20 ## Date: 2007/09 updated 2013/08 -rac 21 22 DOCUMENT(); # This should be the first executable line in the problem. 23 24 loadMacros( 25 "PGstandard.pl", 26 "MathObjects.pl", 27 "contextLimitedNumeric.pl", 28 "contextInequalities.pl", 29 "answerHints.pl", 30 "PGgraphmacros.pl", 31 "PGchoicemacros.pl" 32 ); 33 34 TEXT(beginproblem()); 35 36 ###################################### 37 # Setup 38 39 Context("Numeric"); 40 41 #--------Define the function----------- 42 43 @xnum = (random(-5,-3,1),random(3,5,1)); #Stay in the grid 44 @ynum = (random(-5,-3,1),random(3,5,1)); 45 46 $m = ($ynum[1] - $ynum[0])/($xnum[1] - $xnum[0]); 47 $b = $ynum[0] - $m * $xnum[0]; 48 49 $f = Formula("$m * x + $b"); 50 51 @interval = ("[$xnum[0],$xnum[1])","($xnum[0],$xnum[1]]"); 52 $n = random(0,1,1); 53 54 #------------Define the graph----------------------- 55 $refreshCachedImages=1; 56 57 $choose = random(0,2,1); 58 @colors = ("blue", "red", "green"); 59 $rc = $colors[$choose]; #Pick a random color 60 61 $xmin = -6; 62 $ymin = -6; 63 $xmax = 6; 64 $ymax = 6; 65 66 $graph = init_graph($xmin,$ymin,$xmax,$ymax, 67 'axes'=>[0,0],'grid'=>[$xmax-$xmin,$ymax-$ymin]); 68 $graph->lb('reset'); 69 add_functions( $graph,"$f for x in $interval[$n] using color:$rc and weight:3" ); 70 71 $graph->lb( new Label($xmin+1,$ymax-.5, "y = f(x)",'black','center') ); 72 73 $i = 0; # Number the axes 74 do { 75 $xtick = $i + $xmin + 1; 76 if ($xtick!=0) {$graph->lb( new Label($xtick,0, "$xtick",'black','center') );} 77 $i =$i+1; 78 } while ($i<($xmax-$xmin)-1); 79 80 $i = 0; 81 do { 82 $ytick = $i +$ymin + 1; 83 if ($ytick!=0) {$graph->lb( new Label(-.2,$ytick+.1, "$ytick",'black','center') );} 84 $i =$i+1; 85 } while ($i<($ymax-$ymin)-1); 86 87 #------------Pick the points--------------- 88 89 @n = (random($xnum[0]+1,$xnum[1]-1,1), $xnum[$n]); 90 @slice = NchooseK(2,2); 91 @input = @n[@slice]; 92 @answer = ($f->eval(x=>$input[0]), $f->eval(x=>$input[1])); 93 94 ###################################### 95 # Main text 96 # Note: tex_size=>n is for the size on the hardcopy: 600=60% 97 98 BEGIN_TEXT 99 $BCENTER 100 \{ image( insertGraph($graph), 101 width=>400,height=>400,tex_size=>600 ) \} 102 $ECENTER 103 $BR 104 Use the graph of \(y=f(x)\) given above to find: 105 $PAR 106 a) \( f($input[0]) \) = \{ans_rule(10)\} 107 $PAR 108 b) \( f($input[1]) \) = \{ans_rule(10)\} 109 $PAR 110 $BR 111 Write your answers in interval notation 112 $BR 113 c) The domain: \{ans_rule(20)\} 114 $PAR 115 d) The range: \{ans_rule(20)\} 116 END_TEXT 117 118 ###################################### 119 # Answers 120 121 $showPartialCorrectAnswers = 1; 122 123 Context("LimitedNumeric"); 124 Context()->strings->add("No solution"=>{alias=>"DNE"}, 125 "All real numbers"=>{alias=>"R"}); 126 127 #---Part a)-------------------------- 128 $ans_a = Real($answer[0])->with(tolerance=>0.15, tolType=>'absolute'); 129 ANS($ans_a->cmp(ignoreStrings => 1)); 130 131 #---Part b)-------------------------- 132 $ans_b = Real($answer[1])->with(tolerance=>0.15, tolType=>'absolute'); 133 ANS($ans_b->cmp(ignoreStrings => 1)); 134 135 #---Part c)-------------------------- 136 Context("Inequalities"); 137 Context()->variables->add(y=>'Real'); 138 Context()->strings->add("All real numbers"=>{},"R"=>{alias=>"All real numbers"}); 139 140 @domain = ("$xnum[0] <= x < $xnum[1]", "$xnum[0] < x <= $xnum[1]"); 141 $ans_c = Compute($domain[$n]); 142 ANS($ans_c->cmp->withPostFilter(AnswerHints( 143 sub { 144 my ($correct,$student,$ans) = @_; 145 return $student =~ /y/; 146 } => ["Use the variable $BITALIC x $EITALIC for the domain of a function.", 147 checkCorrect => 1, 148 score => 0] 149 ))); 150 151 #---Part d)-------------------------- 152 $ran1 = $f->eval(x=>$xnum[0]); 153 $ran2 = $f->eval(x=>$xnum[1]); 154 if ($ran2<$ran1) { 155 $ran2 = $ran1; 156 $ran1 = $f->eval(x=>$xnum[1]); 157 } 158 @range = ("$ran1 <= y < $ran2", "$ran1 < y <= $ran2"); 159 $ans_d = Compute($range[$n]); 160 ANS($ans_d->cmp->withPostFilter(AnswerHints( 161 sub { 162 my ($correct,$student,$ans) = @_; 163 return $student =~ /x/; 164 } => ["Use the variable $BITALIC y $EITALIC for the range of a function.", 165 checkCorrect => 1, 166 score => 0] 167 ))); 168 169 ###################################### 170 # Solutions 171 172 Context()->texStrings; 173 SOLUTION(EV3(<<'END_SOLUTION')); 174 $PAR SOLUTION $PAR 175 $BR 176 a) \( f($input[0]) = $ans_a\) 177 $BR 178 b) \( f($input[1]) = $ans_b \) 179 $BR 180 c) The domain: \($ans_c\) 181 $BR 182 d) The range: \($ans_d\) 183 END_SOLUTION 184 Context()->normalStrings; 185 186 187 ; 188 ENDDOCUMENT();

WeBWorK Problems -> Geogebra Images not rendering

by Tim Alderson -

Hello,

Running WW 2.15, Geogebra generated images are not rendering. Verified with OPL problems as well as the one included below. 
Not getting any errors reported (to the screen).

Any hints as to where to look for a fix?

Problem code and image follow:


## DESCRIPTION
## This is Problem 1.1.9 from the APEX Calculus text. It covers graphical approximation of limits.
## ENDDESCRIPTION

## DBsubject(Calculus - single variable)
## DBchapter(Limits and continuity)
## DBsection(Finding limits using graphs)
## Level(2)
## Institution('Valdosta State University')
## Author('S. V. Ault')
## RevisedBy('F. J. Francis')
## TitleText1('APEX Calculus')
## AuthorText1('Hartman')
## EditionText1('3.0')
## Section1('1.1')
## Problem1('9')
## MO(1)
## Keywords('limit', 'limits', 'ULETH-MATH1560', 'ULETH-MATH1565')

###########################
#  Initialization
DOCUMENT();

# Load whatever macros you need for the problem
loadMacros(
  "PGstandard.pl",
  "MathObjects.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 to support the GeoGebra applet.
  "AppletObjects.pl",
  # Used for course-specific initializations.
  "PGcourse.pl",
  # Used to format the table in the solution
  "niceTables.pl",
  "unionTables.pl"
);
# Sets up basic problem information.
TEXT(beginproblem());

#############################
#   Setup
#-ULETH-#
Context("Numeric")->variables->are(x=>"Real");

#Randomize the question parameters.
$a=random(4,10,1);
$amin1=$a-1;
$amin2=$a-2;
$a2=2*$a;

$f = Formula("(x^2 - $amin2*x - $a2)/(x^2- $amin1*x -$a)");

#Values used in the table of approximations
$a002=$a+0.002;
$a001=$a+.001;
$a0005=$a+.0005;
$a0001=$a+.0001;
$ax002=$a-0.002;
$ax001=$a-.001;
$ax0005=$a-.0005;
$ax0001=$a-.0001;

$aa002=$f->eval(x=>$a002);
$aa001=$f->eval(x=>$a001);
$aa0005=$f->eval(x=>$a0005);
$aa0001=$f->eval(x=>$a0001);
$aax002=$f->eval(x=>$ax002);
$aax001=$f->eval(x=>$ax001);
$aax0005=$f->eval(x=>$ax0005);
$aax0001=$f->eval(x=>$ax0001);

#Evaluate the limit
$liminom=($a+2);
$limidenom=($a+1);
$limi=$liminom/$limidenom;

#Initialize the table of numerical approximations
$approximationTable = $BCENTER.begintable(4) .
row( "x","f(x)","x","f(x)") .
row( $a002, $aa002, $ax002, $aax002).
row( $a001, $aa001, $ax001, $aax001).
row( $a0005, $aa0005, $ax0005, $aax0005).
row( $a0001, $aa0001, $ax0001, $aax0001) .
endtable().$ECENTER;
#-ENDULETH-#



######################################
# Create  link to applet:
###################################
# You can name your applet (anything reasonable :-) )
# Adjust the height and width as desired
# Paste the geogebra parameters in at the bottom of the page just above the
# command end command
# so that they don't get in the way
###################################


$appletName = "ggbfoo";

$applet =  GeogebraWebApplet(
   code       => "geogebra.GeoGebraApplet",
   archive    => "geogebra.jar",
   codebase                 => findAppletCodebase("geogebra.jar"),
   appletName              => $appletName,
   appletId                    => $appletName,
   submitActionAlias     => 'getAppletValues',  # default actionAlias
   initializeActionAlias   => 'configure',  # default actionAlias
   setStateAlias             => 'setXML',
   getStateAlias             => 'getXML',
   setConfigAlias           => '',
   getConfigAlias           => '',
   returnFieldName       => '',
   width                 => 450,              # may want to modify width
   height                => 320,              # may want to modify height
  # mayscript             => "true",
   debugMode             => 0,   # set debugMode to 0 for no debug
                                              # to 1 to make xml representation visible
                                              # to 2 to add alerts detailing progression
                                              # through the applet
   onInit                => 'ggbOnInit',
   type                  => 'geogebraweb',
   #submitActionScript    => qq{ getQE('answerBox').value = getAppletValues() },
   submitActionScript => '',
   selfLoading           => 1,
   params     => GEOGEBRA_PARAMS(),# paste parameters in

);



##################################
# Setup GeogebraWebApplet --
###################################

###############################################
#
#  For persistence of GeoGebra applet state
#  when answers are submitted or page is refreshed.
#  Uses JavaScript interface to GeoGebra.

HEADER_TEXT(
qq!
<script language="javascript">
   function ggbOnInit(param) {
       if (param == "$appletName") {
           applet_loaded(param,1);  // report that applet is ready.
           ww_applet_list[param].safe_applet_initialize(2);
       }
   }
</script>
<noscript>For this question to work properly,
you must enable JavaScript, or use another browser
(or computer) on which JavaScript works.</noscript>
!);


#######################################################
#
#  For setting initial values in GeoGebra from WeBWorK
#  Uses JavaScript interface to GeoGebra.

TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setAppletCoefficients() {
   var applet=getApplet("$appletName");   // alert("Updating coefficients");
   if (typeof(applet)!="undefined") {
     if (typeof(applet.setValue)!="undefined") {
     
     ////////////////////////////////////////////////////////////////
     //  List the values of the parameters to be set in the applet here
     
          // Set variables
          applet.setValue("a", $a);  
        
     } else {
          setTimeout("setAppletCoefficients()", 1000);
     }
   } else {
      setTimeout("setAppletCoefficients()",1000);
   }
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};
</script>
END_SCRIPT

###################################
#insert applet into body  -- this does not need to be changed
# except to adjust the insertion of the reinitialize_button or
# a hidden AnswerBox
###################################
# TEXT($PAR,  MODES(TeX=>'geogebraweb code',
#                      HTML=>$applet->insertAll(
#                                debug =>0,
#                                reinitialize_button => 1,
#                                #includeAnswerBox=>1,
# )));

#############################
#   Problem Text
#-ULETH-#
Context()->texStrings;

$column1 = PGML::Format(<<END_PGML);

Approximate the given limit using the provided graph.

[``\lim_{x \to $a} \, $f = ``] [______] [@ AnswerFormatHelp("numbers") @]*

END_PGML

#-ENDULETH-#

BEGIN_TEXT
\{
ColumnTable(
$column1,
$BCENTER.
$BBOLD."Graph of \( f(x) = $f \).".$EBOLD.$PAR.
MODES(HTML=>$applet->insertAll(debug=>0, reinitialize_button=>1, includeAnswerBox=>0,), TeX=>$im).
$ECENTER
,
indent => 0, separation => 30, valign => "TOP"
);
\}
END_TEXT


Context()->normalStrings;

#############################
#  Solution
#-ULETH-#
BEGIN_PGML_SOLUTION

Approximations toward the limit from the left and the right are given in the following table.

[@ $approximationTable @]***

The limit of [`[$f]`] as [`x`] approaches [$a] is [`[$limi] = \frac{[$liminom]}{[$limidenom]}`].

END_PGML_SOLUTION
#-ENDULETH-#

#############################
#  Answer evaluation

#-ULETH-#
# Setting this to 1 means that students will receive feedback on whether their
# answers are correct.
$showPartialCorrectAnswers = 0;
#-ENDULETH#
ANS( num_cmp( $limi , strings => ["DNE","dne"] ) );

#########################################
# The applet as a base64 string
#########################################

sub GEOGEBRA_PARAMS {
    my $result = {
showResetIcon=>"false" ,
enableRightClick=>"false" ,
enableLabelDrags=>"false",
showMenuBar=>"false" ,
showToolBar=>"false",
showAlgebraInput=>"false",
useBrowserForJS=>"true",
ggbbase64=>"UEsDBBQACAgIAJh6skwAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgICACYerJMAAAAAAAAAAAAAAAAFwAAAGdlb2dlYnJhX2RlZmF1bHRzMmQueG1s7Vpbc+I2FH7u/gqNn9qHgG0wkEzITnZnOs1MNtspmZ2+Cvtg1AjJteRg8usrS74RMAMkIbAND1hHPjqSvu/o6ObLz+mMokeIBeFsaDkt20LAfB4QFg6tRE7OBtbnq0+XIfAQxjFGEx7PsBxaXqZZllNSq9PTpVEqyAXjd3gGIsI+jPwpzPAt97HUqlMpo4t2ez6ftwqjLR6H7TCUrVQ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DdPmFVu5/zf9qbsMGMXCZi93zZduHoYj+8T2qkHVK2na1v0AWASwSxxwGQS9sPCVnaHNxHwIUbr/c52JGtwmAmXHNR/P1iRTwfz+sfdqqlccYZnzErkRmhW/8MccyrsUdoJdXz/SnyDqdqtoUsTH/d+ituXdvkQ1eaRssxZngrSf2rKQUU++hD9GuDCxNLGCGutjbHphx0JLYoLG/oE9WyA5AX0kG0Ab311uIYlXB3+eyWuYQJXVwa/sfsnOISxwJ65vobZUx5+5DHXMUdfumC9r4OXk9OSz2C92FRD4r+nK8EzcMcUwynzrugqd4Yw+0ZEx3rgDrZ8un9cf7s1rX22A0/Jx29xm+O9tg9Z84g8df7sytLWg8vOgS+a3c7UJdThpPKVkm9yKpGGESrR1r0fKZ+jkGHqM1xDBj+C9vk9oHImLkANIH8jqn9dr3vr4UCzsFgtk4l8EXPxchTjtngex/ylOH7dNSEz9aTCBMXN83SuNc+Ynss51zIoJaYCS+pc5XSm1HiRTuCX+HtR/HGEsKQaF2XLc+qzjHfy6uw8i4XTxPBDz6f/A1BLBwjtDh97wwYAAJkSAABQSwECFAAUAAgICACYerJMRczeXRoAAAAYAAAAFgAAAAAAAAAAAAAAAAAAAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc1BLAQIUABQACAgIAJh6skx/wxLUzgQAAFYmAAAXAAAAAAAAAAAAAAAAAF4AAABnZW9nZWJyYV9kZWZhdWx0czJkLnhtbFBLAQIUABQACAgIAJh6skwwyCiE3wIAAI0NAAAXAAAAAAAAAAAAAAAAAHEFAABnZW9nZWJyYV9kZWZhdWx0czNkLnhtbFBLAQIUABQACAgIAJh6skztDh97wwYAAJkSAAAMAAAAAAAAAAAAAAAAAJUIAABnZW9nZWJyYS54bWxQSwUGAAAAAAQABAAIAQAAkg8AAAAA"

};

$result;
}

COMMENT('
    Randomization provides 7 possible versions of this question.<BR>
    Includes a solution set.<BR>
    Uses GeoGebraWeb (JavaScript), so it should work on computers and tablets.  <BR>
    Made from a ULETH template.<BR>
    ');
ENDDOCUMENT();



 

Hi, Paul,

I'm not sure this is what you had in mind, but PCC has problems with labeled dynamic triangles.  Look in the Library: Subject:"Trigonometry", Chapter:"Triangle trigonometry", Section:"Sine, cosine, and tangent of an angle in a right triangle".

We've done a few at the College of Idaho, but the angles have to be not too small. They are not yet in the OPL--perhaps this summer, I'll work on tagging.  Also, greek letters don't seem to be available. PCC uses the letters spelled out.  Here's the code for one of ours.

--rac

========================================

##DESCRIPTION

## Trigonometry: Law of Sines

##ENDDESCRIPTION


##KEYWORDS('trigonometry', 'law of sines')


## DBsubject('Trigonometry')

## DBchapter('')

## DBsection('')

## Date('01/2016')

## Author('RA Cruz')

## Institution('The College of Idaho')

## TitleText1('')

## EditionText1('')

## AuthorText1('')

## Section1('')

## Problem1('')


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


loadMacros(

   "PGstandard.pl",

   "MathObjects.pl",

   "PGchoicemacros.pl",

   "PGgraphmacros.pl",

   "alignedChoice.pl",

   "unionTables.pl",

);


######################################

# Set-up


$a = random(4,9,1); 

$A = random(25,40,5);

$C = random(70,85,5);

$B = 180 - $A - $C;

$c = $a*sin($C*pi/180)/sin($A*pi/180);

$b = $a*sin($B*pi/180)/sin($A*pi/180);


$xc = $b*cos($A*pi/180); #C is at the top of the triangle

$yc = $b*sin($A*pi/180);


$Hmin = -2;

$Hmax = $c + 2;

$Vmin = -2;

$Vmax = $yc + 2;

$picW = 15*($Hmax-$Hmin+2);

$picH = 15*($Vmax-$Vmin+2);


$refreshCachedImages=1;


$graph = init_graph($Hmin,$Vmin,$Hmax,$Vmax,size=>[$picW,$picH]);

$graph->moveTo(0,0);       #A is at the origin

$graph->lineTo($xc,$yc,1);  #Draw to C

$graph->lineTo($c,0,1); #Draw to B to the right

$graph->lineTo(0,0,1);

#$graph->fillRegion([2,1,'yellow']);


$lab_a = new Label($xc+0.7*($c-$xc),0.5*$yc+0.2,"$a",'black','center','bottom');

$lab_a->font(GD::Font->Giant);

$graph->lb($lab_a);


$lab_b = new Label(0.5*$xc,0.5*$yc+0.2,"b",'red','center','bottom');

$lab_b->font(GD::Font->Giant);

$graph->lb($lab_b);


$lab_c = new Label(0.5*$c,-0.3,"c",'red','center','center');

$lab_c->font(GD::Font->Giant);

$graph->lb($lab_c);


$labA=new Label(-0.5,0.5,'A','black','center','center');

$labA->font(GD::Font->Giant);

$graph->lb($labA);


$labAdeg=new Label(0.2*$c,1,"$A",'black','center','center');

$labAdeg->font(GD::Font->Giant);

$graph->lb($labAdeg);


$labB=new Label($c+0.5, 0.5,'B','red','center','center');

$labB->font(GD::Font->Giant);

$graph->lb($labB);


$labC=new Label($xc,$yc+1,'C','black','center','center');

$labC->font(GD::Font->Giant);

$graph->lb($labC);


$labCdeg=new Label($xc-.1,0.85*$yc,"$C",'black','center','center');

$labCdeg->font(GD::Font->Giant);

$graph->lb($labCdeg);


######################################

# Main text


TEXT(beginproblem());


#TEXT("a = $a, b = $b, c =$c, B = $B $BR"); #For checking


BEGIN_TEXT

Solve for the unknown sides and angles of the triangle shown below.

Give the angle(s) in degrees.

$BR $BR

\{

ColumnTable(

"\(b = \) ".ans_rule(6).

"$BR $BR".

"\(c = \) ".ans_rule(6).

"$BR $BR".

"\(\angle B = \) ".ans_rule(6)."\(^\circ\)",

$BCENTER.

image(insertGraph($graph), width=>$picW, height=>$picH, tex_size=>500 ).

$BR.

$ECENTER,

indent => 0, separation => 30, valign => "TOP"

)

\}

$BR

$BITALIC

Note: If no such triangle exists, type ${BBOLD}No triangle$EBOLD for each answer. 

$EITALIC

END_TEXT


######################################

# Answer


Context("Numeric");

Context()->strings->add("No triangle"=>{},None=>{alias=>"No triangle"});


$ans1 = Compute("$b");

ANS($ans1->cmp(showTypeWarnings=>0));


$ans2 = Compute("$c");

ANS($ans2->cmp(showTypeWarnings=>0));


$ans3 = Compute("$B");

ANS($ans3->cmp(showTypeWarnings=>0));

$showPartialCorrectAnswers = 1;

#####################################

# Solution

BEGIN_SOLUTION

$PAR Solution: $BR $BR

We need the angle at \(B:\) 

\(\angle B = 180^{\circ} - $A^{\circ} - $C^{\circ} = $ans3^{\circ}\)

$BR $BR

Use the Law of Sines to find \(a\) and \(c\):

$BR $BR

First we find \(a\):

\(\dfrac{a}{\sin($A^{\circ})} = \dfrac{$b}{\sin($B^{\circ})} \\) 

$BR

\(a = \dfrac{$b\sin($A^{\circ})}{\sin($B^{\circ})} \approx $ans1\) 

$BR $BR

Similarily, find \(c\):

\(\dfrac{c}{\sin($C^{\circ})} = \dfrac{$b}{\sin($B^{\circ})} \\) 

$BR

\(c = \dfrac{$b\sin($C^{\circ})}{\sin($B^{\circ})} \approx $ans2\) 

END_SOLUTION

ENDDOCUMENT();

Fantastic!  This works with the old PGcourse.pl file. It avoids putting a weird call in the code that instructors who don't know Webwork will wonder about. - They can make minor changes, e.g. editing the words in the problem statement, changing the tolerance, etc.

This allows us to use fully dynamic graphs in the problems, so we can use a greater range of parameters and variations, rather than the generate a fixed number of graphs and permute them.

I wondered about a way to change the graphic file id. I'd used the student name as a seed for previous problems using scaffolding. I had no clue how to actually do it and would not have considered doing the study to figure out how it might be done. I doubt I would have discovered the modification of the Fig call.

This does exactly what I want and is easy to implement.  THANKS!