WeBWorK Problems
https://webwork.maa.org/moodle/mod/forum/view.php?f=3
The wiki and forum systems have changed encryption methods and some passwords need to be reset. If you can't login: first set (or reset) your password on the wiki (you can use the "forgot password" link). Make sure to complete the process to set a "new" permanent password. Then use that permanent password for moodle as well as the wiki.
Questions and comments related to WeBWorK problems, problem authoring, etc.Moodleen(c) 2020 WeBWorK: Online homework for math and sciencehttps://webwork.maa.org/moodle/theme/image.php/classic/core/1584125254/i/rsssitelogomoodle
https://webwork.maa.org/moodle
14035Re: Answer dependent on student response
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14784
Fri, 18 Sep 2020 17:26:37 GMTby Danny Glin. <p>MultiAnswer is set up to do exactly this sort of thing. As Glenn says you will have to write a custom answer checker to go with it.<br /><br />The wiki page on MultAnswer Problems should be helpful:<br /><a href="">https://webwork.maa.org/wiki/MultiAnswerProblems</a><br /><br /><br /></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14784Re: Answer dependent on student response
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14783
Fri, 18 Sep 2020 16:52:46 GMTby Glenn Rice. <p><p>This will definitely take a custom grader. There are several ways to achieve this. One is to use a MultiAnswer. Then you have access to the answers for all parts in the grader.</p><p>You can also store the answer evaluator (return by the cmp method of the object) of those answers in a variable that you can pass the ANS (or use in PGML). Then you can access the answer hash for those parts in later custom graders. This is the more complicated method, but can be more powerful.<br /></p></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14783Re: Answer dependent on student response
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14782
Fri, 18 Sep 2020 16:11:08 GMTby Joel Trussell. <p><p>Good questions with lots of applications. I'd be interested too. <br /></p></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14782Answer dependent on student response
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14778
Fri, 18 Sep 2020 12:23:12 GMTby Gregory Varner. <p><p>I am wondering if the following would be possible (it seems like it should be, but I am having trouble figuring out how to go about it).</p><p>I am working on regression where the students need to decide between several different options of what curve to use (for instance, linear, quadratic, exponential, logarithmic, and logistic curves).</p><p>I first want to accept potentially several of them as correct (I am thinking a custom checker that would return 1 if it is one of the possible answers but there is probably a better way). They will have to justify their answer elsewhere.</p><p>I would then want them to solve a question using the curve that they chose. So I would need something to the effect of</p><p>if($studentans1=linear, $ans2=......)</p><p>if($studentans1=quadratic, $ans2=....)</p><p>and so on.</p><p>Any suggestions on how I might go about this are appreciated. </p></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4903&parent=14778Re: Canvas to Webwork LTI re-setting student scores to zero.
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4689&parent=14768
Wed, 16 Sep 2020 15:38:57 GMTby D. Brian Walton. <p><div class="text_to_html">This is quite a late response, but what follows is my understanding of what is happening. WeBWorK does not keep track of which scores have been pushed to the LMS. Consequently, it pushes every grade for every student to Canvas, sending the percentage scored on the assignment. Canvas calculates a new score based on the product of the reported percentage and Canvas's points possible for the assignment. If the score is different than what is recorded, it updates the Canvas database and posts a notification. If the calculated score is the same, then there is no update required.<br /><br />
So if Canvas has changed the score to 0 based on the Extra Credit setting, then Canvas is being instructed on this grade push to set the scores to zero.</div></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4689&parent=14768Re: Controlling Simplifying in a Function
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14761
Tue, 15 Sep 2020 12:30:29 GMTby Gregory Varner. <p><p>That did it!</p><p>Thank you very much for your help. It looks like the problem was in my understanding.</p><p>Interestingly, I do not get the error code from "adding" x, though I do realize that x is already inherently defined so it is not necessary. </p></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14761Re: Controlling Simplifying in a Function
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14757
Mon, 14 Sep 2020 22:10:27 GMTby Alex Jordan. <p><div class="text_to_html">Hi Gregory,<br /><br />
This still has the same issues I mentioned in an earlier post:<br /><br />
> I think what you outline would work fine, but your code is not right. You don't want to make a "decoy" subroutine; you would make a "sin" subroutine in the "decoy" package. (Side note: "decoy" is maybe not the most apt name, but it's what I wrote quickly.) And so then you would not declare a "decoy" subroutine in main either. You'd only need to set the class of "sin" to "decoy" in the middle of the custom answer checker. And it is best practice to set it back (to "numeric") at the end of the answer checker, to keep the effects contained.<br /></div><div class="text_to_html"><br /></div><div class="text_to_html">Except it looks like I was confused for a bit there about whether this was to rewire "ln" or "sin".<br /></div><div class="text_to_html"><br />
Change:<br /><div style="margin-left:30px;" class="editor-indent">
package decoy;<br />
our @ISA = qw(Parser::Function::numeric);<br />
sub decoy {<br />
shift; my $x = shift;<br />
return CORE::sin($x)+pi**$x;<br />
}<br /></div><br />
To:<br /><div style="margin-left:30px;" class="editor-indent">
package decoy;<br />
our @ISA = qw(Parser::Function::numeric);<br />
sub ln {<br />
shift; my $x = shift;<br />
return CORE::sin($x)+pi**$x;<br />
}<br /></div><br />
And remove entirely:<br /><div style="margin-left:30px;" class="editor-indent">
# Make it work on formulas as well as numbers<br />
sub decoy {Parser::Function->call('decoy',@_)}<br /></div><br />
In the answer checker, change:<br /><div style="margin-left:30px;" class="editor-indent">
Context()->functions->set(<br />
ln => {class => 'ln',<br />
TeX => '\ln'}<br />
);<br /></div><br />
to:<br /><div style="margin-left:30px;" class="editor-indent">
Context()->functions->set(<br />
ln => {class => 'Parser::Function::numeric',<br />
TeX => '\ln'}<br />
);<br /></div><br />
Separately, when I tested just now, there is an error/warning from this line:<br /><div style="margin-left:30px;" class="editor-indent">
Context()->variables->add(x=>'Real',y=>'Real',z=>'Real');<br /></div>
which should be:<br /><div style="margin-left:30px;" class="editor-indent">
Context()->variables->are(x=>'Real',y=>'Real',z=>'Real');<br /></div>
since 'x' is already a variable. Or you could just do:<br /><div style="margin-left:30px;" class="editor-indent">
Context()->variables->add(y=>'Real',z=>'Real');<br /></div><br />
I made these changes and ran the problem. It accepted "12ln(x)-8ln(y)-12-10ln(z)" as correct, but gave the expected feedback for "12ln(x)-8ln(y)-12ln(e)-10ln(z)".</div></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14757Re: Controlling Simplifying in a Function
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14756
Mon, 14 Sep 2020 21:08:17 GMTby Gregory Varner. <p><p>I am sure that is me not understanding something about the way to define the package and switch them.</p><p>Trying to remove defining it inside of main kept giving me point evaluation errors.</p><p>I have tried a few different things under the #switch to decoy# and none of them seem to be working.</p><p><br /></p><p>I am guessing that it is my unfamiliarity with defining packages and working within them and it is probably something quite simple.</p><p><br /></p><p>DOCUMENT(); </p><p><br /></p><p>loadMacros(</p><p> "PGstandard.pl", # Standard macros for PG language</p><p> "MathObjects.pl",</p><p> "PGML.pl",</p><p> "answerHints.pl",</p><p> "PGML.pl",</p><p> "PGcourse.pl",</p><p> "parserFunction.pl",</p><p>);</p><p><br /></p><p># Print problem number and point value (weight) for the problem</p><p>TEXT(beginproblem());</p><p><br /></p><p># Show which answers are correct and which ones are incorrect</p><p>$showPartialCorrectAnswers = 1;</p><p>##############################################################</p><p>#</p><p># Setup</p><p>#</p><p>#</p><p>Context("Numeric")->flags->set(</p><p> reduceConstantFunctions=>0,</p><p> formatStudentAnswer=>'parsed',</p><p>);</p><p><br /></p><p>package decoy;</p><p>our @ISA = qw(Parser::Function::numeric);</p><p>sub decoy {</p><p> shift; my $x = shift;</p><p> return CORE::sin($x)+pi**$x;</p><p>}</p><p><br /></p><p>package main;</p><p># Make it work on formulas as well as numbers</p><p>sub decoy {Parser::Function->call('decoy',@_)}</p><p><br /></p><p>##y is ln(base1), z is ln(base2)</p><p>Context()->variables->add(x=>'Real',y=>'Real',z=>'Real');</p><p>Context()->variables->set(x=>{limits=>[2,3]},y=>{limits=>[2,3]},z=>{limits=>[2,3]});</p><p>$power1 = 3;</p><p>$power2 = -2;</p><p>$power3 = 3;</p><p>$power4a = 5;</p><p>$power4b = 2;</p><p>$power5 = 4;</p><p>$answer = Formula("$power5*$power1 * ln(x) + $power5*$power2 * ln(y) - $power5*$power3 - $power5*($power4a/$power4b)*ln(z)")->reduce;</p><p>Context()->operators->undefine("/","^","**");</p><p>$answercmp = $answer->cmp(</p><p> checker => sub {</p><p> my ($correct,$student,$ansHash) = @_;</p><p> # make sure $student is a Formula, not immediately converted to Real</p><p> $student = Formula($ansHash->{student_formula});</p><p> return 0 if ($correct != $student);</p><p> delete $correct->{test_values}, $student->{test_values};</p><p> # switch to decoy</p><p> Context()->functions->set(</p><p> ln => {class => 'decoy',</p><p> TeX => '\ln'}</p><p> );</p><p> if ($correct == $student) {</p><p> # clean up, then award credit</p><p> delete $correct->{test_values}, $student->{test_values};</p><p> Context()->functions->set(</p><p> ln => {class => 'ln',</p><p> TeX => '\ln'}</p><p> );</p><p> return 1;</p><p> } else {</p><p> Value::Error("Your answer is equivalent to the correct answer,</p><p> but not in the expected simplified form.");</p><p> }</p><p> }</p><p>);</p><p>##############################################################</p><p>#</p><p># Text</p><p>#</p><p>#</p><p>BEGIN_PGML</p><p>Expand the logarithm.</p><p>>> [`` \ln\left(\frac{x^{[$power1]}y^{[$power2]}}{e^{[$power3]}z^{[$power4a]/[$power4b]}}\right)^{[$power5]} ``] <<</p><p><br /></p><p>The expanded form is [_]{$answercmp}{40}</p><p>END_PGML</p><p><br /></p><p>##############################################################</p><p>#</p><p><br /></p><p><br /></p><p>ENDDOCUMENT(); </p></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14756Re: Controlling Simplifying in a Function
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14745
Mon, 14 Sep 2020 14:43:59 GMTby Alex Jordan. <p><p>Hi Gregory,</p><p>Could you post a small example? It could be something subtle and if I can see your whole problem file, it would be good to know about whatever that subtlety is.</p><p>Alex<br /></p></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14745Re: Controlling Simplifying in a Function
https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14744
Mon, 14 Sep 2020 13:57:17 GMTby Gregory Varner. <p><p>I must be incredibly dense. I am not getting your suggestion to work.</p><p>I tried defining the sin subroutine of the decoy package. I then attempted to set the class of sin to decoy, but I am having no luck in doing so. My problem runs fine, but it must not be switching over correct as it counts ln(e) correct, which is shouldn't.</p><p>Perhaps I am misunderstanding how to switch the class of sin to decoy. </p><p>Any help is of course appreciated.</p><p>Thank you</p></p>https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4893&parent=14744