Forums

Search results: 21

Hi,

I have been authoring rather lengthy multi step problems for high school physics. I have had a great deal of success with getting questions with units to work but is I try and include a multiple choice type question in the sequence the result for submission suggests that the answer chosen from the pull down menu needs units. I was hoping some one could help me figure this out. Also sorry about the super long code
I am rather new to authoring problems and I have learned from looking at examples of code so. . . . Here is the code for the problem I am working with

# DESCRIPTION
#
# WeBWorK problem written by Justin Heckman
# Council Bluffs Community Schools
# ENDDESCRIPTION

## DBsubject('')
## DBchapter('')
## DBsection('')
## KEYWORDS('')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')
## Author('Justin Heckman')
## Institution('Council Bluffs Community School District')

DOCUMENT();

loadMacros("PGbasicmacros.pl",
"PGstandard.pl",
"PGcourse.pl",
"MathObjects.pl",
"PGauxiliaryFunctions.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",,
"answerHints.pl",
"scaffold.pl",
"parserNumberWithUnits.pl",
"parserFormulaWithUnits.pl",
"PGML.pl",
"parserPopUp.pl"
);

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

Context("Numeric");

$xh= random(10, 30, 2);
$vb= random(5, 15 , 1);
$vobu= NumberWithUnits("0 m/s");
$g=(9.81);
$ag= NumberWithUnits("9.81 m/s^2");
$xhu= NumberWithUnits("$xh m");
$t= (sqrt(2*$xh/$g));
$tu= NumberWithUnits("$t s");
$xb= ($vb*$t);
$xbu= NumberWithUnits("$xb m");
$xhgg= random(150, 200, 2);
$vC= random(20, 30, 1);
$tbgg= (sqrt(2*$xhgg/$g));
$xC= ($vC*$tbgg);
$ns= ($xC/4);
$nsu= NumberWithUnits("$ns m");
$popup = PopUp(
["?","a","b","c"],
"c",);

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

TEXT(beginproblem());

###################################################
BEGIN_PGML

The subject of the 16 bit game Water Balloon Drop was to drop water
balloons from the top of buildings on unsuspecting bystanders. While the
game was rather lame a lacked dimension it does make for a good physics
problem. By examining the height of the characters in the game in comparison
to the height that the balloons were dropped,it can be determined that the
balloons are being dropped from a height of [$xh] m . Considering that
cyclists are worth more points and that they travel at a rate of [$vb] m/s on average
we can use the following to determine how much ahead of a cyclist a balloon
must be dropped to strike a cyclist.



a.) To find the answer to the posed question we will need to determine the the time it take for
the balloon to fall to the ground. To do so we will need to fill out a [:vvaxt:]. By examining the
scenario we can determine the initial velocity of the water balloon, what is it?

[_____]{$vobu}.




b.) Since the building is on earth we can also determine the rate at which the balloon speeds
up as it fell, a value we refer to as the acceleration due to gravity. What is the
acceleration?

[_____]{-$ag}.


c.) Finally, we know the distance (x) that the balloon will fall, enter it now!

[_____]{$xhu}.


d.) Now that we have 3 pieces of information in our vvaxt we can now determine the
remaining pieces. Since we really want to know how far the
bike will travel in the time it takes for the balloon to fall what
we need to calculate is the time (t) that it takes the balloon to
fall to the ground. Which formula will you use to solve for
time?

A.) [: V_f=v_o+at :]

B.) [:v_f^2=v_o^2+2ax:]

C.) [:x=v_o*t = (1/2*a*t^2):]

[@ $popup->menu() @]*


e.) How long will it take the balloon to fall to the ground?

[_____]{$tu}.


f.) Considering that the cyclist travels at 6 m/s how far in front of the moving cyclist should the
balloon be dropped?

[_____]{$xbu}.


g.) The subject of a totally different but similar
game is to drop water balloons from the top of the
golden gate bridge tower on top of passing cars.
The towers have a height of [$xhgg] meters, according
to Google, and that cars drive an average of [$vC] m/s
across the bridge. In this game we will assume that
the beginning of each white stripe is 4 m from the
beginning of the next (2m stripe and 2m gap). If this
is game how many white stripes away from the edge
of the beam should a car be when the balloon is released in order to strike a car traveling at
average speed?

[_____]{$nsu}.


END_PGML


install_problem_grader(~~&std_problem_grader);

$showPartialCorrectAnswers = 0;

ANS( $popup->cmp() );

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

ENDDOCUMENT();



WeBWorK Problems -> GeoGebra Aplets all have a new warning message?

by tim Payer -
Greetings,

I have just been alerted by my students that all of the assigned webwork problems that use GeoGebra aplets are now posting warning messages.

The assigned problem still functions and will record the students scores, but it would be very helpful if I could find a way to "fix" the warning message.

I am posing the warning message below and then below this is the entire code block. Note that we are WW subscribers and only have access to V 2.13.

Thanks for any help with this!

Tim

findAppletCodebase Error: geogebra.jar not found after searching https://courses1.webwork.maa.org/webwork2_files/applets, https://courses1.webwork.maa.org/webwork2_files/applets/geogebra_stable, https://courses1.webwork.maa.org/webwork2_course_files/humboldt-math1059am/applets, https://courses1.webwork.maa.org/webwork2_files/applets/Xgraph, https://courses1.webwork.maa.org/webwork2_files/applets/PointGraph, https://courses1.webwork.maa.org/webwork2_files/applets/Xgraph, https://courses1.webwork.maa.org/webwork2_files/applets/liveJar, https://courses1.webwork.maa.org/webwork2_files/applets/Image_and_Cursor_All at [PG]/lib/PGalias.pm line 824

Original Code Block:

## This Homework problem uses an embedded GeoGebra applet
## that prompts the student to manipulate the vertical placement
## of 13 coordinate points in order to approximate the sketch of the
## ANTI-derivative for a given graph the derivative in red.
## Three green coordinates are fixed for the ANTI-derivative.
## The GeoGebra applet "scores" the student's attempt and this score
## must be passed back as a score to the WEBWorK answer checker.
## The GeoGebra applet was written by Professor Marc Renault and used here
## with permission. Check out his website for this and other GeoGebra applets
## related to first year Calculus courses:
## http://webspace.ship.edu/msrenault/GeoGebraCalculus/derivative_try_to_graph.html
## The GeoGebra applet is named: Graph_AntiD2.ggb ask at tsp1@humboldt.edu
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGinfo.pl",
"unionTables.pl",
"AppletObjects.pl",
"contextArbitraryString.pl",
"answerHints.pl",
"PGcourse.pl",
);
TEXT(beginproblem());

$showPartialCorrectAnswers = 1;
Context("Numeric");

#################################
# Only a "correct" answer variable is declared as a string
# for comparison for the upper threshold of
# " > 95%" for a variable declaration
#################################
Context("ArbitraryString");
$cor ="> 95%"; # Accuracy above 95% is awarded 100%
Context("Numeric");
$a = random(1,10);
$flag =0;
######################################
# 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 = "numberTest";
$applet = GeogebraWebApplet(
code => "geogebra.GeoGebraApplet",
archive => "geogebra.jar",
codebase => findAppletCodebase("geogebra.jar"),
appletName => $appletName,
appletId => $appletName,
submitActionAlias => 'getAppletValues', # default actionAlias
initializeActionAlias => '', # default actionAlias
setStateAlias => 'setXML',
getStateAlias => 'getXML',
setConfigAlias => '',
getConfigAlias => '',
returnFieldName => '',
width => 740, # may want to modify width
height => 400, # 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" takes the student submission in a geogebra applet
# and passes it to webwork: getQE() is a webwork call for geogebra submission?
# A general case of retrieving all values() vs the specific cases "a" and "b"
# is shown below. The specific cases are commented out.
submitActionScript => qq{ getQE('answerBox').value = getAppletValues() },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("a") },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("b") },
selfLoading => 1,
params => GEOGEBRA_PARAMS(), # paste parameters in
);

#######################################################
# For setting initial values in GeoGebra from WeBWorK
# Uses JavaScript interface to GeoGebra.
# hotfix #354 via Mike Gage addressing the overlapping text
# with WeBWorK submission buttons was attempted and disgarded below.
# Affixed protective <div>s to prevent overlapping text, could not be fixed
#############################################################
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:
One could assign the commented values of "a" and "b" in GeoGebra
to the WeBWorK variables $a & $b here. But this problem passes nothing
from ww to ggb as it relies upon the student's manipulation of the applet
and the resulting score to be passed back to WeBWorK. The commented examples
below are just kept as a reference for future problems...
*/
//applet.setValue("a", $a);
applet.setValue("flag", $flag);
// applet.setValue("b", $b);
// applet.setCoords("C", $a, $b);
} else {
setTimeout("setAppletCoefficients()", 1000);
}
} else {
setTimeout("setAppletCoefficients()",1000);
}
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};
</script>
END_SCRIPT

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

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function ggbOnInit(param) {
var applet = document.$appletName;
if (param == "$appletName") {
applet_loaded(param,1); // report that applet is ready.
ww_applet_list[param].safe_applet_initialize(2);
ww_applet_list[param].object = param;
console.log("ggbOnInit: ww_applet_list["+param+"].object = ", ww_applet_list[param].object );
}
}
</script>
END_SCRIPT
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setConfig() {
var appletState = getQE('${appletName}_state').value;
if (ww_applet_list['$appletName'].object == undefined ) {
setTimeout("setConfig()", 5000);
console.log("waiting");
} else {
var applet=$appletName;
}
}
</script>
END_SCRIPT

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function getAppletValues() {
console.log("getAppletValues() entered");
// get a handle for the applet object
var applet = $appletName;
var D = applet.getValueString("text3"); // from ggb, accuracy to ww
/* The getQE ("Get Question Element") places the GeoGebra value in a
ww answer box as long as the supporting code is there to support the
box entry. But here we want the box to be invisible and for ggb to pass
the accuracy score to ww for comparison.
*/
// getQE('D').value = applet.getValueString("text3"); //Send value to ww
return(D); // Needed for ww to receive value D from ggb
}
</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,
)));

#######################################
# TEXT
#######################################
Context()->texStrings;
BEGIN_TEXT
$BR
$BR
$BR
$BR
$BR
$BR 1.) Click on "Reset" for a fresh problem.
$BR 2.) Click and drag each purple coordinate point up or down to make a sketch
$BR of the Anti-derivative based upon the sketch of the derivative in red.
$BR 3.) Note the three large green coordinate points: These are fixed points
$BR for the anti-derivative.
$BR 4.) Click on "Submit" in the graph window to see your accuracy score.
$BR 5.) Continue to drag the points to align with the anti-derivative
$BR function in black.
$BR See how the accuracy percentage improves.
$BR 6.) Only after hitting "Submit" in the graph window and "Check Answer" in
$BR Webwork will your score be passed on to WeBWorK.
$BR 7.) Click on "Reset" to try another function for a better score.
END_TEXT

#########################################
# ANSWER section
## This answer checker takes ggb string 'D' as $s, "student input"
## and compares it to a ww string ($cor) after a strip ( a search and replace)
## of the non-numeric symbols of "%", ">", and " ". The stripped ww string "$cor"
## is assigned to "$c" for "correct", from ww.
## The PostFilter answer hint permits the stripped strings
## to be evaluated as Numeric intervals for Student feedback and scoring...
#$sc =$s; ## Dummy variable to permit a numeric value
###############################################################
Context("ArbitraryString");
#
# Messages in the form [test_score, message, new_score]
# where the message will be used when the student score is less than
# test_score, and the score will be set to new_score in that case, when
# new_score is given.
#
@messages = (
[.50, "Oh no! You must score more than 50%, for any credit. Try again.", 0],
[.60, "You could do better with another attempt, yes?"],
[.70, "Try again. You can manage better than this."],
[.75, "This is okay, But you could do better, yes?"],
[.80, "You are getting better, Try another?"],
[.85, "Nice Work!"],
[.90, "Very Good!"],
[.95, "Excellent!"],
[.99, "virtually perfect!"],
[1.0, "Perfect!"],
);

#TEXT(ans_rule(10));

NAMED_ANS('answerBox' =>String($cor)->cmp(
checker => sub {
my ($c, $s, $ans) = @_;
$s =~ s/%//;
my $score = $s/100;
for my $data (@messages) {
my ($percent, $msg, $nscore) = @$data;
if ($score <= $percent) {
$ans->{ans_message} = $msg;
$score = $nscore if defined $nscore;
last;
}
}
return $score;
}
));

#######################################
sub GEOGEBRA_PARAMS {
my $result = {
showResetIcon=>"false" ,
enableRightClick=>"false" ,
enableLabelDrags=>"false",
showMenuBar=>"false" ,
showToolBar=>"false",
showAlgebraInput=>"false",
useBrowserForJS=>"true",
ggbbase64=>"UEsDBBQACAgIAMd0EU0AAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcml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0bUEtwfxeHXQA9KcKeBGUPwB6be9PI521RA+hV1GsJeiuB3si92ctYCH3tQE5de/hqAWmFH9y8YQGVhkDa0iFQuU5zKT/+/LrySEmcSUnN54yTuB6R2p/oqXIwVPIbP6iB1v3IT5FqWBwx/d7P9CRxGGOERyLLBTJazqGlzguHYQ8JVUo4vfhsxgazc9W0LTBzzh3QLdvMuQNObnXLzHkDq0EkgH2tiQU4H8oDggfGgU8WDQiS/9+FAw8NBDvmlt4tO3DX0HIH7i4MB7b70vQDfh+xYMR6U+fb/wFQSwcILVROyJoRAACtjwAAUEsBAhQAFAAICAgAx3QRTdY3vbkZAAAAFwAAABYAAAAAAAAAAAAAAAAAAAAAAGdlb2dlYnJhX2phdmFzY3JpcHQuanNQSwECFAAUAAgICADHdBFNMvnbMPUEAAASJgAAFwAAAAAAAAAAAAAAAABdAAAAZ2VvZ2VicmFfZGVmYXVsdHMyZC54bWxQSwECFAAUAAgICADHdBFNwXnzT94CAAAIDQAAFwAAAAAAAAAAAAAAAACXBQAAZ2VvZ2VicmFfZGVmYXVsdHMzZC54bWxQSwECFAAUAAgICADHdBFNLVROyJoRAACtjwAADAAAAAAAAAAAAAAAAAC6CAAAZ2VvZ2VicmEueG1sUEsFBgAAAAAEAAQACAEAAI4aAAAAAA=="
};

$result;
}
ENDDOCUMENT();





Subject: Error in accessing the Library Browser




Hello,

I continue to receive an error (see the attached screenshot) when I click on the Library Browser in WebWork.

I somehow managed to access it once, even after the error was , but now the error is back! I receive the same message in both Safari and Chrome.

Any thoughts or help would be much appreciated!

John @csuchico.edu]

A Partial success with a working model.

By comparing strings passed from an embedded GeoGebra applet to WeBWorK we were able to use a customized answer checker to solve our problem. To review: An embedded GeoGebra applet prompts students to click and drag 13 coordinate points for vertical placement for a connected line plot that approximates the sketch of the derivative overlaid a graph of the parent function. The string that is passed from GeoGebra is an accuracy score with an affixed percentage (for example 73%). The passed string has its percentage stripped within the custom answer checker which permits the remaining integer to be evaluated within a series of intervals that return comments and appropriate scores to the student.

We recognize that there is probably a more elegant way to create such a problem. But we could not get numeric values to pass from GeoGebra with any success and have settled on this stripped string custom answer checker.

Our Questions:

1.) Is there a way to pass numeric values from GeoGebra and assign them to a WeBWorK variable? We have not found any way to manage this.

2.) We would like to have greater control of the resulting score passed from GeoGebra to WeBWorK such that a score of 78% achieved in the applet is awarded 78% of the possible points in WeBWorK. Currently that 78% is rounded up to next multiple of 5 at 80% with our custom answer checker. Short of writing 100 individual answer checkers, is there a way to accomplish this?

3.) Sadly we could not work our way around the overlapping text issue that resulted from the latest version of GeoGebra. We try to use Mike Gage’s hot fix #354 but were not successful. How are the corrective lines below to be used? Is it not in the problem itself?
We are ww subscribers if this matters.

hot fix #354:
<div class = “enclose_geogebra_object”>
<div class = “geogebra_object”>
<script language=”javascript”>

</div>
</div>

Any feedback is most appreciated!

Tim


## This Homework problem uses an embedded GeoGebra applet

## that prompts the student to manipulate the vertical placement

## of 13 coordinate points in order to approximate the sketch of the

## derivative for a given graph of a function.

## The GeoGebra applet "scores" the student's attempt and this score

## must be passed back as a score to the WEBWorK answer checker.

## The GeoGebra applet was written by Professor Marc Renault and used here

## with permission. Check out his website for this and other GeoGebra applets

## related to first year Calculus courses:

## http://webspace.ship.edu/msrenault/GeoGebraCalculus/derivative_try_to_graph.html

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGinfo.pl",

"unionTables.pl",

"AppletObjects.pl",

"contextArbitraryString.pl",

"answerHints.pl",

"PGcourse.pl",

);

TEXT(beginproblem());


$showPartialCorrectAnswers = 1;

Context("Numeric");


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

# Only a "correct" answer variable is declared as a string

# for comparison for the upper threshold of

# " > 95%" for a variable declaration

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

Context("ArbitraryString");

$cor ="> 95%"; # Accuracy above 95% is awarded 100%

Context("Numeric");

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

# 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 = "numberTest";

$applet = GeogebraWebApplet(

code => "geogebra.GeoGebraApplet",

archive => "geogebra.jar",

codebase => findAppletCodebase("geogebra.jar"),

appletName => $appletName,

appletId => $appletName,

submitActionAlias => 'getAppletValues', # default actionAlias

initializeActionAlias => '', # default actionAlias

setStateAlias => 'setXML',

getStateAlias => 'getXML',

setConfigAlias => '',

getConfigAlias => '',

returnFieldName => '',

width => 700, # may want to modify width

height => 300, # 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" takes the student submission in a geogebra applet

# and passes it to webwork: getQE() is a webwork call for geogebra submission?

# A general case of retrieving all values() vs the specific cases "a" and "b"

# is shown below. The specific cases are commented out.

submitActionScript => qq{ getQE('answerBox').value = getAppletValues() },

#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("a") },

#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("b") },

selfLoading => 1,

params => GEOGEBRA_PARAMS(), # paste parameters in

);


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

# For setting initial values in GeoGebra from WeBWorK

# Uses JavaScript interface to GeoGebra.

# hotfix #354 via Mike Gage addressing the overlapping text

# with WeBWorK submission buttons was attempted and disgarded below.

# Affixed protective <div>s to prevent overlapping text, could not be fixed

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

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:

One could assign the commented values of "a" and "b" in GeoGebra

to the WeBWorK variables $a & $b here. But this problem passes nothing

from ww to ggb as it relies upon the student's manipulation of the applet

and the resulting score to be passed back to WeBWorK. The commented examples

below are just kept as a reference for future problems...

*/

// applet.setValue("a", $a);

// applet.setValue("b", $b);

// applet.setCoords("C", $a, $b);

} else {

setTimeout("setAppletCoefficients()", 1000);

}

} else {

setTimeout("setAppletCoefficients()",1000);

}

}

ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};

</script>

END_SCRIPT


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

# Setup GeogebraWebApplet --

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


HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">

function ggbOnInit(param) {

var applet = document.$appletName;

if (param == "$appletName") {

applet_loaded(param,1); // report that applet is ready.

ww_applet_list[param].safe_applet_initialize(2);

ww_applet_list[param].object = param;

console.log("ggbOnInit: ww_applet_list["+param+"].object = ", ww_applet_list[param].object );

}

}

</script>

END_SCRIPT

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">

function setConfig() {

var appletState = getQE('${appletName}_state').value;

if (ww_applet_list['$appletName'].object == undefined ) {

setTimeout("setConfig()", 5000);

console.log("waiting");

} else {

var applet=$appletName;

}

}

</script>

END_SCRIPT


HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">

function getAppletValues() {

console.log("getAppletValues() entered");

// get a handle for the applet object

var applet = $appletName;

var D = applet.getValueString("text1"); // from ggb, accuracy to ww

/* The getQE ("Get Question Element") places the GeoGebra value in a

ww answer box as long as the supporting code is there to support the

box entry. But here we want the box to be invisible and for ggb to pass

the accuracy score to ww for comparison.

*/

// getQE('D').value = applet.getValueString("text1"); //Send value to ww

return(D); // Needed for ww to receive value D from ggb

}

</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,

)));


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

# TEXT

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

#$ans7 =~ s/%/ppp/;

#$dum =~ s/ %//;

#$dum =~ s/> //;

#$ans6=~'answerBox';

Context()->texStrings;

BEGIN_TEXT

$BR

$BR

$BR

$BR

$BR

$BR Click and drag each purple coordinate point to make a sketch of the

$BR derivative based upon the slope of the parent function in black.

$BR Use the slider to determine the slope of the tangent line

$BR as an aid to approximate the sketch of the derivative.

$BR

END_TEXT


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

# ANSWER section

## This answer checker takes ggb string 'D' as $s, "student input"

## and compares it to a ww string ($cor) after a strip ( a search and replace)

## of the non-numeric symbols of "%", ">", and " ". The stripped ww string "$cor"

## is assigned to "$c" for "correct", from ww.

## The PostFilter answer hint permits the stripped strings

## to be evaluated as Numeric intervals for Student feedback and scoring...

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

Context("ArbitraryString");

NAMED_ANS( 'answerBox' => String($cor)->cmp->withPostFilter(AnswerHints(

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //; ## Stripping "> " of "> 95%", leaving "95%"

$c =~ s/%//; ## Stripping "%" of "95%", leaving "95"

$s =~ s/%//; ## Stripping "%" of the student accuracy, leaving an integer

return (($s >= 0) && ($s <= 50)); } => ["Oh no! You must score more than 50%, for any credit. Try again.", score => 0],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 50) && ($s <= 60)); } => ["You could do better with another attempt, yes?", score => 0.60],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 60) && ($s <= 70)); } => ["Try again. You can manage better than this.", score => 0.70],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 70) && ($s <= 75)); } => ["This is okay, But you could do better, yes?", score => 0.75],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 75) && ($s <= 80)); } => ["You are getting better, Try another?", score => 0.80],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 80) && ($s <= 85)); } => ["Nice Work!", score => 0.85],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 85) && ($s <= 90)); } => ["Very Good!", score => 0.90],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 90) && ($s <= 95)); } => ["Excellent!", score => 0.95],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return $s > $c; } => ["Perfect!", score => 1],

)));

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

sub GEOGEBRA_PARAMS {

my $result = {

showResetIcon=>"false" ,

enableRightClick=>"false" ,

enableLabelDrags=>"false",

showMenuBar=>"false" ,

showToolBar=>"false",

showAlgebraInput=>"false",

useBrowserForJS=>"true",

ggbbase64=>"UEsDBBQACAgIALs+3EwAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgICAC7PtxMAAAAAAAAAAAAAAAAFwAAAGdlb2dlYnJhX2RlZmF1bHRzMmQueG1s7VrfU9s4EH6+/hUaP909kNiOnQSG0KGdubnOUHpzMJ17VeyNo0ORfJJMHP76yvLPkJgGB0qg5QFrFWklfftpvVr59H26oOgWhCScTSynZ1sIWMBDwqKJlajZ0dh6f/buNAIewVRgNONigdXE8rOWVT8t9byRl9XhOJ5YAcVSksBCMcUq6zKxQguhVJITxi/xAmSMA7gK5rDAFzzAymiZKxWf9PvL5bJXjtfjIupHkeqlUivQc2VyYhWFE61urdNyYJq7tu30//18kas/IkwqzAKwkF5HCDOcUCV1ESgsgCmkVjFMrJjTVcSZhSieAp1Yf5dy0WNijWzr7N1vp5QwuFIrCkjNSXDDQOoZ+Vahxs4Lf5EwhAxPC3G9UqJWujwaW/1Mg5zzJeLT/yDQWpVIoBrUCKaN/vkjp1wgoTv6Awtpa/ha29QMgWk8x7rUc+z8z/GObccZOm7em+IVCHSLadba1OBE8cAoNLUzTCWUbfXQn3kI+S9e0Z6RhbEKkgpisxAZA4SmVC1VW3dliFLpO+0XsG4FOMNuDeG8o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FceE3Lr7+mlQrf3AoAjm/z2iVPx90m7xEkP0SUfpWevoWvDNSs4mq/YsLI1kBdxj6rlPAe16T8q433nd9ffxxPf6Wgl/Uw58sZ9MfFipN2lUojmW2zA1bT41JSY2Lyqv1OdXg/2igwiu3sC+osPVqGlzvHqmHirUfZK5p6VgJojvtjd1DX+WvssROMJBQRHImRQ5w+lOC1BpAsQZOx+uZusVAMaKAMipA7Rd/sUaep7/T+vP/A1BLBwiL9GTUQRAAAHN2AABQSwECFAAUAAgICAC7PtxMRczeXRoAAAAYAAAAFgAAAAAAAAAAAAAAAAAAAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc1BLAQIUABQACAgIALs+3EwNUm+18wQAAH4mAAAXAAAAAAAAAAAAAAAAAF4AAABnZW9nZWJyYV9kZWZhdWx0czJkLnhtbFBLAQIUABQACAgIALs+3ExtBS/Q3gIAAAgNAAAXAAAAAAAAAAAAAAAAAJYFAABnZW9nZWJyYV9kZWZhdWx0czNkLnhtbFBLAQIUABQACAgIALs+3EyL9GTUQRAAAHN2AAAMAAAAAAAAAAAAAAAAALkIAABnZW9nZWJyYS54bWxQSwUGAAAAAAQABAAIAQAANBkAAAAA"

};


$result;

}

ENDDOCUMENT();


Greetings,

We are making tentative steps on the two-way communication between a GeoGebra applet embedded within a WeBWorK problem...

Since the GeoGebra applet we are using gives student feedback in terms of an accuracy score,an integer on [0 to 100], how can javascript indicate to WeBWorK that this single value that is passed is "correct" since WeBWorK had no inputs to the applet to begin with?

We can get the student's accuracy value to be passed to WeBWorK from GeoGebra, and we can use a conditional statement to pass on the number one for a comparison with a WeBWorK answer variable to see if this is the correct value. This will cause the green field to light up as "correct". But the student will only see the number one as their entered value and the number one as the "correct value" in WeBWorK. However the student wont see "82" or "78" as the score that they achieved in the applet which is our intention.

So this leads to two Questions:
1.) How can a value passed to WeBWorK from a GeoGebra applet be read as "correct", or at least the score that a student is willing to accept.
2.) If the score is considered correct, does this prevent further attempts at improving one's score by re-attempting the problem with a new function in the embedded applet?

Thanks for any consideration....

Tim

## A simple testing of embedding GeoGebra applet
## Using two-way communication of values between the platforms
## of GeoGebra and WeBWorK
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGinfo.pl",
"unionTables.pl",
"AppletObjects.pl",
#"source.pl",
"PGcourse.pl",
);
TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

Context("Numeric");

#################################
# Set up problem for random variables
# Set parameters for a circle
#################################
#$a = random(0,7,1);
$a = 7;
$b = random(-3,2,1);
#$ans70 = String("NotBad");
$answ = Compute("$b");
$answer = Compute("1");
$accin = random(0,100,1);
$acc = random(0,100,1);
$wrg = "Nope!";
######################################
# 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 = "numberTest";
$applet = GeogebraWebApplet(
code => "geogebra.GeoGebraApplet",
archive => "geogebra.jar",
codebase => findAppletCodebase("geogebra.jar"),
appletName => $appletName,
appletId => $appletName,
submitActionAlias => 'getAppletValues', # default actionAlias
initializeActionAlias => '', # default actionAlias
setStateAlias => 'setXML',
getStateAlias => 'getXML',
setConfigAlias => '',
getConfigAlias => '',
returnFieldName => '',
width => 700, # may want to modify width
height => 300, # 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" takes the student submission in a geogebra applet
# and passes it to webwork: getQE() is a webwork call for geogebra submission?
# A general case of retrieving all values vs specific cases "a" and "b"
# is shown below...
submitActionScript => qq{ getQE('answerBox').value = getAppletValues() },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("a") },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("b") },
selfLoading => 1,
params => GEOGEBRA_PARAMS(), # paste parameters in
);

#######################################################
#
# For setting initial values in GeoGebra from WeBWorK
# Uses JavaScript interface to GeoGebra.
# hotfix #354 via Mike Gage was attempted and disgarded below to no affect:
# // Affixed protective <div>s to prevent overlapping text
#############################################################
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 "a" and "b" in GeoGebra to values $a & $b from WebWork
// But this first example passes nothing from ww to ggb
applet.setValue("accin", $accin);
// applet.setValue("b", $b);
// applet.setCoords("C", $a, $b);
} else {
setTimeout("setAppletCoefficients()", 1000);
}
} else {
setTimeout("setAppletCoefficients()",1000);
}
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};
</script>
END_SCRIPT

##################################
# Setup GeogebraWebApplet --
###################################
# // deleted Affixed protective <div> s to prevent overlapping text
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function ggbOnInit(param) {
var applet = document.$appletName;
if (param == "$appletName") {
applet_loaded(param,1); // report that applet is ready.
ww_applet_list[param].safe_applet_initialize(2);
ww_applet_list[param].object = param;
console.log("ggbOnInit: ww_applet_list["+param+"].object = ", ww_applet_list[param].object );
}

}
</script>
END_SCRIPT
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setConfig() {
var appletState = getQE('${appletName}_state').value;
if (ww_applet_list['$appletName'].object == undefined ) {
setTimeout("setConfig()", 5000);
console.log("waiting");
} else {
var applet=$appletName;
}
}
</script>
END_SCRIPT

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function getAppletValues() {
console.log("getAppletValues() entered");
// get a handle for the applet object
var applet = $appletName;
var A = applet.getValue("accuracy"); // from GeoGebra, 'a' to Webwork?
var D = applet.getValue("acc"); // from GeoGebra, 'd' to Webwork?
var A = (applet.getValue("accuracy") == applet.getValue("acc"))? 1:0; // true/false
var D = (A == 1)? 2:3; // true/false
//var B = applet.getYcoord("C"); // from GeoGebra, 'b' to Webwork? or JS?
getQE('A').value = applet.getValue("accuracy"); // Send value to ww
getQE('D').value = applet.getValue("acc"); // Send value to ww
//getQE('B').value = applet.getYcoord("C"); // Send value to ww
return(A);
//return(B);
}
</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,
)));

#######################################
# TEXT
#######################################
Context()->texStrings;
BEGIN_TEXT
$BR
Enter the value you see in the text.$BR
$BR
$BR
$BR
$BR
$BR
\(\quad \quad \quad \quad \quad \quad \quad \quad accuracy\) = \{NAMED_ANS_RULE("A", 5)\} Compared against \{$accin\} $PAR
$BR
\(\quad \quad \quad \quad \quad \quad \quad \quad 2nd entry\) = \{NAMED_ANS_RULE("D", 5)\} Compared against \{$accin\} $PAR
END_TEXT
#
#
#
#\(\quad \quad \quad \quad \quad \quad \quad \quad \quad \)number entry = \{NAMED_ANS_RULE("A", 10)\} $PAR
# CenterX = \{NAMED_ANS_RULE("Ax", 20)\} $PAR
#CenterY = \{NAMED_ANS_RULE("Ay", 20)\} $PAR
#Radius_squared = \{NAMED_ANS_RULE("radius_squared", 20)\} $PAR

#TEXT($PAR, "foostate |", $inputs_ref->{ "${appletName}_state"}, "|");

#TEXT( "run SetConfig", q!<script language="javascript">setConfig()</script> !) if $inputs_ref->{ "${appletName}_state"} =~ "restart_applet";

#TEXT( "run SetConfig", q!<script language="javascript">setConfig()</script> !) if $inputs_ref->{ "${appletName}_state"};


#########################################
# ANSWER section
#########################################
#\(\quad \quad \quad \quad \quad \quad \quad \quad \quad \)Coordinate \(x\) = \(\quad\)\{NAMED_ANS_RULE("A", 5)\} Should be \{$a\} $PAR

#NAMED_ANS( 'Ax' => Real($a1)->cmp );
#NAMED_ANS( 'Ay' => Real($b1)->cmp );
#NAMED_ANS( 'radius_squared' => Real($r2)->cmp );
# Compares student entry in ggb with WW passed variable
NAMED_ANS( 'A' => Real($accin)->cmp );
NAMED_ANS( 'D' => Real($acc)->cmp );
#NAMED_ANS( 'B' => Real($b)->cmp );
#Compares WW with WW
NAMED_ANS( 'answerBox' => Real($answer)->cmp );
#NAMED_ANS( 'answerBox' => $ansb->cmp );

#######################################
sub GEOGEBRA_PARAMS {
my $result = {
showResetIcon=>"false" ,
enableRightClick=>"false" ,
enableLabelDrags=>"false",
showMenuBar=>"false" ,
showToolBar=>"false",
showAlgebraInput=>"false",
useBrowserForJS=>"true",
ggbbase64=>"UEsDBBQACAgIAFeH1kwAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgICABXh9ZMAAAAAAAAAAAAAAAAFwAAAGdlb2dlYnJhX2RlZmF1bHRzMmQueG1s7VrfU9s4EH6+/hUaP909kNiOnQSG0KGdubnOUHpzMJ17VeyNo0ORfJJMHP76yvLPkJgGB0qg5QFrFWklfftpvVr59H26oOgWhCScTSynZ1sIWMBDwqKJlajZ0dh6f/buNAIewVRgNONigdXE8rOWVT8t9bzRIKvDcTyxAoqlJIGFYopV1mVihRZCqSQnjF/iBcgYB3AVzGGBL3iAldEyVyo+6feXy2WvHK/HRdSPItVLpVag58rkxCoKJ1rdWqflwDR3bdvp//v5Ild/RJhUmAVgIb2OEGY4oUrqIlBYAFNIrWKYWDGnq4gzC1E8BTqx/i7losfEGtnW2bvfTilhcKVWFJCak+CGgdQz8q1CjZ0X/iJhCBmeFuJ6pUStdHk0tvqZBjnnS8Sn/0GgtSqRQDWoEUwb/fNHTrlAQnf0BxbS1vC1tqkZAtN4jnWp59j5n+Md244zdNy8N8UrEOgW06y1qcGJ4oFRaGpnmEoo2+qh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aVHTcgghxZsSV7ug3jSOC7ZHn1Zs+P0Il1M/3Z/v7iIRq/uQ5RNe0lLUhhRNdn//Zn847OnfvdAf/G0sf4fiqPDbFh9/TbqVvzMUgZzfZbTKXw26SR4hyH6AKH0YPX343R0rZ6J6/yBgJmvgDkNfuAW8lzWp8DXW18MfV+NvK/h5Nfzp7yQlPyi04LPLUBzJalkYtpkakwU1Liqv1udUg//UQIXXbl1fUOFEKiF+Hng6QoBmPyetel9NvSsFeknnIQ50uEXlU8OUWNTiTFFFu6Dn2KYGZdghmNqrdH6v+HMu8jz9FdMf/wdQSwcIhspkLDkQAACRdQAAUEsBAhQAFAAICAgAV4fWTEXM3l0aAAAAGAAAABYAAAAAAAAAAAAAAAAAAAAAAGdlb2dlYnJhX2phdmFzY3JpcHQuanNQSwECFAAUAAgICABXh9ZMi4K5LfMEAAB+JgAAFwAAAAAAAAAAAAAAAABeAAAAZ2VvZ2VicmFfZGVmYXVsdHMyZC54bWxQSwECFAAUAAgICABXh9ZMBM97Bt4CAAAIDQAAFwAAAAAAAAAAAAAAAACWBQAAZ2VvZ2VicmFfZGVmYXVsdHMzZC54bWxQSwECFAAUAAgICABXh9ZMhspkLDkQAACRdQAADAAAAAAAAAAAAAAAAAC5CAAAZ2VvZ2VicmEueG1sUEsFBgAAAAAEAAQACAEAACwZAAAAAA=="

};

$result;
}
ENDDOCUMENT();


WeBWorK Main Forum -> geogebra javascript tutorial

by Joel Trussell -
I'm trying to modify the example in
I"ve copied that to my server. I can create scripts in my desktop Geogebra Classic 6 as in the tutorial
https://wiki.geogebra.org/en/Tutorial:Introduction_to_GeoGebraScript
I'd like to transfer the script approach to webwork and alter the example problem to use the buttons to set variables in the geobebra window in webwork.
I can do some simply things like changing colors and point sizes. I want to have the values of a vector set by the user via input of magnitude and angle/phase. I can do this in the desktop geogebra - inpt the magnitude and phase, compute the (x,y) coordinates of the vector and execute the vector command with the right values.

If I leave the input box in the gbb64 code and copy it to the webwork problem, I can set the vector. BUT I don't want the input boxes in the graph. I want the input to be in the position of the buttons and boxes in the example problem 6 at UofR.

This presents a problem for me - I don't know if I can use inputbox in the script of the example. I have tried to use button and set the coordinates with something like

<input type="button" value="set coords of V1: " onclick="setCoords('V1', setXfield.value, setYfield.value);">
<input type="text" name="setXfield" id="V1x" size="5" value="">
<input type="text" name="setYfield" id="V1y" size="5" value="">

this doesn't work.

I have searched and can't find a tutorial for interfacing the script commands of geogebra with the javescript used in the example. can you point me in the right direction for instruction?

for the record: my code is below
thanks

## DBsubject(Algebra)
## DBchapter(Conic sections)
## DBsection(Circles)
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGinfo.pl",
"AppletObjects.pl",
#"source.pl",
"PGcourse.pl",
);
TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

Context("Complex");
Context()->flags->set(
#tolerance => 0.15,
#tolType => "relative",
#zeroLevel=>10,
#zeroLevelTol=>0.2

);
#################################
# Set up problem
# Set parameters for a circle
#################################
$F= random(1,1.5,0.1);
$G = random(1,1.5,0.1);
$V1a=-($F+$G*i);
$V2a=-($F+$G*i)**2;
$V3a=-($F+$G*i)**3;
$V4a=-($F+$G*i)**4;


#$V1vr=re($V1v);
$V1ang=(arg($V1a)%(2*pi))/pi*180;
$V2ang=(arg($V2a)%(2*pi))/pi*180;
$V3ang=(arg($V3a)%(2*pi))/pi*180;
$V4ang=(arg($V4a)%(2*pi))/pi*180;


$V1abs=abs($V1a);
$V2abs=abs($V2a);
$V3abs=abs($V3a);
$V4abs=abs($V4a);
$xmax=ceil(1.25*(sqrt(2)*abs($V4a)));
$xmin=-$xmax;
$ymax=$xmax;
$ymin=$xmin;






$answer = Compute("($V1abs,$V1ang,$V2abs,$V2ang,$V3abs,$V3ang,$V4abs,$V4ang)");
@tol=(0.1,3); # Magnitude Tolerance 0.1, Angular Tolerance 3 degrees
@type=(0,1,0,1,0,1,0,1); #0 for magnitude value, 1 for angular value in degrees



######################################
# 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 => '', # default actionAlias
setStateAlias => 'setXML',
getStateAlias => 'getXML',
setConfigAlias => '',
getConfigAlias => '',
returnFieldName => '',
width => 700, # may want to modify width
height => 700, # 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() },
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
applet.setValue("xmin", $xmin);
applet.setValue("xmax", $xmax);
applet.setValue("ymin",$ymin);
applet.setValue("ymax", $ymax);






} else {
setTimeout("setAppletCoefficients()", 1000);
}
} else {
setTimeout("setAppletCoefficients()",1000);
}
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};

</script>

END_SCRIPT

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">
function getAppletValues() {
console.log("getAppletValues() entered");
// get a handle for the applet object
var applet = $appletName;
var V1m = applet.getValue("V1m");
var V1ang= applet.getValue("V1ang");
var V2m = applet.getValue("V2m");
var V2ang= applet.getValue("V2ang");
var V3m = applet.getValue("V3m");
var V3ang= applet.getValue("V3ang");
var V4m = applet.getValue("V4m");
var V4ang= applet.getValue("V4ang");
return(V1m + ',' +V1ang +','+V2m + ',' +V2ang +','+ V3m + ',' +V3ang +','+V4m + ',' +V4ang);
}
</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,
)));

#######################################
# TEXT
#######################################
Context()->texStrings;
BEGIN_TEXT
$test;
Given \(y = -($F + $G j) ^n\), $BR
Plot the graph of this function in polar coordinates with n = 1, 2, 3, and 4
Please drag the four vectors to the correct positions in the figure below. The red, green, blue and magenta vectors correspond to the cases of n=1, 2, 3 and 4 respectively. Note: WeBWork and MATLAB adopt different conventions for the phase angles, namely \([0^{\circ},360^{\circ}) \) and \((-180,180]\) respectively. However, this should not affect the geometry relationship between the vectors in your plot. Considering the difficulties in operating on the screen, your vector magnitude will be checked to \(\pm $tol[0]\) and your angle will be checked to \(\pm $tol[1] ^{\circ}\).
Click the submit answers button when you are done.
@{correct}

END_TEXT

#TEXT($PAR, "foostate |", $inputs_ref->{ "${appletName}_state"}, "|");

TEXT( "run SetConfig", q!<script language="javascript">setConfig()</script> !) if $inputs_ref->{ "${appletName}_state"} =~ "restart_applet";

TEXT(MODES( TeX => "GeoGebra Applet",
HTML =><<"END_APPLET" ) ); # " " means interpolate variables

<input type="button" value="Hide V1" onclick="getApplet('$appletName').setVisible('V1', false);">
<input type="button" value="Show V1" onclick="getApplet('$appletName').setVisible('V1', true);">
<input type="button" value="V1 red" onclick="getApplet('$appletName').setColor('V1', 255, 0, 0);">
<input type="button" value="V1 blue" onclick="getApplet('$appletName').setColor('V1', 0, 0, 255);">
<input type="button" value="Delete V1" onclick="getApplet('$appletName').deleteObject('V1');">
<input type="button" value="Reset" onclick="getApplet('$appletName').reset();">
 
$PAR
<input type="button" value="get coords of V1: " onclick="getCoords('V1');">
<input type="text" name="getXfield" id="V1x" size="5">
<input type="text" name="getYfield" id="V1y" size="5">
$PAR

<input type="button" value="set coords of V1: " onclick="setCoords('V1', setXfield.value, setYfield.value);">
<input type="text" name="setXfield" id="V1x" size="5" value="">

<input type="text" name="setYfield" id="V1y" size="5" value="">

 


END_APPLET

#########################################
# ANSWER section
#########################################
#$test=List('answerBox');
#NAMED_ANS( 'answerBox' => $answer->cmp(ordered=>1) );

NAMED_ANS( 'answerBox' =>$answer->
cmp(list_checker => sub {
my ($correct,$student,$ansHash,$value) = @_;
my $n = scalar(@$student); # number of student answers
my $score = 0; # number of correct student answers
my @errors = (); # stores error messages
my $i; # loop counters
#
# Loop though the student answers
##
for ($i = 0; $i < $n; $i++) {
my $err,$errt;
my $ith = Value::List->NameForNumber($i+1);
my $p = $student->[$i]; # i-th student answer
my $a = $p->value;
my $q = $correct->[$i]; # i-th student answer
my $b = $q->value;
if ($type[$i]==0){
$err=abs($a-$b)
}
if ($type[$i]==1){
$errt=abs($a-$b);
$err=min($errt,360-$errt);
}

if ($err<$tol[$type[$i]] ) {$score++} else {
push(@errors,"Your $ith point is not correct") unless $ansHash->{isPreview}
}
}
return ($score,@errors);
}));


sub GEOGEBRA_PARAMS {
my $result = {
showResetIcon=>"false" ,
enableRightClick=>"false" ,
enableLabelDrags=>"false",
showMenuBar=>"false" ,
showToolBar=>"false",
showAlgebraInput=>"false",
useBrowserForJS=>"true",
allowRescaling=>"false",
enableShiftDragZoom=>"false",
#geogeb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ir1M1je9uRkAAAAXAAAAFgAAAAAAAAAAAAAAAABaCAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc1BLAQIUABQACAgIAPiKvUzHVHkcWQkAALUrAAAMAAAAAAAAAAAAAAAAALcIAABnZW9nZWJyYS54bWxQSwUGAAAAAAQABAAIAQAAShIAAAAA"};
$result;
}
ENDDOCUMENT();

The cause/solution in our case was a combination of the following:

1. Add the following line to the %LMSrolesToWeBWorKroles hash: "Faculty" => "professor"

2. When choosing the Security Settings as detailed at http://webwork.maa.org/wiki/LTI-Advanced_Authentication_for_D2L#.WacknNGQyHA ),
"Send user ID to tool provider" does not appear in the list, instead select "Send LTI user ID and LTI role list to tool provider" (choosing system username or system Org Defined ID instead failed in our case).

So the minimal check boxes are:

Can you determine what is causing the prompts of "??" and "Choose" that normally appear within the PopUp prompts to now appear in numeric answer cells?

I would like for this glitch not to appear even though it does not affect the outcome of the answers upon submission.

If a student sees "Choose" she is likely to think that this answer does not require a numeric answer when in fact it does.

My code block is below...

Please help for any guidance...

Thanks Tim

##DESCRIPTION
##  Confidence intervals on mu and sigma
##  with interpretation of confidence.
##ENDDESCRIPTION

##KEYWORDS('confidence interval', 'confidence interpretation')

## DBsubject('Statisitics')
## DBchapter('confidence intervals')
## DBsection('Real Numbers')
## Date('11/7/2016')
## Author('Tim Payer')
# DESCRIPTION  CI on mu for t-intervals and Chi-intervals
# Find the associated probability given mu and sigma.
# Use correct notation.
# WeBWorK problem written by TimPayer <tsp1@humboldt.edu>
# ENDDESCRIPTION

## DBsubject(Probability)
## DBchapter(Random variables)
## DBsection(Expectation)
## Institution(Humboldt State University)
## Author(Tim Payer)
## KEYWORDS(probability, translate, notation)
DOCUMENT();

loadMacros(
"PGstandard.pl",
"PGunion.pl",
"PGnumericalmacros.pl",
"PGstatisticsmacros.pl",
"MathObjects.pl",
"parserPopUp.pl",
"PGML.pl",
"unionTables.pl",
"niceTables.pl",
"PGcourse.pl",
"PGchoicemacros.pl",
"weightedGrader.pl"
);

install_weighted_grader();

#Text(beginproblem());   #uncomment

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

Context("Numeric");
Context()->flags->set(
  tolerance => 0.01,
  tolType => "absolute",
);

## Problem 16.1 ##
## Fill 2 arrays (@imp, impaled and @liv, live) from random draws of specified ranges.
## Use a range of specified elements to fill each array ($ni, impaled and $nl, live)
## Join the elements of a given array ($ji and $jl) and display elements within a data table.
##

$ni=random(20,30,1);
@imp =();
foreach my $i (0..$ni-1) {
   $imp[$i] = random(15.0, 27.0, 0.1);
}

$ji = join(",   ", @imp);

$nl=random(79,96,1);
@liv =();
foreach my $i (0..$nl-1) {
   $liv[$i] = random(19.0, 30.0, 0.1);
}
$jl = join(",   ", @liv);

$meani = stats_mean(@imp);
$sdi = stats_sd(@imp);
$meani1 = sprintf("%0.1f",$meani);
$sdi1 = sprintf("%0.1f",$sdi);

$meanl = stats_mean(@liv);
$sdl = stats_sd(@liv);
$meanl1 = sprintf("%0.1f",$meanl);
$sdl1 = sprintf("%0.1f",$sdl);

############Start Problem 16.2  ##################

$xbg = random(4.2, 8.3, 0.1);
$xbb = random(3.2, 5.3, 0.1);
$sdg = random(0.5, 1.2, 0.1);
$sdb = random(0.3, 0.9, 0.1);
#$ng = random(21, 35, 0.1);
#$nb = random(21, 35, 0.1);
$ng =35;
$nb =35;



#$df = Compute("($sdg**2/$ng+$sdb**2/$nb)**2/(($sdg**2/$ng)**2/($ng-1)+($sdb**2/$nb)**2/($nb-1)");
## Could not find the "syntax error" above in the expanded form, used variables below:
$dfn =Compute("($sdg**2/$ng+$sdb**2/$nb)**2");
$dfd1 =Compute("($sdg**2/$ng)**2/($ng-1)");
$dfd2 =Compute("(($sdb**2/$nb)**2)/($nb-1)");
$df = Compute("$dfn/($dfd1+$dfd2)");
$dff1 = floor($df);
$dff =Compute("$dff1");




## HW 16.2 find t-criticals for 20 <df < 35 and 7 columns of alpha in t-table
## Note that if any of these random draws result in df calculations that are < 20
##  or > 69 that the student will be marked wrong incorrectly. However I have made 
## sample df calculation at all extremes and all fall safely within these bounds.
## Break the if then condition into two conditions each requiring a different 
## calculation for a CI on the difference of means.


$conf = list_random(60, 80, 90, 95, 98, 99, 99.9);  

if($conf == 60){
   if($dff==20) {
   $tint = 0.85996;
   } elsif($dff==21) {
   $tint = 0.85907;
   } elsif($dff==22) {
   $tint = 0.85827;
   } elsif($dff==23) {
   $tint = 0.85753;
   } elsif($dff==24) {
   $tint = 0.85686;
   } elsif($dff==25) {
   $tint = 0.85624;
   } elsif($dff==26) {
   $tint = 0.85567;
   } elsif($dff==27) {
   $tint = 0.85514;
   } elsif($dff==28) {
   $tint = 0.85465;
   } elsif($dff==29) {
   $tint = 0.85419;
   } elsif($dff==30) {
   $tint = 0.85377;
   } elsif($dff==40) {
   $tint = 0.85070;
   } elsif($dff==50) {
   $tint = 0.84887;
   } else {
   $tint = 0.84765;
   } 
} if($conf == 80){
   if($dff==20) {
   $tint = 1.32533;
   } elsif($dff==21) {
   $tint = 1.32320;
   } elsif($dff==22) {
   $tint = 1.32125;
   } elsif($dff==23) {
   $tint = 1.31944;
   } elsif($dff==24) {
   $tint = 1.31783;
   } elsif($dff==25) {
   $tint = 1.31636;
   } elsif($dff==26) {
   $tint = 1.31497;
   } elsif($dff==27) {
   $tint = 1.31369;
   } elsif($dff==28) {
   $tint = 1.31253;
   } elsif($dff==29) {
   $tint = 1.31142;
   } elsif($dff==30) {
   $tint = 1.31038;
   } elsif($dff==40) {
   $tint = 1.30308;
   } elsif($dff==50) {
   $tint = 1.29868;
   } else {
   $tint = 1.29581;
   } 
} if($conf == 90){
   if($dff==20) {
   $tint = 1.72474;
   } elsif($dff==21) {
   $tint = 1.72074;
   } elsif($dff==22) {
   $tint = 1.71715;
   } elsif($dff==23) {
   $tint = 1.71389;
   } elsif($dff==24) {
   $tint = 1.71087;
   } elsif($dff==25) {
   $tint = 1.70813;
   } elsif($dff==26) {
   $tint = 1.70563;
   } elsif($dff==27) {
   $tint = 1.70326;
   } elsif($dff==28) {
   $tint = 1.70112;
   } elsif($dff==29) {
   $tint = 1.69911;
   } elsif($dff==30) {
   $tint = 1.69724;
   } elsif($dff==40) {
   $tint = 1.68386;
   } elsif($dff==50) {
   $tint = 1.67589;
   } else {
   $tint = 1.67065;
   } 
} if($conf == 95){
   if($dff==20) {
   $tint = 2.0860;
   } elsif($dff==21) {
   $tint = 2.0796;
   } elsif($dff==22) {
   $tint = 2.0739;
   } elsif($dff==23) {
   $tint = 2.0687;
   } elsif($dff==24) {
   $tint = 2.0639;
   } elsif($dff==25) {
   $tint = 2.0595;
   } elsif($dff==26) {
   $tint = 2.0556;
   } elsif($dff==27) {
   $tint = 2.0519;
   } elsif($dff==28) {
   $tint = 2.0484;
   } elsif($dff==29) {
   $tint = 2.0452;
   } elsif($dff==30) {
   $tint = 2.0423;
   } elsif($dff==40) {
   $tint = 2.0211;
   } elsif($dff==50) {
   $tint = 2.0085;
   } else {
   $tint = 2.0003;
   } 
} if($conf == 98){
   if($dff==20) {
   $tint = 2.5280;
   } elsif($dff==21) {
   $tint = 2.5176;
   } elsif($dff==22) {
   $tint = 2.5083;
   } elsif($dff==23) {
   $tint = 2.4999;
   } elsif($dff==24) {
   $tint = 2.4921;
   } elsif($dff==25) {
   $tint = 2.4851;
   } elsif($dff==26) {
   $tint = 2.4786;
   } elsif($dff==27) {
   $tint = 2.4727;
   } elsif($dff==28) {
   $tint = 2.4771;
   } elsif($dff==29) {
   $tint = 2.4620;
   } elsif($dff==30) {
   $tint = 2.4573;
   } elsif($dff==40) {
   $tint = 2.4232;
   } elsif($dff==50) {
   $tint = 2.4033;
   } else {
   $tint = 2.3902;
   } 
} if($conf == 99){
   if($dff==20) {
   $tint = 2.8453;
   } elsif($dff==21) {
   $tint = 2.8314;
   } elsif($dff==22) {
   $tint = 2.8187;
   } elsif($dff==23) {
   $tint = 2.8074;
   } elsif($dff==24) {
   $tint = 2.7969;
   } elsif($dff==25) {
   $tint = 2.7874;
   } elsif($dff==26) {
   $tint = 2.7787;
   } elsif($dff==27) {
   $tint = 2.7707;
   } elsif($dff==28) {
   $tint = 2.7633;
   } elsif($dff==29) {
   $tint = 2.7564;
   } elsif($dff==30) {
   $tint = 2.7500;
   } elsif($dff==40) {
   $tint = 2.7045;
   } elsif($dff==50) {
   $tint = 2.6778;
   } else {
   $tint = 2.6604;
   } 
} if($conf == 99.9){
   if($dff==20) {
   $tint = 3.849;
   } elsif($dff==21) {
   $tint = 3.819;
   } elsif($dff==22) {
   $tint = 3.792;
   } elsif($dff==23) {
   $tint = 3.768;
   } elsif($dff==24) {
   $tint = 3.745;
   } elsif($dff==25) {
   $tint = 3.725;
   } elsif($dff==26) {
   $tint = 3.707;
   } elsif($dff==27) {
   $tint = 3.690;
   } elsif($dff==28) {
   $tint = 3.674;
   } elsif($dff==29) {
   $tint = 3.659;
   } elsif($dff==30) {
   $tint = 3.646;
   } elsif($dff==40) {
   $tint = 3.551;
   } elsif($dff==50) {
   $tint = 3.496;
   } else {
   $tint = 3.460;
   } 
}
$tin =Compute("$tint");  # Converting $tint into a math object..
$tint =$tin;


###  Prob 16.2b: tint CI on u  ####
#$lbt = Compute("$xbg-$xbb - $tint*sqrt($sdg**2/$ng+$sdb**2/$nb)");
#$ubt =  Compute("$xbg-$xbb + $tint*sqrt($sdg**2/$ng+$sdb**2/$nb)");

$lbt = Compute("-2.6857");
$ubt = Compute("2");

###  Prob 16.2c: tint CI on u  ####
## Interpret the bounds of the CI in a sentence.

if($lbt < 0 && $ubt > 0){
   $dec = "does not";
   $lbs = abs($lbt);
   $lbday = "shorter";
   $ubs = $ubt;
   $ubday = "longer";
   } elsif ($lbt < 0 && $ubt < 0){
   $dec ="does";
   $lbs = abs($lbt);
   $lbday = "shorter";
   $ubs = abs($ubt);
   $ubday = "shorter";
   } else {
   $dec ="does";
   $lbs = $lbt;
   $lbday = "longer";
   $ubs = $ubt;
   $ubday = "longer";
   } 

$pop1 = PopUp(
["Choose", 'does', 'does not'], $dec);

$popdl = PopUp(
["??", 'shorter', 'longer'], $lbday);
$popdu = PopUp(
["??", 'shorter', 'longer'], $ubday);

$pop2 = PopUp(
["??", 'longer', 'shorter', 'not significantly different'],'shorter');
$ablbt =abs($lbt);
$abubt =abs($ubt);



###  Prob 16.2d: interpretation of confidence on 2 mu  ####

$pop3 = PopUp(
["Choose:",  'all lead times', 'random samples', 'sample proportions', 'the true mean', 'sample means' ], 'random samples');

$pop4 = PopUp(
["Choose:",  'exist within', 'have a mean difference of lead times that fall within', 'show agreement with', 'form confidence intervals that contain', 'contains the true mean lead time as in' ], 'form confidence intervals that contain');

$pop5 = PopUp(
["Choose:",  'true proportion of lead times', 'true difference of mean lead times', 'sample proportion of horn lengths', 'true mean lead time', ' '.$conf.'% confidence interval that we have calculated' ], 'true difference of mean lead times');

####  Begin Problem...

 
BEGIN_PGML 
   *Drawn from Lecture Notes: Week 8 Day 2.*  

END_PGML 

BEGIN_TEXT
$PAR
\{
DataTable(
[
["$BBOLD 16.2) $EBOLD   Violet green swallows, $BITALIC Tachycineta thalassina$EITALIC, arrive in Humboldt county in late March, while barn swallows, $BITALIC Hirundo rustica$EITALIC, tend to arrive during the first few weeks of April. However for both species the males arrive a number of days before their female mates. Given that a long time resident of Humboldt county has kept meticulous records of the lead time in the number of days for which a male swallow arrived in Humboldt county before its mate, is there a significant difference in the lead time arrival in days for the male swallow between the two species? Use a $conf% interval to determine your answer. The summarized data of the male lead time in days for both species are shown in the table below. ",'  ',[image( "MikeDanzenbaker.png", width=>285, height=>353, tex_size=>700 ) .$BR."image by Mike Danzenbaker".$BR.image( "WikipediaVGS.png", width=>935, height=>625, tex_size=>700 ).$BR."Image by Wikipedia" ] ,image( "EugeneBeckesCC3.png", width=>537, height=>598, tex_size=>700 ).$BR."image by Eugene Beckes".$BR.image( "EugeneBeckesCC.png", width=>500, height=>421, tex_size=>700 ).$BR."image by Eugene Beckes",]
  ], 
  caption => 'A comparison of images of the male violet green swallow and barn swallow. ',
  midrules=>0, 
  align => 'p{3.5in} p{0.1in} p{2.5in}p{2.5in}'
);
\}
$PAR
\{
DataTable(
[
[[' Violet green $BR swallow', headerrow => 1],'Barn $BR swallow ',],
[['\(\bar x_1\) = $xbg $BR \(\text{sd}_1\) = $sdg $BR \(\text{n}_1\) = $ng' ],'\(\bar x_2\) = $xbb $BR \(\text{sd}_2\) = $sdb $BR \(\text{n}_2\) = $nb'],
], 
caption => ' A comparison between two species of swallows on the lead time in days that the male swallow arrives in Humboldt county before their respective mates.',
midrules => 1,
align => '|p{1.8in}|p{1.8in}|',
);
\}
$BR
$PAR

END_TEXT

BEGIN_PGML 
*16.2)*  Create a [$conf]% confidence interval for the difference of means in the lead time in days for which males arrive before their respective mates for both species of swallow. Use second decimal accuracy.

*16.2a)*  Calculate for the degrees of freedom and the associated t-critical value for this confidence interval accurate to the second decimal:  
 
df = [_______]

Round your df value down to the next available integer value in the t-table:

t-table df = [_______]
 
Determine the associated t-critical value for a [$conf]% confidence interval on the difference of means.  
 
t-critical =  [_______]
 

*16.2b)*  Calculate the [$conf]% confidence interval on the difference of means in the lead time in days for which males arrive before their respective mates for both species of swallow. Use second decimal accuracy:  
 
[`` = \Large{(\,}``] [_______] [`` \Large{, \,}``] [_______] [``  \Large{)} \text{days}``]  
 
 
*16.2c)*   Does the [$conf]% confidence interval on the difference of the mean male to mate lead time in days show a significant difference between the species of swallows? Explain by completing the following sentences using the bounds of the confidence interval to make your case.  
 
The [$conf]% confidence interval [$pop1->menu]*  support the claim that there is a significant difference in the male to mate lead time between both species of swallows. Male violet green swallows tend to have a lead lead time on their prospective mates that is anywhere from [______] days [$popdl->menu]* to  [______] days [$popdu->menu]* than the lead times for male barn swallows over their respective mates.
 
 
*16.2d)*   Interpret the meaning of the [$conf]% confidence in the context of this problem. If the confidence level can be read as a probability, then there is a [$conf]% chance that what event will occur?  Select the phrase in the next three cells that will form the correct interpretation for the meaning of confidence in the context of both data sets for the mean lead time in days for which a male swallow arrives in Humboldt county ahead of its mate.  
 
[$conf]% confidence means that [$conf]% of [$pop3->menu]* for the lead time in days that a male swallow will arrive in Humboldt county before it mate will [$pop4->menu]* the [$pop5->menu]* between the two swallow populations.


DF = [$dff]  
ng = [$ng]  
nb = [$nb]  
lbt = [$lbt]  
ubt = [$ubt]  
lbs = [$lbs]  
ubs = [$ubs]  


END_PGML

#Adapted weighted answers values:  

## Problems 12.2 ##

WEIGHTED_ANS( ($df)->cmp, 8 );
WEIGHTED_ANS( ($dff)->cmp, 4 );
WEIGHTED_ANS( ($tint)->cmp, 8 );

WEIGHTED_ANS( ($lbt)->cmp, 10 );
WEIGHTED_ANS( ($ubt)->cmp, 10 );

WEIGHTED_ANS( ($pop1)->cmp, 4 );
WEIGHTED_ANS( ($lbs)->cmp, 10 );
WEIGHTED_ANS( ($popdl)->cmp, 4 );
WEIGHTED_ANS( ($ubs)->cmp, 10 );
WEIGHTED_ANS( ($popdu)->cmp, 4 );


WEIGHTED_ANS( ($pop3)->cmp, 8 );
WEIGHTED_ANS( ($pop4)->cmp, 8 );
WEIGHTED_ANS( ($pop5)->cmp, 8 );

BEGIN_PGML_SOLUTION


The correct answers are coming....in 2017, Hah!



END_PGML_SOLUTION

ENDDOCUMENT();
Our Webwork system was working fine until yesterday. I was running a computer lab yesterday with 30 or so simultaneous users. Things seem to be going fine (students logged in, working on problems, answer checker working and so on).

Now I can't login into webwork and students are getting errors even if they are able to login. Below is a copy of the error message I get when trying to login to my course.

Students also complain that when they try to enter answers in a problem, they get errors as well. I can post screen shots of these errors if needed.

Any suggestions on what to do to fix this would be greatly appreciated.