From cf7d744a26e9f637853349c29a2728b75c4882a9 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 19 Dec 2025 05:04:29 -0600 Subject: [PATCH] Remove the `Demo` set. This set has nothing of value in it anymore. The problems are really not what we want problem authors to use as a model for new problems. It is time for this set to go. --- courses.dist/modelCourse/templates/Demo | 1 + .../modelCourse/templates/setDemo.def | 86 -------- .../modelCourse/templates/setDemo/c4s5p2.pg | 49 ----- .../modelCourse/templates/setDemo/calc.html | 57 ----- .../modelCourse/templates/setDemo/josephus.pg | 204 ------------------ .../modelCourse/templates/setDemo/limits.pg | 89 -------- .../templates/setDemo/liteApplet1.pg | 67 ------ .../templates/setDemo/liteApplet2.pg | 72 ------- .../templates/setDemo/nsc2s10p2.pg | 66 ------ .../templates/setDemo/paperHeaderFile1.pg | 27 --- .../modelCourse/templates/setDemo/prob5.pg | 136 ------------ .../modelCourse/templates/setDemo/prob6b.pg | 86 -------- .../modelCourse/templates/setDemo/s2_2_1.pg | 53 ----- .../templates/setDemo/sample_myown_ans.pg | 85 -------- .../templates/setDemo/sample_units_ans.pg | 38 ---- .../templates/setDemo/screenHeaderFile1.pg | 77 ------- .../modelCourse/templates/setDemo/srw1_9_4.pg | 110 ---------- 17 files changed, 1 insertion(+), 1302 deletions(-) create mode 120000 courses.dist/modelCourse/templates/Demo delete mode 100644 courses.dist/modelCourse/templates/setDemo.def delete mode 100644 courses.dist/modelCourse/templates/setDemo/c4s5p2.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/calc.html delete mode 100644 courses.dist/modelCourse/templates/setDemo/josephus.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/limits.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/liteApplet1.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/liteApplet2.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/nsc2s10p2.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/paperHeaderFile1.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/prob5.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/prob6b.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/s2_2_1.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/sample_myown_ans.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/sample_units_ans.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/screenHeaderFile1.pg delete mode 100644 courses.dist/modelCourse/templates/setDemo/srw1_9_4.pg diff --git a/courses.dist/modelCourse/templates/Demo b/courses.dist/modelCourse/templates/Demo new file mode 120000 index 0000000000..be83f117b2 --- /dev/null +++ b/courses.dist/modelCourse/templates/Demo @@ -0,0 +1 @@ +../../../webwork2/assets/pg/Demo \ No newline at end of file diff --git a/courses.dist/modelCourse/templates/setDemo.def b/courses.dist/modelCourse/templates/setDemo.def deleted file mode 100644 index 48afedf1c9..0000000000 --- a/courses.dist/modelCourse/templates/setDemo.def +++ /dev/null @@ -1,86 +0,0 @@ -assignmentType = default -openDate = 01/10/1998 at 06:00am EST -reducedScoringDate = 01/01/2006 at 02:00am EST -dueDate = 01/01/2006 at 02:00am EST -answerDate = 01/01/2006 at 02:00am EST -enableReducedScoring = N -paperHeaderFile = setDemo/paperHeaderFile1.pg -screenHeaderFile = setDemo/screenHeaderFile1.pg -description = -restrictProbProgression = 0 -emailInstructor = 0 - -problemListV2 -problem_start -problem_id = 1 -source_file = setDemo/srw1_9_4.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end -problem_start -problem_id = 2 -source_file = setDemo/limits.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end -problem_start -problem_id = 3 -source_file = setDemo/s2_2_1.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end -problem_start -problem_id = 4 -source_file = setDemo/c4s5p2.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end -problem_start -problem_id = 5 -source_file = setDemo/sample_units_ans.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end -problem_start -problem_id = 6 -source_file = setDemo/nsc2s10p2.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end -problem_start -problem_id = 7 -source_file = setDemo/prob5.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end -problem_start -problem_id = 8 -source_file = setDemo/sample_myown_ans.pg -value = 1 -max_attempts = -1 -showMeAnother = -1 -counts_parent_grade = 0 -att_to_open_children = 1 -problem_end - diff --git a/courses.dist/modelCourse/templates/setDemo/c4s5p2.pg b/courses.dist/modelCourse/templates/setDemo/c4s5p2.pg deleted file mode 100644 index 439f88f27f..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/c4s5p2.pg +++ /dev/null @@ -1,49 +0,0 @@ -#DESCRIPTION -#KEYWORDS('integrals', 'substitution') -# Integrals - \int_0^{$x1} x(x^2 ?{$a})^5 dx -# Substitution -#ENDDESCRIPTION - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros("PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", - "PGauxiliaryFunctions.pl" -); - -$showPartialCorrectAnswers = 1; - -$n = random(3,6,1); -$n1 = $n-1; - -BEGIN_TEXT -Find \[ F(x) = \int x^{$n1}\cos(x^{$n}) \; dx \] -Give a specific function for \( F(x) \). $BR $BR - -F(x) = \{ans_rule(45)\} -END_TEXT - -$ans = "sin(x^$n)/$n"; -ANS(function_cmp_up_to_constant($ans )); - -#$ans = "sin(x^$n)/$n + c"; # c is the constant of integration which - # is a free parameter. It can be adjusted - # to match the student's answer. -#ANS( fun_cmp($ans, params => ['c'] ) ); -$a1= random(-9,-1,1); -$b1= random(0,9,1); - -BEGIN_TEXT -$BR $BR -Evaluate \[ F(x) = \int_{$a1}^{$b1} x^{$n1}\cos(x^{$n}) \; dx \] -$BR -\{ans_rule(50)\} -END_TEXT - -$ans = (sin($b1**$n) - sin($a1**$n))/$n; - -&ANS(num_cmp($ans )); - - -ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/courses.dist/modelCourse/templates/setDemo/calc.html b/courses.dist/modelCourse/templates/setDemo/calc.html deleted file mode 100644 index 1056894e8f..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/calc.html +++ /dev/null @@ -1,57 +0,0 @@ - - -The JavaScript Source: Calculators: Basic - - - - - - -

- - -I took this calculator straight from the web at javascriptsource.com -

- -This is a very simple calculator, -all done with javascript. -Just click the numbers and -the operators and use the "=" button to calculate! - -

-
- - - - - - - -
- -
-
- - - - -
- - - - -
- - - - -
- - - - -
-
-
-
- diff --git a/courses.dist/modelCourse/templates/setDemo/josephus.pg b/courses.dist/modelCourse/templates/setDemo/josephus.pg deleted file mode 100644 index 605dca6f76..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/josephus.pg +++ /dev/null @@ -1,204 +0,0 @@ -&DOCUMENT(); -loadMacros("PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", -); -# define function to be evaluated - -HEADER_TEXT(< - -function joeGame(n, k, m){ -this.people = n -this.skip = k -this.keep = m -this.list = new Array(n) -for (var i=0; i n) { - x = Math.floor(( k*(x-n) - 1.0 )/ (k-1.0) ) - } -return(x) -} - -function playGame() { - -var newN = parseInt(document.gameForm.peopleNumField.value) -var newK = parseInt(document.gameForm.skipNumField.value) - -var suff = new String("th") - -var s -var n = newN -var k = newK -var numRows = Math.floor(n/20) -var numLeft = n - 20*numRows - -if (!newN || !newK) { - alert ("Enter some data.") - document.gameForm.peopleNumField.focus() - } -else - { - -currentGame = new joeGame(n, k, 1) - -for (var s=1; s<=currentGame.people; s++){ - currentGame.list[s-1] = joeth(n, k, s) - } - -if ((newK % 10) == 1) { - if ((newK == 1) || (newK > 20)) { - suff = "st" - } - else { - suff="th" - } -} -else { - if ((newK % 10) == 2){ - if ((newK == 2) || (newK > 20)) { - suff = "nd" - } - else { - suff="th" - } - } - else { - if ((newK % 10) == 3){ - if ((newK == 3) || (newK > 20)) { - suff = "rd" } - else { - suff="th" - } - } - } -} - -parent.gameStatus.document.clear() -parent.gameStatus.document.write("

The Josephus Game

") -parent.gameStatus.document.write(" Playing the Josephus Game with " + - document.gameForm.peopleNumField.value + " people, ") -parent.gameStatus.document.write(" eliminating every " + - document.gameForm.skipNumField.value + "" + suff + " person, leaves ") -parent.gameStatus.document.write(" person " + currentGame.list[n-1] + " as the last survivor. ") -parent.gameStatus.document.write("

The entire elimination order is

") - -for (var d=0; d \n Order Eliminated ") - for (var k=1; k<=20; k++) { - parent.gameStatus.document.write(" " + (20*d + k) + " ") - } - parent.gameStatus.document.write(" \n Person Eliminated ") - - for (k=0; k<20; k++) { - parent.gameStatus.document.write(" " + currentGame.list[20*d+k] + " ") - } - parent.gameStatus.document.write(" \n
") - } -if (numLeft > 0) { - parent.gameStatus.document.write(" \n ") - for (var k=1; k<=numLeft; k++) { - parent.gameStatus.document.write(" ") - } - parent.gameStatus.document.write(" \n ") - - for (k=0; k " + currentGame.list[20*d+k] + " ") - } - parent.gameStatus.document.write(" \n
Order Eliminated " + (20*d + k) + "
Person Eliminated

") - } - } - parent.gameStatus.document.close() -} - - -function clearStuff(){ -parent.gameStatus.document.open() -parent.gameStatus.document.clear() -parent.gameStatus.document.location = "gamestart.html" -parent.gameStatus.document.close() -document.gameForm.peopleNumField.focus() -currentGame.people = 10 -currentGame.skip = 0 -currentGame.keep = 0 -for (var i=0; i++; i - - -EOF - -TEXT(MODES( -TeX => '', -Latex2HTML => "\begin{rawhtml} \end{rawhtml}", -HTML => "" -)); - -BEGIN_TEXT -$PAR -This problem illustrates how you can embed JavaScript code in a WeBWorK example -to create an interactive homework problem that could never be provided by a text book. -Stolen from Doug Ensley and mathDL. -http://www.mathdl.org/offsite.html?page=http://www.ship.edu/~deensl/mathdl/Joseph.html&content_id=41520 -END_TEXT - -BEGIN_TEXT - -END_TEXT -TEXT(< - - - - - - -
- - - - - - - - - - - - -
n
k
-
Set the parameters and press Start -to see the elimination order when you start with n people -and eliminate every kth one.
- -

-EOF -$ans =3; - -ANS(num_cmp($ans,reltol=>1,format =>"%0.14g") ); #We are allowing 1 percent error for the answer. - - -ENDDOCUMENT(); diff --git a/courses.dist/modelCourse/templates/setDemo/limits.pg b/courses.dist/modelCourse/templates/setDemo/limits.pg deleted file mode 100644 index 4bb29e5280..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/limits.pg +++ /dev/null @@ -1,89 +0,0 @@ -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", - "PGgraphmacros.pl", - "PGauxiliaryFunctions.pl" -); - -$showPartialCorrectAnswers = 1; - -$a=random(-3,3,1); -$b=random(-2,3,1); -$c=random(-3,2,1); -$m1=random(-1,1,0.5); -$m2=($b - $a)/2; -$m3=($c - $b - 1)/2; -$m4=random(-1,1,0.5); -@slice = NchooseK(3,3); - -@colors = ("blue", "red", "green"); -@sc = @colors[@slice]; #scrambled colors -@sa = ('A','B','C')[@slice]; - -$f1 = FEQ("${m1}(x+1) + $a for x in [-2,-1) using color:$sc[0] and weight:2"); -$f2 = FEQ("${m2}(x-1) + $b for x in (-1,1) using color=$sc[0] and weight:2"); -$f3 = FEQ("${m3}(x-3) + $c for x in [1,3) using color=$sc[0] and weight=2"); -$f4 = FEQ("1+$a for x in [-1,-1] using color=$sc[0] and weight=2"); -$f5 = FEQ("${m4}(x-3) + $c for x in (3,4] using color=$sc[0] and weight=2"); - -$graph = init_graph(-3,-6,5,6,'axes'=>[0,0],'grid'=>[8,12]); - -($f1Ref,$f2Ref,$f3Ref,$f4Ref,$f5Ref) = plot_functions($graph,$f1,$f2,$f3,$f4,$f5); - -BEGIN_TEXT -Let F be the function below.$PAR -If you are having a hard time seeing the picture clearly, click on the picture. It will expand to a larger picture on its own page so that you can inspect it more clearly.$PAR -END_TEXT - -TEXT(image( insertGraph($graph), height=>200, width=>200 )); - -BEGIN_TEXT -$BR -$BR -Evaluate each of the following expressions. $PAR -Note: Enter 'DNE' if the limit does not exist or is not defined. $PAR - -a) \( \lim_{x \to -1^-} F(x) \) = \{ans_rule(4)\} -$PAR - -b) \( \lim_{x \to -1^+} F(x) \) = \{ans_rule(4)\} -$PAR - -c) \( \lim_{x \to -1} F(x) \) = \{ans_rule(4)\} -$PAR - -d) \( F(-1) \) = \{ans_rule(4)\} -$PAR - -e) \( \lim_{x \to 1^-} F(x) \) = \{ans_rule(4)\} -$PAR - -f) \( \lim_{x \to 1^+} F(x) \) = \{ans_rule(4)\} -$PAR - -g) \( \lim_{x \to 1} F(x) \) = \{ans_rule(4)\} -$PAR - -h) \( \lim_{x \to 3} F(x) \) = \{ans_rule(4)\} -$PAR - -i) \( F(3) \) = \{ans_rule(4)\} -$PAR - -END_TEXT - -$ap1 = 1 + $a; -$bp1 = 1 + $b; - -# limits at -1 -ANS(num_cmp( [ $a, $a, $a, $ap1] , strings => ['DNE'] )) ; -# limits at 1 -ANS(num_cmp( [ $b, $bp1,'DNE'] , strings => ['DNE'] )) ; -# limits at 3 -ANS(num_cmp( [ $c, 'DNE' ] , strings => ['DNE'] )) ; - - -ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/courses.dist/modelCourse/templates/setDemo/liteApplet1.pg b/courses.dist/modelCourse/templates/setDemo/liteApplet1.pg deleted file mode 100644 index a00e0178be..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/liteApplet1.pg +++ /dev/null @@ -1,67 +0,0 @@ -DOCUMENT(); - -loadMacros("PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", -); - -$showPartialCorrectAnswers = 1; - -# The link to the java applet is hard wired to use the java applet -# served from the University of Rochester WeBWorK machine. -# It is possible to set this up so that the java applet is served -# from any machine -# For details use the Feedback button to contact the authors of WeBWorK - -BEGIN_TEXT -This is a lite applet designed by Frank Wattenberg. -$BR -\{htmlLink( '/webwork2_course_files/demoCourse/live_map_instructions.html ', -'Instructions for using the map',' target="intro" ' )\} -$HR -END_TEXT -$appletText = -appletLink( -q! archive="/courses/system_html/applets/Image_and_Cursor_All/Image_and_Cursor.jar" -code="Image_and_Cursor" width = 500 height = 458 -!, -q!Your browser does not support Java, so nothing is displayed. - - - - - - - -! -); -sub dist { - my $ra_pt1 = shift; - my $ra_pt2 =shift; - my $conversion = 300 /(145 - 72); # number of km per pixel - return $conversion* sqrt( ($ra_pt1->[0] - $ra_pt2->[0])**2 + ($ra_pt1->[1] - $ra_pt2->[1])**2); -} - -$kandahar = [132,101]; -$kabul = [209,185]; -$mazur_e_sharif = [170, 243]; -$shindand = [46, 155]; - -$questions = EV3( -"$PAR How far is it from Kandahar to Kabul? " , ans_rule(30), -" $PAR How far is it from Kabul to Mazar-e-Sharif? ", ans_rule(30), -" $PAR How far is it from Kandahar to Shindand? " , ans_rule(30), -); -#TEXT( -#begintable(2), -#row( $appletText, $questions), -#endtable() -#); -TEXT($appletText, $questions); -ANS(num_cmp(dist($kandahar,$kabul), reltol => 3, units=>'km')); -ANS(num_cmp(dist($kabul, $mazur_e_sharif), reltol => 3, units=>'km')); -ANS(num_cmp(dist($kandahar,$shindand), reltol => 3, units=>'km')); - - - -ENDDOCUMENT(); diff --git a/courses.dist/modelCourse/templates/setDemo/liteApplet2.pg b/courses.dist/modelCourse/templates/setDemo/liteApplet2.pg deleted file mode 100644 index 00b754242d..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/liteApplet2.pg +++ /dev/null @@ -1,72 +0,0 @@ -DOCUMENT(); - -loadMacros("PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", -); - -$showPartialCorrectAnswers = 1; - -BEGIN_TEXT -This is a lite applet designed by Frank Wattenberg. -$BR -\{htmlLink( '/webwork2_course_files/demoCourse/live_map_instructions.html ', -'Instructions for using the map',' target="intro" ' )\} -$HR -END_TEXT -TEXT( -appletLink( -q! archive="/courses/system_html/applets/Image_and_Cursor_All/Image_and_Cursor.jar" -code="Image_and_Cursor" width = 500 height = 458 -!, -q!Your browser does not support Java, so nothing is displayed. - - - - - - - -! -), -); -sub dist { - my $ra_pt1 = shift; - my $ra_pt2 =shift; - $conversion = 300 /(145 - 72); # number of km per pixel - return $conversion * sqrt( ($ra_pt1->[0] - $ra_pt2->[0])**2 + ($ra_pt1->[1] - $ra_pt2->[1])**2); -} -@cities = ( - { name => 'Kandahar', location => [132,101] }, - { name => 'Kabul', location => [209,185] }, - { name => 'Mazur e Sharif', location => [170, 243] }, - { name => 'Shindand', location => [46, 155] }, - { name => 'Zaranj', location => [39, 93] } -); -@index = NchooseK(scalar(@cities), 3 ); -sub cityName { - my $index = shift ; - $cities[$index -1]->{name}; -} -sub cityLoc { - my $index = shift; - $cities[$index-1]->{location}; -} - -$conversion = 300 /(145 - 72); # number of km per pixel -BEGIN_TEXT -$PAR -How far is it from \{cityName($index[1])\} to \{cityName($index[2])\}? \{ans_rule(30)\} -$PAR -How far is it from \{cityName($index[1])\} to \{cityName($index[3])\}? \{ans_rule(30)\} -$PAR -How far is it from \{cityName($index[2])\} to \{cityName($index[3])\}? \{ans_rule(30)\} -END_TEXT - -ANS(num_cmp(dist(cityLoc($index[1]),cityLoc($index[2])), reltol=>3, units=>'km')); -ANS(num_cmp(dist(cityLoc($index[2]), cityLoc($index[2])), reltol=>3, units=>'km')); -ANS(num_cmp(dist(cityLoc($index[2]),cityLoc($index[2])), reltol=>3, units=>'km')); - - - -ENDDOCUMENT(); diff --git a/courses.dist/modelCourse/templates/setDemo/nsc2s10p2.pg b/courses.dist/modelCourse/templates/setDemo/nsc2s10p2.pg deleted file mode 100644 index 632cad14d7..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/nsc2s10p2.pg +++ /dev/null @@ -1,66 +0,0 @@ -#DESCRIPTION -# Identify the graphs of the function and the derivative -#ENDDESCRIPTION - -#KEYWORDS('derivatives', 'graphs') -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", - "PGauxiliaryFunctions.pl", - "PGgraphmacros.pl" -); - -$showPartialCorrectAnswers = 0; - -$a=random(0, 6.3, .1); -$b=random(1.1, 1.5, .1); - -$dom = 4; -@slice = NchooseK(3,3); - -@colors = ("blue", "red", "black"); -@sc = @colors[@slice]; #scrambled colors -@sa = ('A','B','C')[@slice]; - - -$f = "sin($a+$b*cos(x)) for x in <-$dom,$dom> using color:$sc[0] and weight:2"; -$fp = "cos($a+$b*cos(x))*(-$b)*sin(x) for x in <-$dom,$dom> using color=$sc[1] and weight:2"; -$fpp = " -sin($a+$b*cos(x))*$b*$b*sin(x)*sin(x) + cos($a+$b*cos(x))*(-$b)*cos(x) for x in <-$dom,$dom> using color=$sc[2] and weight=2"; - -$graph = init_graph(-4,-4,4,4,'axes'=>[0,0],'grid'=>[8,8]); - -($fRef,$fpRef,$fppRef) = plot_functions( $graph, - $f,$fp,$fpp - ); - -# create labels - -$label_point=-0.75; -$label_f = new Label ( $label_point,&{$fRef->rule}($label_point),$sa[0],"$sc[0]",'left') ; - # NOTE: $fRef->rule is a reference to the subroutine which calculates the - # function. It was defined in the output of plot_functions. It is used here - # to calculate the y value of the label corresponding to the function, - # and below to find the y values for the labels corresponding to the - # first and second derivatives. - -$label_fp = new Label ( $label_point,&{$fpRef->rule}($label_point),$sa[1],"$sc[1]",'left') ; -$label_fpp = new Label ( $label_point,&{$fppRef->rule}($label_point),$sa[2],"$sc[2]",'left'); - -# insert the labels into the graph - -$graph->lb($label_f,$label_fp,$label_fpp); - -BEGIN_TEXT -\{ image(insertGraph($graph))\}$BR -Identify the graphs A (blue), B( red) and C (green) as the graphs of a function and its -derivatives:$PAR -\{ans_rule(4)\} is the graph of the function $PAR -\{ans_rule(4)\} is the graph of the function's first derivative $PAR -\{ans_rule(4)\} is the graph of the function's second derivative $PAR -END_TEXT -ANS(std_str_cmp_list( @sa ) ); - -ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/courses.dist/modelCourse/templates/setDemo/paperHeaderFile1.pg b/courses.dist/modelCourse/templates/setDemo/paperHeaderFile1.pg deleted file mode 100644 index 1b9210ae6e..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/paperHeaderFile1.pg +++ /dev/null @@ -1,27 +0,0 @@ -##Problem set header for set 0, Spring 1999 - -&DOCUMENT; - -loadMacros( -"PG.pl", -"PGbasicmacros.pl", -"PGchoicemacros.pl", -"PGanswermacros.pl" -); - -TEXT(EV2(<srand($newProblemSeed); -BEGIN_TEXT -To see a different version of the problem change -the problem seed and press the 'Submit Answer' button below.$PAR Problem Seed: -\{ MODES( -TeX => qq! Change the problem seed to change the problem:$problemSeed!, -Latex2HTML => qq! Change the problem seed to change the problem: - \begin{rawhtml} - - \end{rawhtml}!, -HTML => qq! ! -) -\} -END_TEXT -######################################################### -# define function to be evaluated -$a= random(1,3,1); -$b= random(-4,4,.1); -$c = random(-4,4,1); -$x0=random(-2,2,1); -$function = FEQ(" ${a}x^2+${b}x +$c "); -sub fp { # define a subroutine to calculate the derivative - my $x = shift; - 2*$a*$x+$b; -} -$ans = fp($x0); -HEADER_TEXT(< - - - - - - -EOF - -TEXT(MODES( -TeX => '', -Latex2HTML => "\begin{rawhtml} \end{rawhtml}", -HTML => "" -)); - -BEGIN_TEXT -$PAR -This problem illustrates how you can embed JavaScript code in a WeBWorK example -to create an interactive homework problem that could never be provided by a text book. -$PAR -WeBWorK can use existing $BBOLD JavaScript$EBOLD and $BBOLD Java $EBOLD code to augment its capabilities. -$HR -$PAR -By typing any value x into the left hand window and pressing the --f--\(>\) button -you can determine the value of f(x). -$PAR -Using this 'oracle' function, calculate the derivative of \( f \) at x=$x0. -$PAR -\(f'($x0) =\) \{ans_rule(20) \} You can use a -\{htmlLink(alias('calc.html'), "calculator" ,q!TARGET = "calculator"!) \} - -$PAR -END_TEXT - -$javaScript =< - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - -
- - - - - -
- - -ENDOFSCRIPT - -TEXT(M3( - " \fbox{ The java Script calculator was displayed here - }", - "\begin{rawhtml} $javaScript \end{rawhtml}", - $javaScript - )); - - - -ANS(std_num_cmp($ans,1,"%0.14g") ); #We are allowing 1 percent error for the answer. - - -&ENDDOCUMENT; - diff --git a/courses.dist/modelCourse/templates/setDemo/prob6b.pg b/courses.dist/modelCourse/templates/setDemo/prob6b.pg deleted file mode 100644 index 60cc2f3e5f..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/prob6b.pg +++ /dev/null @@ -1,86 +0,0 @@ -DOCUMENT(); - -loadMacros("PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", -); -#<<<######################################################### -# allow the student to change the seed for this problem. - -$newProblemSeed = ( defined( ${$inputs_ref}{'newProblemSeed'} ) )? -${$inputs_ref}{'newProblemSeed'} : $problemSeed; -$PG_random_generator->srand($newProblemSeed); -BEGIN_TEXT -To see a different version of the problem change -the problem seed and press the 'Submit Answer' button below.$PAR Problem Seed: -\{ MODES( -TeX => qq! Change the problem seed to change the problem:$problemSeed!, -Latex2HTML => qq! Change the problem seed to change the problem: - \begin{rawhtml} - - \end{rawhtml}!, -HTML => qq! ! -) -\} -END_TEXT -#########################################################>>> -$p = random(2,9,1); # multiplier -$p2 = ( $p % 2 == 0) ? 2*$p : $p; - -# The link to the java applet is hard wired to use the java applet -# served from the University of Rochester WeBWorK machine. -# It is possible to set this up so that the java applet is served -# from any machine -# For details use the Feedback button to contact the authors of WeBWorK - -BEGIN_TEXT -This problem requires a browser capable of running Java. - -$PAR -This problem illustrates how you can Java applets in a WeBWorK example. -$PAR -This polar coordinate grapher was constructed at the Mathematics Department -of The Johns Hopkins University and the applet is being served from their computer. -$PAR -WeBWorK can use existing $BBOLD JavaScript$EBOLD and $BBOLD Java $EBOLD code to -augment its capabilities. -$HR -END_TEXT -TEXT(MODES( -TeX => "\fbox{The Johns Hopkins University Mathematics Department's - polar graph plotting applet goes here}", -HTML => qq{ - - - - - - -}, -Latex2HTML => qq!\begin{rawhtml} - - - - - - \end{rawhtml} -! -)); - -BEGIN_TEXT -$PAR -For what value of \( k \) does the graph of \( r = \cos(kt) \) look -like a rose with $p2 petals? -$BR -\(k = \) \{ ans_rule(20) \} ; - -$PAR - -END_TEXT - -ANS(num_cmp($p) ); - -ENDDOCUMENT(); - diff --git a/courses.dist/modelCourse/templates/setDemo/s2_2_1.pg b/courses.dist/modelCourse/templates/setDemo/s2_2_1.pg deleted file mode 100644 index b01f44e3e6..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/s2_2_1.pg +++ /dev/null @@ -1,53 +0,0 @@ -##DESCRIPTION -##KEYWORDS('derivatives') -## Find a derivative of a polynomial, evaluate it at a point -##ENDDESCRIPTION - -DOCUMENT(); # This should be the first executable line in the problem. -loadMacros( - "PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", - "PGauxiliaryFunctions.pl" -); - -$showPartialCorrectAnswers = 1; - -$a1 = random(2,7,1); -$b1 = random(2,12,1); -$c1 = random(1,40,1); -$x1 = random(1,5,1); -$deriv1 = 2*$a1*$x1-$b1; -$funct1 = "2*$a1*x-$b1"; - -BEGIN_TEXT -If \( f(x) = $a1 x^2 - $b1 x -$c1 \), find \( f'( x ) \). -$BR $BR \{ans_rule(48) \} -$BR $BR -END_TEXT - -$ans = $funct1; -&ANS(fun_cmp($ans)); - -$a1_2 = 2*$a1; - -BEGIN_TEXT -Find \( f'( $x1 ) \). -$BR $BR \{ans_rule(48) \} -$BR $BR -END_TEXT - -$ans = $deriv1; -&ANS(num_cmp($ans)); - -&SOLUTION(EV3(<<'EOT')); -$SOL $BR -In general the derivative of \( x^n \) is \( nx^{n-1} \). Using this (and the -basic sum and constant multiple rules) we find the derivative of $BR -\(${a1}x^2 - ${b1}x -$c1 \quad \) is $BR \( ${a1_2}x - $b1 \).$BR $BR - -To find the derivative at \($x1\) we just have to evaluate \( f'( x ) \) at -\( x = $x1) \), i.e. \( ${a1_2}\cdot$x1 - $b1 \) or $ans. -EOT - -ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/courses.dist/modelCourse/templates/setDemo/sample_myown_ans.pg b/courses.dist/modelCourse/templates/setDemo/sample_myown_ans.pg deleted file mode 100644 index 3b7da75f8f..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/sample_myown_ans.pg +++ /dev/null @@ -1,85 +0,0 @@ -DOCUMENT(); - -loadMacros( - "PGbasicmacros.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl" -); - -$showPartialCorrectAnswers = 1; - -BEGIN_TEXT - This problem demonstrates how you can write your own procedure to check answers. - The procedure is embedded right in the problem. If you wanted to use it for several - problems, you could put it in a file similar to "PGanswermacros.pl" and load it into - the problem. - - This problem asks you to enter a palindrome, a word, number, or phrase that is the same - when read backwards or forward. For example, madam or Hannah. For us a standard - palindrome will ignore spaces and case, but a strict palindrome will not. So e.g. Hannah - is a standard but not a strict palindrome. We will write a test for both types. $BR $BR - Enter a standard palindrome such as "Hannah", "1234321", or "Mom". $BR - This uses std${US}palindrome${US}test $BR - \{ans_rule(60) \} -END_TEXT - - -$std_palindrome_test = sub { - my $in = shift @_; - my $normalizedCorrectAnswer = "There are many correct answers, e.g. Hannah"; - $in =~ s|~~s+||g; # remove all spaces - ## use ~~ inplace of perl's backslash in problems - $in = uc $in; # Make letters uppercase - ## use ~~ inplace of perl's backslash in problems - my $reverse = reverse $in; - my $correctQ = ($in eq $reverse) ? 1: 0; - my $ansMsg = ''; - unless ($in =~ m|~~S|) { - $correctQ = 0; - $ansMsg = 'An empty string is not accepted as a palindrome'; - } - my $rh_answer = new AnswerHash( score => $correctQ, - correct_ans => $normalizedCorrectAnswer, - student_ans => $in, - ans_message => $ansMsg, - type => 'custom' - ); - $rh_answer; - -}; - -ANS($std_palindrome_test); - - -BEGIN_TEXT; -$PAR -Now enter a strict palindrome such as "1234321", or "mom". $BR -This uses strict${US}palindrome${US}test $BR -\{ans_rule(60) \} -END_TEXT - -$strict_palindrome_test = sub { - my $in = shift @_; - my $normalizedCorrectAnswer = "There are many correct answers, e.g. HannaH"; - $in =~ s/~~s*$//; # remove trailing whitespace ## use ~~ inplace of perl's backslash in problems - $in =~ s/^~~s*//; # remove initial spaces ## use ~~ inplace of perl's backslash in problems - my $reverse = reverse $in; - my $correctQ = ($in eq $reverse) ? 1: 0; - my $ansMsg = ''; - unless ($in =~ m|~~S|) { - $correctQ = 0; - $ansMsg = 'An empty string is not accepted as a palindrome'; - } - - my $rh_answer = {score => $correctQ, - correct_ans => $normalizedCorrectAnswer, - student_ans => $in, - ans_message => $ansMsg, - type => 'custom' - }; - $rh_answer; -}; - -ANS($strict_palindrome_test); - -ENDDOCUMENT(); diff --git a/courses.dist/modelCourse/templates/setDemo/sample_units_ans.pg b/courses.dist/modelCourse/templates/setDemo/sample_units_ans.pg deleted file mode 100644 index a72a70a5a9..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/sample_units_ans.pg +++ /dev/null @@ -1,38 +0,0 @@ -DOCUMENT(); -loadMacros( "PGbasicmacros.pl", - "PGauxiliaryFunctions.pl", - "PGchoicemacros.pl", - "PGanswermacros.pl", -); - -$showPartialCorrectAnswers = 1; -$showHint =0; - -$fx = random( 2.1, 6.0 , 0.1) ; -$fy = random( 3.1, 8.0 , 0.1) ; -$ansxy = sqrt($fx * $fx + $fy * $fy); -$anscm = $ansxy*100; - -BEGIN_TEXT -This problem demonstrates how WeBWorK handles -numerical answers involving units. WeBWorK can handle all units that -are used in elementary physics courses. -See \{ htmlLink("http://webwork.maa.org/wiki/Units","answers with units") \} -for more details. $PAR - -Two perpendicular sides of a triangle are $fx m and -$fy m long respectively. -What is the length of the third side of the triangle? $BR$BR -You can answer this in terms of m's, cm's, km's, in's, ft, etc. but you must enter the units. $BR$BR -Click "Hint" below if you don't remember the Pythagorean theorem. -$BR$BR -\{ans_rule(40) \} -END_TEXT - -HINT(EV3(<<'EOT')); -Remembering the Pythagorean theorem \( A^2 +B^2 = C^2 \), you can enter -sqrt(${fx}${CARET}2 + ${fy}${CARET}2) m or \{spf($ansxy, "%0.2f" )\} m or \{spf($anscm, "%0.2f" )\} cm or ... -EOT - -ANS(num_cmp("$ansxy", units => 'm')); -ENDDOCUMENT() diff --git a/courses.dist/modelCourse/templates/setDemo/screenHeaderFile1.pg b/courses.dist/modelCourse/templates/setDemo/screenHeaderFile1.pg deleted file mode 100644 index a4a9dec9d6..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/screenHeaderFile1.pg +++ /dev/null @@ -1,77 +0,0 @@ -##Screen set header for set 0, Fall 1998 - -&DOCUMENT; - -loadMacros( -"PG.pl", -"PGbasicmacros.pl", -"PGchoicemacros.pl", -"PGanswermacros.pl" -); - - - -BEGIN_TEXT -This is a demonstration set designed to illustrate the range of types of questions which can be asked using WeBWorK rather than to illustrate a typical calculus problem set. - -$PAR -$BBOLD 1. Simple numerical problem. $EBOLD A simple problem requiring a numerical answer. It illustrates how one can allow WeBWorK to calculate answers from formulas (e.g. an answer such as sqrt(3^2 +4^2) can be entered instead of the answer 5.). It also shows -an example of feedback on the correctness of each answer, rather than grading the entire problem. -$PAR -$BBOLD 2. Graphs and limits. $EBOLD The graph in this example is constructed on the fly. From the graph a student is supposed to determine the values and limits of the function at various points. The immediate feedback on this problem is particularly useful, since students often make unconscious mistakes. -$PAR -$BBOLD 3. Derivatives. $EBOLD An example of checking answers which are formulas, rather than numbers. -$PAR -$BBOLD 4. Anti-derivatives. $EBOLD This example will accept any anti-derivative, adjusting for the fact that the answer is only defined up to a constant. -$PAR -$BBOLD 5. Answers with units. $EBOLD Try entering the answer to this question in meters (m) and also centimeters (cm). -$PAR -$BBOLD 6. A physics example. $EBOLD Includes a static picture. -$PAR -$BBOLD 7. More graphics. $EBOLD An example of on-the-fly graphics. Select the graph of f, it's derivative and it's second derivatives. -$PAR -$BBOLD 8. JavaScript example. $EBOLD I'm particularly fond of this example. The computer provides an "oracle" function: give it a number \(x\) and it will provide you with the value \(f(x)\) of the function at \(x\). Using this, calculate the value of the derivative of \(f\) at 2. (i.e. \(f'(2)\) ). Students are forced to use the Newton quotient, since there are no formulas to work with. I don't think this problem could be asked as written homework. -$PAR -$BBOLD 9. Java example. $EBOLD This gives an example of incorporating a java applet which can be used experimentally to determine answers for WeBWorK questions. This example is of historical interest since it comes from the first site after Rochester, Johns Hopkins University, to use WeBWorK. It currently gives an example of what happens when a WeBWorK problem called an applet residing on a server that no longer exists. -$PAR -$BBOLD 10. Palindrome. $EBOLD To answer this problem enter any palindrome. This problem illustrates the power of the "answer-evaluator" model. For each problem the problem designer writes a function which accepts a student's answer and produces a 0 or 1 (for incorrect or correct). Usually this is done by comparing with an answer given by the problem designer, but in this case the function checks if the answer is the same forward and backward. -$PAR -END_TEXT - - - -BEGIN_TEXT -$HR - -Use this box to give information about this problem -set. Typical information might include some of these facts: -$PAR -WeBWorK assignment number $setNumber closes on : $formattedDueDate. - - -$PAR -The primary purpose of WeBWorK is to let you know if you are getting the right answer or to alert -you if you get the wrong answer. Usually you can attempt a problem as many times as you want before -the close date. However, if you are having trouble figuring out your error, you should -consult the book, or ask a fellow student, one of the TA's or -your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. -$PAR - -You can use the Feedback button on each problem -page to send email to the professors. -$PAR -Give 4 or 5 significant digits for (floating point) numerical answers. -For most problems when entering numerical answers, you can if you wish -enter elementary expressions such as 2^3 instead of 8, sin(3*pi/2) instead -of -1, e^(ln(2)) instead of 2, -(2+tan(3))*(4-sin(5))^6-7/8 instead of 27620.3413, etc. -$PAR - Here's the -\{ htmlLink(qq!http://webwork.maa.org/wiki/Available_Functions!,"list of the functions") \} - which WeBWorK understands. - -Along with the \{htmlLink(qq!http://webwork.maa.org/wiki/Units!, "list of units")\} which WeBWorK understands. This can be useful in -physics problems. -END_TEXT - -ENDDOCUMENT(); diff --git a/courses.dist/modelCourse/templates/setDemo/srw1_9_4.pg b/courses.dist/modelCourse/templates/setDemo/srw1_9_4.pg deleted file mode 100644 index c4c663dcda..0000000000 --- a/courses.dist/modelCourse/templates/setDemo/srw1_9_4.pg +++ /dev/null @@ -1,110 +0,0 @@ -##DESCRIPTION -## find distance between two points, find coordinates of the midpoint of -## a line segment connecting them -##ENDDESCRIPTION - -##KEYWORDS('algebra', 'coordinate geometry', 'distance', 'midpoint') - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( -"PG.pl", -"PGbasicmacros.pl", -"PGchoicemacros.pl", -"PGanswermacros.pl", -"PGauxiliaryFunctions.pl" -); - -$showPartialCorrectAnswers = 1; - -#install_problem_grader(~~&std_problem_grader); ##uncomment to use std grader -#install_problem_grader(~~&custom_problem_grader); ##uncomment to use custom grader - - -$x1 = random(1,5,1); -$y1 = random(-5,-1,1); -$x2 = random(-10,-3,1); -$y2 = random(-9,-2,1); -$len1 = sqrt(($x1-$x2)**2 + ($y1-$y2)**2); -$midx = ($x1+$x2)/2; -$midy = ($y1+$y2)/2; - -BEGIN_TEXT -Consider the two points \( ($x1 ,$y1 )\) and \( ($x2 ,$y2 )\). -The distance between them is:$BR -\{ans_rule(30) \} -$BR -END_TEXT - -$ans = $len1; -&ANS(std_num_cmp($ans)); - -BEGIN_TEXT -The x co-ordinate of the midpoint of the line -segment that joins them is:\{ans_rule(20) \} -$BR -END_TEXT -$ans = $midx; -&ANS(std_num_cmp($ans)); - -BEGIN_TEXT -The y co-ordinate of the midpoint of the line segment that joins them is: -\{ans_rule(20) \} -$BR -END_TEXT -$ans = $midy; -&ANS(std_num_cmp($ans)); - - -sub custom_problem_grader { - my $rh_evaluated_answers = shift; - my $rh_problem_state = shift; - my %form_options = @_; - my %evaluated_answers = %{$rh_evaluated_answers}; - # The hash $rh_evaluated_answers typically contains: - # 'answer1' => 34, 'answer2'=> 'Mozart', etc. - - # By default the old problem state is simply passed back out again. - my %problem_state = %$rh_problem_state; - - - # %form_options might include - # The user login name - # The permission level of the user - # The studentLogin name for this psvn. - # Whether the form is asking for a refresh or is submitting a new answer. - - # initial setup of the answer - my $total=0; - my %problem_result = ( score => 0, - errors => '', - type => 'custom_problem_grader', - msg => 'Part 1 is worth 50% and parts 2 and 3 are worth 25% each.', - ); - - # Return unless answers have been submitted - unless ($form_options{answers_submitted} == 1) { - return(~~%problem_result,~~%problem_state); - } - # Answers have been submitted -- process them. - - $total += .5*($evaluated_answers{'AnSwEr1'}->{score}); - $total += .25*($evaluated_answers{'AnSwEr2'}->{score}); - $total += .25*($evaluated_answers{'AnSwEr3'}->{score}); - - - $problem_result{score} = $total; - # increase recorded score if the current score is greater. - $problem_state{recorded_score} = $problem_result{score} if $problem_result{score} > $problem_state{recorded_score}; - - - $problem_state{num_of_correct_ans}++ if $total == 1; - $problem_state{num_of_incorrect_ans}++ if $total < 1 ; - (~~%problem_result, ~~%problem_state); - -} - - -ENDDOCUMENT(); # This should be the last executable line in the problem. - -