Forums

Search results: 133

For your first example, the usual approach is to use a list for part (b) so that the student enters the solutions as a comma-separated list of complex numbers. This is easier to code in a number of ways, and it can automatically provide the student with some hints about what is wrong (these can be controlled by the problem author). So I'd stick with that approach there.

For your second example, it would be possible to do that using a multi-part (sometimes referred to as a "compound") problem. This is an advanced technique that will not be covered in detail in this workshop. The tools for doing this are still actively being developed.

One option that doesn't require multi-part problems would be to allow the student to enter the array in a single large rectangle either using the MathObject matrix notation (brackets around comma-separated entries for the rows, with rows separated by commas and enclosed in brackets), or as an array of numbers separated by spaces and newlines that you turn into an array by hand within a custom answer checker. The latter would require a little extra work, but is probably preferable.

Here's one version that might do what you need:

    loadMacros("contextArbitraryString.pl");
    
    Context("ArbitraryString");
    
    $A = Matrix([1,2,3],[4,5,6]);
    
    Context()->texStrings;
    BEGIN_TEXT
    \($A\) = \(\Bigg[\) \{ans_box(4,12)\} \(\Biggr]\)
    END_TEXT
    Context()->normalStrings;
    
    ANS(Compute("1 2 3~~n4 5 6")->cmp(checker => sub {
      my ($correct,$student,$ans) = @_;
      my $M = $student->value;
      $M =~ s/  +/ /g;                                 # remove multiple spaces
      $M =~ s/(~~n|^) /~~1/g; $M =~ s/ (~~n|$)/~~1/g;  # remove leading and trailing spaces
      $M =~ s/~~n~~n+/~~n/g;                           # remove blank lines
      $M =~ s/^~~n+//; $M =~ s/~~n+$//;                # remove leading and trailing blank lines
      my @M = map {[split(/ /,$_)]} split(/~~n/,$M);   # break into an array of arrays
      $M = Matrix(@M);                                 # form MathObject matrix
      $ans->{preview_latex_string} = $M->TeX;          # format the answer preview
      $ans->{correct_ans_latex_string} = $A->TeX;      # format the correct answer 
      return $A == $M;                                 # check the answers
    }));
You can paste this into the Interactive Problem Lab to see how it works (or insert it into a problem file ad add the problem to a set). The main idea is that you get the student's answer as a string and then manipulate that string to form a MathObject Matrix. That will already perform some error checking (like that the rows are the same length and that the entries are numbers).

In any case, this is a starting point for that type of answer.

I have been studying how to write a compound problem, and have found out that it might solve one of the difficulties I have been having. However, there is one minor nuisance with the way it's written.

Once the student answers the first part of the problem, and clicks on "Submit", the grading for the first part and the (as yet unanswered) second part appears. Is there a way to hide this box until after the student has completed the second part?

Attachment Screen_Shot.jpg

WeBWorK Problems -> compoundProblem.pl -> Re: compoundProblem.pl

by Ted Shifrin -
Hi, Mike. Sorry about the delay -- I had been expecting an email when there was a response. I think we last updated about 2 or 3 years ago; it's always a scary thing for our IT folks to update :) We're earlier than 2.7 for sure.

But please do send me the version you're using and let me try. If nothing else, it will give us impetus to upgrade in December when classes are over.

Thanks!!

WeBWorK Problems -> compoundProblem.pl -> Re: compoundProblem.pl

by Michael Gage -
Hi Ted,

What version of WeBWorK do you have now?  If you have webwork 2.7
I can send you the version of compoundProblems that I'm working on now
(and using it in my classes this semester) and you can help debug it. :-)
It works pretty well for the students but I'm still working on making it easier to
write the problems.

The version of WeBWorK is at the bottom of each page in small type if you are using version 2.6 or later.  If there is no version you are using 2.5 or earlier and my compoundProblems might or might not work for that.

-- Mike

WeBWorK Problems -> compoundProblem.pl

by Ted Shifrin -
Dear Mike, Davide, et al.:

Several years ago when you upgraded, compoundProblem.pl stopped working correctly and Mike gave me a klugy fix that allows me to continue using the problems I've authored. I am still having to tell students to erase the answers that appear in the next page's boxes and scoring is all messed up (although I do believe that the final score is right if someone gets 100%).

Any chance that this will get fixed before I retire (approximately a year from now) and want to bequeath you all my problems for multivariable and linear algebra? Or has it been fixed in the latest version and do we need to upgrade here at UGA?

Thanks!


WeBWorK Main Forum -> Designating Special Characters

by Spyro Roubos -
Hello,

I know there are special ways of writing certain characters that would otherwise confuse TeX or Perl like $DOLLAR for $ and $PERCENT for %.

I was wondering how complicated is it to add others.

I ask this because our textbook uses "~" as the negation symbol unfortunately, and this has very odd effects when passing it through an answer checker or even just writing is a non-TeXed string (like to have in a pop-up menu).  Since I'm attempting to use that in a pop-up menu, I don't have the option of just using \(\sim \).

My question is: Is there an easy way of designating special characters so that they're read just as they are and not as a command?

Or as a compromise, at least display the forbidden symbol in the "answer preview", meaning: it would say something like "neg. p" in the problem, yet display properly as "~p".

Thank you,
Spyro Roubos


Here is my problem below, what I'd like would be to have $np = "~p";

# DeMorgan's Rules

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

DOCUMENT();      

loadMacros(
   "PGstandard.pl",     # Standard macros for PG language
   "MathObjects.pl",
   "parserPopUp.pl",

   #"source.pl",        # allows code to be displayed on certain sites.
   #"PGcourse.pl",      # Customization file for the course
);


# Print problem number and point value (weight) for the problem
TEXT(beginproblem());

$showPartialCorrectAnswers = 1;


##############################################################
#
#  Setup
#
#
Context("Numeric");

$p = "p";   $np = "$neg. p";
$q = "q";   $nq = "neg. q";

$And = "˄";
$Or = "˅";
$Neg = "neg.";

$popup1 = PopUp(["?", $p, $np, $q, $nq], $p);
$popup2 = PopUp(["?", $And, $Or], $Or);
$popup3 = PopUp(["?", $p, $np, $q, $nq], $q);

$popup4 = PopUp(["?", " ", $Neg], $Neg);
$popup5 = PopUp(["?", $p, $np, $q, $nq], $np);
$popup6 = PopUp(["?", $And, $Or], $And);
$popup7 = PopUp(["?", $p, $np, $q, $nq], $nq);

##############################################################
#
#  Text
#
#

Context()->texStrings;
BEGIN_TEXT

Consider the compound statement: $BR $BR
Your satisfaction is guaranteed or you get your money back.
$BR $BR
Let $BBOLD \(p\) $EBOLD = "Your satisfaction is guaranteed" and $BBOLD \(q\) $EBOLD = "You get your money back".  Translate the compound statement into symbols using the drop-downs: 
$BR $BR
\{ $popup1->menu() \} \{ $popup2->menu() \} \{ $popup3->menu() \}
$BR

Rewrite this as an equivalent statement in symbols using DeMorgan's Rules: $BR $BR

\{ $popup4->menu() \} \(\big(\) \{ $popup5->menu() \} \{ $popup6->menu() \} \{ $popup7->menu() \} \(\big)\)

END_TEXT
Context()->normalStrings;

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

ANS( $popup1->cmp() );
ANS( $popup2->cmp() );
ANS( $popup3->cmp() );
ANS( $popup4->cmp() );
ANS( $popup5->cmp() );
ANS( $popup6->cmp() );
ANS( $popup7->cmp() );
 
ENDDOCUMENT();        

WeBWorK Main Forum -> Logic Context?

by Spyro Roubos -
Hello,

I'm creating problems for a Mathematical Logic homework set, and I'd like to have problems where students translate compound statements in English into symbolic form using given simple statements p, q, r.

Right now, (from other suggestions in the forum), I'm using string objects, overriding all error messages that might be confusing to students with either vague ones (like "This is incorrect") or more relevant ones.

I'm using /\ for "And", \/ for "Or", -> for "If/then", ~ for "Not".

Using the backslash in answers produces really odd results as I imagine this is messing with the parser.  It'll mark correct answers correct (happy about this), ..but it removes all backslashes from the student's answer and shows parts of their answer preview in red.

I'm wondering how doable making a simple logic parser would be with the symbols as above or if there's some special way of representing a backslash (like how $ is $DOLLAR).  A parser would be a lot nicer for the students (accepting spaces, ignoring extraneous parentheses, etc.).

Again, I want to reiterate, the problem 'works'.. it just has odd results I'd like to avoid if possible.

I've put the coding of my problem below.

Thank you,
Spyro Roubos

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

# Write the following statement in Symbolic Notation - Decide on Parentheses

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

DOCUMENT();      

loadMacros(
   "PGstandard.pl",     # Standard macros for PG language
   "MathObjects.pl",
   "parserAutoStrings.pl"

   #"source.pl",        # allows code to be displayed on certain sites.
   #"PGcourse.pl",      # Customization file for the course
);


# Print problem number and point value (weight) for the problem
TEXT(beginproblem());

# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;


##############################################################
#
#  Setup
#
#
Context("Numeric");

Context()->strings->clear;
Context()->constants->clear;
Context()->variables->clear;
Context()->functions->clear;
Context()->operators->clear;
Context()->parens->clear;

Context()->{error}{msg}{"Variable '%s' is not defined in this context"} =
         "This is incorrect.";

Context()->{error}{msg}{"Unexpected character '%s'"} =
         "This is incorrect.";
    Context()->{error}{msg}{"'%s' is not defined in this context"} =
         "This is incorrect.";

AutoStrings();


$C1 = String("p\/(q/\r)");
$C2 = String("(p\/q)/\r");
$C3 = String("(p\/q)/\~r");
$C4 = String("~p/\~q");
$C5 = String("~(p/\q)");

##############################################################
#
#  Text
#
#

Context()->texStrings;
BEGIN_TEXT


Consider the following simple statements:
$BR $BR
p = "We need to do the laundry" $BR
q = "We need to go grocery shopping" $BR
r = "We need to stop for gas" $BR $BR

Represent the following compound statements using symbols.  Use the forward and back-slashes on your keyboard to make "And" and "Or".  The ~ is to the left of "1" on your keyboard.  Use -> for the "Conditional".  $BBOLD Do NOT use spaces in your answer here. $EBOLD  Use parentheses where appropriate.

$BR $BR

We need to do the laundry, or we need to go grocery shopping and we need to stop for gas.: \{ans_rule(30)\}

$BR $BR

We need to do the laundry or we need to go grocery shopping, and we need to stop for gas.: \{ans_rule(30)\}

$BR $BR

We need to do the laundry or we need to go grocery shopping, but we do not need to stop for gas.: \{ans_rule(30)\}

$BR $BR

We do not need to do the laundry and we do not need to go grocery shopping.: \{ans_rule(30)\}

$BR $BR

It's false that we need to do the laundry and we do need to go grocery shopping.: \{ans_rule(30)\}

END_TEXT
Context()->normalStrings;

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

ANS( $C1->cmp);
ANS( $C2->cmp);
ANS( $C3->cmp);
ANS( $C4->cmp);
ANS( $C5->cmp);


ENDDOCUMENT();        

WeBWorK Main Forum -> WeBWorK Release 2.7 is out!!!

by Michael Gage -
Hi,

The new version (WeBWorK-2.7) of WeBWorK has been merged into the "master" branch on github.com/openwebwork.  If you are already using version 2.6 from the master branch then updating from github will get the new software with the new features.  There are instructions and release notes at http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.7

WeBWorK-2.7 is what you should plan to be using for this coming fall.

For those using software from the SVN repository there are instructions for switching over safely. (The use of github makes it much easier to upgrade in the future and to back out to earlier versions if that is desired.) 

The separate branch release/2.7 in github.com/openwebwork has been completely merged into the master branch and is no longer needed. It will be removed shortly.  The same 2.7 software can now be obtained by "pulling" from the master branch.  

Within a few weeks we hope to have a new release candidate release/2.8.  We are building toward a significant overhaul of the instructor's user interface which will make it more web2.0 interactive.  The reports we hear so far are that the student interface already works well, even on tablets, so we will be more cautious about making changes on that aspect of  WeBWorK.

There are several initiatives this summer to reorganize the OpenProblemLibrary, to organize problems sets for modelCourses (Calc1, MultiVariableCalc, Statistics1, et.) and to create and improve problem types such as those using Sage interacts and "compound" or "progressive" problems which present questions sequentially.

Many features of this release have been developed at the code camps 
WeBWorK::Rochester, WeBWorK::Winona, WeBWorK::Fitchburg, WeBWorK::Raleigh, WeBWorK::AnnArbor. (see the blogs linked tohttp://webwork.maa.org/planet for news about camps and the features developed). Thanks to all those participants and to everyone else who has contributed to this new release.  Next planned code camp isWeBWorK::Vancouver.  Anyone interested in organizing, helping to organize, or participating in a code camp to work on WeBWorK projects please feel free step up, and to contact me (Mike Gage) if you wish help or advice.

Enjoy the new release.  I encourage those who helped build this release to continue to write blog posts describing the new features and how to use them. We'll also create more permanent "manual" pages on the wiki.

Take care,
Mike

You can respond to this post with comments and discussion. As always help with updating the wiki, blog posts or wiki pages containing tutorials or instructions on using particularly features are VERY welcome.  Thanks, everyone.

WeBWorK News -> WeBWorK Release 2.7 is out!!!

by Michael Gage -
Hi,

The new version (WeBWorK-2.7) of WeBWorK has been merged into the "master" branch on github.com/openwebwork.  If you are already using version 2.6 from the master branch then updating from github will get the new software with the new features.  There are instructions and release notes at http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.7

WeBWorK-2.7 is what you should plan to be using for this coming fall.

For those using software from the SVN repository there are instructions for switching over safely. (The use of github makes it much easier to upgrade in the future and to back out to earlier versions if that is desired.) 

The separate branch release/2.7 in github.com/openwebwork has been completely merged into the master branch and is no longer needed. It will be removed shortly.  The same 2.7 software can now be obtained by "pulling" from the master branch.  

Within a few weeks we hope to have a new release candidate release/2.8.  We are building toward a significant overhaul of the instructor's user interface which will make it more web2.0 interactive.  The reports we hear so far are that the student interface already works well, even on tablets, so we will be more cautious about making changes on that aspect of  WeBWorK.

There are several initiatives this summer to reorganize the OpenProblemLibrary, to organize problems sets for modelCourses (Calc1, MultiVariableCalc, Statistics1, et.) and to create and improve problem types such as those using Sage interacts and "compound" or "progressive" problems which present questions sequentially.

Many features of this release have been developed at the code camps 
WeBWorK::Rochester, WeBWorK::Winona, WeBWorK::Fitchburg, WeBWorK::Raleigh, WeBWorK::AnnArbor. (see the blogs linked to http://webwork.maa.org/planet for news about camps and the features developed). Thanks to all those participants and to everyone else who has contributed to this new release.  Next planned code camp is WeBWorK::Vancouver.  Anyone interested in organizing, helping to organize, or participating in a code camp to work on WeBWorK projects please feel free step up, and to contact me (Mike Gage) if you wish help or advice.

Enjoy the new release.  I encourage those who helped build this release to continue to write blog posts describing the new features and how to use them. We'll also create more permanent "manual" pages on the wiki.

Take care,
Mike