WeBWorK Problems

Inequalities with two variables in answers?

Inequalities with two variables in answers?

by Paul Seeburger -
Number of replies: 11

I am trying to write a series of problems for multivariable calculus that ask the student to enter the domain and range of a function of two variables.

The range is no problem as it uses interval notation, but the domain is harder since I want my students to use set-builder notation.  For example, f(x, y) = (x+y)/(x-y) would have

domain: { (x, y) : x <> y } and range (-inf, inf).

f(x, y) = arcsin(y - x) would have

domain: { (x, y) : x - 1 <= y <= x + 1 } and range [-pi/2, pi/2].

Ideally I would love to be able to require students to enter the whole set-builder notation, but for now I would be happy if I could check only the condition involving an inequality in two variables.

Is there any way to do this?  Perhaps if I were to write my own checker?  Or would I need to create a whole new Context?

Has anyone worked on this?  It would be useful also in algebra when we solve linear inequalities in two variables or absolute value inequalities, etc.

This is something I AM able to do with MyMathLab, Pearson's commercial online homework system.

Thanks!

Paul

Edit:  I found a way to do this that seems to work, but it is using the older answer checkers.  See below:

$domain = "x-1 <= y <= x+1";
ANS( str_cmp($domain,'remove_whitespace'));

I suppose this should even work with the whole set-builder notation. But is there a better way to do this kind of thing using a MathObject?

Paul

In reply to Paul Seeburger

Re: Inequalities with two variables in answers?

by Davide Cervone -
Ideally I would love to be able to require students to enter the whole set-builder notation, but for now I would be happy if I could check only the condition involving an inequality in two variables.

Is there any way to do this?

WeBWorK doesn't currently have a way to do this. It's inequality notation is basically an alternative for describing intervals, so they must have a variable on one side and a number on the other. They are not general inequalities of multiple variables.

It would be possible to extend the current inequalities context to make them work with a variable on one side and a formula (in other variables) on the other, so you could get things like x-1 <= y <= x+1, or y < x^2+ 1 but not y - 1 < x^2 or x^2 + y^2 < 10.

I do not know a reasonable (numerical) way to check a student answer for something like x^2 + y^2 < 10 in general. The crucial values are where x^2 + y^2 = 10, and this is a level set, which is notoriously hard to work with numerically, especially when the level set has singularities.

One possibility would be to use Newton's method to find a bunch of solutions to the equality and make sure the student answer also has those as solutions, and then check a bunch of random points to see that the signs match for student and professor's answers. But the numerics for this are pretty delicate.

The parserImplicitEquation.pl does something like this for equalities like x^2 + y^2 = 10, so that could be a starting point, but it is not a particularly reliable macro package, so I would be hesitant about that. But people are using it, so perhaps it would work for you.

Do you have any suggestions about how such an answer could be checked numerically in a reliable way?

Perhaps if I were to write my own checker? Or would I need to create a whole new Context?

An answer checker is not going to be enough, since you also need to extend the context to allow the inequalities, so that means writing your own context. And that is not as easy as I would like it to be.

To handle set-builder notation would also require a new context. But without a reliable way to test multi-variable inequalities, I don't think it is work the effort.

About using string comparisons for this, you are aware, of course, that this means the student must enter the answer in exactly the format you did, and that means correct answers will be marked incorrect. E.g., if you have { (x,y) : y < 2x + 1 } and the student writes { (x,y) : y < 2*x + 1 } or { (x,y) : y < 1 + 2x } then they will be marked incorrect.

Personally, I think that is worse that rewriting the question to use the mathematical tools that you have available. For example, give them "{ (x,y) : y < [_________] }" where they have to fill in the blank with a formula. I know it doesn't force them to write the set themselves, but I would rather they be marked correct when they write the correct formula in an unexpected way than be forced to write set notation with the formula in a particular order.

I don't like string checking for such answers for this reason, and would not recommend that approach.
In reply to Davide Cervone

Re: Inequalities with two variables in answers?

by Paul Seeburger -

Thank you for your detailed response, Davide!

I can see that there are a lot of issues to consider here that I had not anticipated.

I think an improved inequalities macro would be quite useful in a variety of topics.  Of course the domain of a function of two variables is one.

Can the current inequalities context handle compound inequalities like the following?

2x + 1 <= -5 or 2x + 1 >= 5

Hopefully it can.  I would like to port some problems I have written for MyMathLab over to WebWork someday to help students step through the process of solving absolute value inequalities.

In the meantime though, I will try my hand at using the contextArbitraryString.pl macro that you told me how to use in your response to my other post.

You said:

It would be possible to extend the current inequalities context to make them work with a variable on one side and a formula (in other variables) on the other, so you could get things like x-1 <= y <= x+1, or y < x^2+ 1

Would it be difficult to do this?  Is this automatically acceptable to the inequalities context?  I am guessing not.  What would it involve to try to extend it to handle these possibilities?  That would help with some of my examples.

Now, concerning the issue of multiple ways to represent the correct answer condition.

I stress the importance of making the form of this condition as clear as possible, and although I certainly would accept

 { (x,y) : y < 2*x + 1 } for  { (x,y) : y < 2x + 1 }

I would not want to accept

{ (x,y) : y + 2x < 1 }

which will not work anyway right now.  =)  Ideally I would want to be able to give a hint to make the condition more clear by isolating y.

I hesitate still to use: "{ (x,y) : y < [_________] }"  since it seems to lead them way more than I want to in this kind of problem. 

There is so much variety in the types of conditions that arise in this context.  I want them to be able to identify whether the clearest condition can be obtained by isolating (solving for) y, by putting the inequality in circle form, ellipse form, hyperbola form, or perhaps just leaving it in its original form (e.g., xy > 0).

Thanks again, Davide!

Paul

In reply to Paul Seeburger

Re: Inequalities with two variables in answers?

by Davide Cervone -
Can the current inequalities context handle compound inequalities like the following?

    2x + 1 <= -5 or 2x + 1 >= 5

The inequalities context currently requires a variable on one side and a number on the other. So it would not accept 2x+1 <= -5; you would have to enter x <= -3. But you can enter things like

    x <= -3 or x >= 2
(which is implemented as a union of intervals internally).
You said:
It would be possible to extend the current inequalities context to make them work with a variable on one side and a formula (in other variables) on the other, so you could get things like x-1 <= y <= x+1, or y < x^2+ 1

Would it be difficult to do this?

With the limitation that you must have a variable on one side and a formula (that doesn't include that variable) on the other, it can be done with some changes to the current context. But it means you would have to enter y < x^2 + 1 not y - 1 < x^2, a restriction that I don't like.

Is this automatically acceptable to the inequalities context?
No, as you suspected.

What would it involve to try to extend it to handle these possibilities?
It is not something that someone not familiar with the internal details of contexts would want to attempt. The inequalities context is a particularly complicated one, and not the place to begin with modifications to contexts. In any case, I have most of the work done already (as an experiment to see if it could be done).
In reply to Davide Cervone

Re: Inequalities with two variables in answers?

by Paul Seeburger -

Thanks so much for your replies, Davide!

I had asked:

Can the current inequalities context handle compound inequalities like the following?

 2x + 1 <= -5 or 2x + 1 >= 5 

You answered:

The inequalities context currently requires a variable on one side and a number on the other. So it would not accept 2x+1 <= -5; you would have to enter x <= -3. But you can enter things like

 x <= -3 or x >= 2 

(which is implemented as a union of intervals internally).

This seems to be a case where the equivalent answers are not being accepted yet, even when there is only one variable.  Is this correct?

It would be great to have the ability to grade the statement above as the correct way to rewrite |2x + 1| >= 5 without absolute value symbols, but I would really want to require the form shown, i.e., accepting either

2x + 1 <= -5 or 2x + 1 >= 5

or

2x + 1 >= 5 or 2x + 1 <= -5

My hope is to guide students through the steps I require them to show on paper to solve these absolute value inequalities in my intermediate algebra class (as I currently do in MyMathLab with a series of problems I designed there).

Hopefully this makes sense, and hopefully there will be an acceptable way to do this.  It appears to me that the contextArbitraryString.pl you told me about may well allow me to do this, although as you point out, it is not yet the ideal solution.

Thanks again, Davide!

Paul


In reply to Paul Seeburger

Re: Inequalities with two variables in answers?

by Davide Cervone -
This seems to be a case where the equivalent answers are not being accepted yet, even when there is only one variable. Is this correct?
You are correct that this does not allow the equivalent answers. But there are two important features that affect this: first, it is easy to say what the required format is (a variable on one side and a number on the other), so the question can tell you what is required, and the context reports the problem if you enter something that isn't in that form. (The original requirement for the inequality context was to describe intervals, not do to general inequalities.)

What bothers me about your approach is that I don't see a reasonable way to describe the required form ("clearest" or "simplest" form isn't precise enough) so that a student is clear about what is acceptable and what isn't, and that your techniques aren't going to tell him. The difference between the forms that you accept and those that you don't are going to see arbitrary.

Which of 44 different forms for y = (1+3x)/2 in our other discussion should be acceptable? There are more that I didn't include, as well. So how do you describe the form you are willing to accept, and how do you guide the student to that form?

You say you accept

    2x + 1 <= -5 or 2x + 1 >= 5
or
    2x + 1 >= 5 or 2x + 1 <= -5
but what about
    -5 >= 2x + 1 or 2x + 1 >= 5
or
    -5 >= 2x + 1 or 5 <= 2x + 1
or
    1 + 2x <= -5 or 1 + 2x >= 5
or any of a multitude of other permutations. And if not, why not?

It appears to me that the contextArbitraryString.pl you told me about may well allow me to do this, although as you point out, it is not yet the ideal solution.
Very far from ideal, in my opinion. But I guess I've said enough about that, so am not going to continue the thread any further.
In reply to Davide Cervone

Re: Inequalities with two variables in answers?

by Paul Seeburger -
Thanks, Davide!

For this question, I would like to accept any of the options you listed above, but I would want the student to not yet simplify the answer, so I can grade them as they complete the steps (and provide some feedback along the way as to how they are doing).

Let me give an example of what I am trying to do in a number of different problem types.

This problem will be scaffolded to help them through the process of solving it using the particular method I require my students to show on paper. I already do this in MyMathLab and it works quite well. The requirements in MyMathLab are very similar to what I have to work with using contextArbitraryString.pl, but actually in WebWork I can provide a lot of helpful guidance and feedback I could not do in MyMathLab.

Ex. | 2x + 1 | >= 5

1. They would choose the best statement of four including the correct answer:

"The value of 2x + 1 is 5 or more units from 0 on the number line."

2. They would then need to select the correct number line graph representation of this statement from a multiple choice list of generated numberlines.

3. Then they would be asked to use the numberline reference graph to rewrite the absolute inequality without absolute value symbols. This is where I would need the above mentioned expression to be graded. That is:

2x + 1 <= -5 or 2x + 1 >= 5

In MyMathLab, I have been pretty strict about this form, but I can see that in WebWork I can actually allow a lot more possibilities as long as I list them carefully.

4. Then I would ask the student to solve this inequality and enter the correct simplified version in set-builder notation provided for them:

x <= -3 or x >= 2

WebWork Interval context would accept this last answer, correct?

I may still use my own checker here though, since I ask my students to enter this sort of condition so that it reads from left to right on the numberline.

I hope this scaffolding/tutorial approach I am trying to use to develop new problems in WebWork makes some sense.

Thanks again, Davide! I do understand where you are coming from on this and I appreciate your help!

Paul
In reply to Paul Seeburger

Re: Inequalities with two variables in answers?

by Davide Cervone -
4. ... WebWork Interval context would accept this last answer, correct?

No, but the Inequalities context would.
In reply to Paul Seeburger

Re: Inequalities with two variables in answers?

by D. Brian Walton -
Paul,

I have been thinking about problems of a similar nature, in that I want students to "work through" problems rather than just give an answer. One such a problem was to require students to compute a limit "step-by-step" where they needed to specify a particular limit rule. Each step must be either (1) an elementary limit (e.g., limit of a constant or limit of a power of x) or (2) an arithmetic combination of a limit (e.g., sum, difference, product, quotient) of formulas whose limits had previously been computed.

The answer checker was a complex multi-answer checker that could only verify if each line satisfied the requirements specified and applied the rules appropriately and that ultimately answered the question of interest as the last step. It could not check if the student avoided unnecessary extra steps, only if every step was logically valid.

The instructions for the students was also quite lengthy and involved a javascript popup window to explain how to indicate how the student was to specify which rules were being used. Most students still seemed to require an explanation in class as well to use such a problem.

I have been thinking that a better approach, if it really had to be done, was to create a javascript shell that actually implemented a nicer interface and enforced logical rules and then simply reported some type of summary to WeBWorK for validation that the problem was completed correctly. I have not yet tried such a thing.

Anyway, there seem to be ways to impose a structure on WeBWorK to implement these types of problems, but they are fairly challenging and not the foundational philosophy that WeBWorK is built on.

- Brian

In reply to D. Brian Walton

Re: Inequalities with two variables in answers?

by Paul Seeburger -

Thanks, Brian!

What is the foundational philosophy that WebWork is built on?  (at least as it pertains to this idea of helping students learn the steps as well as the answers to solving problems)  I assumed the basic philosophy is to help students learn mathematics through practice of meaningful and varied example problems.

I don't see this approach to be too difficult to implement for many types of problems.  What you described with limits would certainly be much more difficult, but the example I described above concerning absolute value inequalities I already successfully implemented in MyMathLab (with improved student success on tests), and now that I am creating problems in WebWork, I am finding that it will actually be much easier to do this kind of thing here, once I figure out some of the basic techniques and coding issues.

Since we require our students to show clear work on tests and graded worksheets, and we tell them that we are grading their work, not their answers only, I think we really need to find a better way to evaluate and train our students in online homework systems than to just ask for final answers.

For example, I don't think there is much value in asking students to solve word problems in WebWork, if all we ask for is a numerical answer.  We should ask for some sort of indication of a correct set-up or variable definition, a correct equation if possible, and certainly units on their answer whenever appropriate.

In Calculus, I don't see much use in asking students to evaluate definite integrals in WebWork if we are just asking for the numerical answer AND we don't even care if it is the exact answer.  Most students will just use their calculator to approximate the integral rather than using any real calculus to work it out.  In definite integrals, I believe we need to at least ask them for the antiderivative expression to make the problem more meaningful in this context.  I also believe we should always ask for the exact answer to definite integrals.  Is there something that would cause this to be a problem?

We are training our students to solve problems in a particular way by the way we ask our questions and by the answers we accept as correct.  Students will almost always tend toward the method that gives them a correct answer with the least amount of time and thought.

I expect you agree with me on much of this, but I am curious if this idea has been discussed already in the WebWork community.

Thanks again, Brian!

Paul

In reply to Paul Seeburger

Re: Inequalities with two variables in answers?

by D. Brian Walton -
Paul,

I agree with what you said. My point was more along the lines that WeBWorK is not very designed to check student's thinking process, which is what I was presuming from your original example regarding the absolute value inequality.

My interpretation of the WeBWorK philosophy is that it is designed to have students submit answers that are well-defined mathematical objects (numbers, formulas, intervals, etc.) and compare that to a pre-calculated (either predetermined or algorithmically generated) and give a student Yes/No answers on the correctness of that answer.

Furthermore, the underlying machinery is designed in a way to allow the student to enter the answer in a much more flexible way than providing a list of approved answers. Any answer that is mathematically correct is supposed to be acceptable. Special contexts were later created to facilitate certain conditions such as requiring simplified polynomials or to exclude the use of various functions.

Your example with the absolute value inequality is problematic because the student's answer is a class of mathematical object that has not yet been implemented (i.e., a logical statement with free variables). However, it is composed of elements that are implemented.

For example, if you were to construct a problem that involved multiple parts, you could ask for the student to fill in the blanks:
[------](expression) >= [---](number) and/or(popup-list) [------](expression) < [---](number)
This allows the student to construct the statement you were desiring, but the structure of the problem imposes the form.

I implemented some similar problems based on rewriting expressions involving absolute value as piecewise formulas, similar to the following form (hopefully the forum reformatting doesn't make this unreadable):

|x^2-5x| = { [-----](formula) if x >= [-----](number)
{ [-----](formula) if x <= [-----](number)

Along the lines of what you were discussing, this could be extended to include an earlier step:

|x^2-5x| = { [-----](formula) if [-----](formula) >= 0
{ [-----](formula) if [-----](formula) < 0

Such problems make it so that you are only checking the formulas, not the inequality itself.

My experience with these problems suggest that students do not pay attention to the structure of the problem as it is presented on WeBWorK. They are only focused on finding the formula/answer that goes in the answer box. I'm not sure that WeBWorK can teach students to practice the metacognition required to think at this higher level.

- Brian

In reply to Paul Seeburger

Re: Inequalities with two variables in answers?

by Davide Cervone -
I stress the importance of making the form of this condition as clear as possible, and although I certainly would accept

   { (x,y) : y < 2*x + 1 } for  { (x,y) : y < 2x + 1 }
I would not want to accept

  { (x,y) : y + 2x < 1 }
I wouldn't want to accept that either, but I would want to accept
  { (x,y) : y - 2x < 1 }
which describes the same set. :-)

I understand your desire, but "clear" is subjective. While you might think that breaking down the relationship between x and y (a two-dimensional view) is the clearest, it might be clearer to me to think of when a certain multivariable function is below a certain value (a three-dimensional view). Unless you are very explicit (in the problem) about how your answer is to be expressed, I think you are asking for trouble to try to restrict the form of the answer that you accept.

For example, if you simply ask for the domain of the function and accept { (x,y) : y < 2x + 1 } but not { (x,y) : y - 2x < 1 }, then as a student I would be pretty upset. After all, these are the same sets. If there is some other information you are after (e.g., the particular format of an inequality), then perhaps you should not be asking about the set, but about that inequality.

I hesitate still to use: "{ (x,y) : y < [_________] }" since it seems to lead them way more than I want to in this kind of problem.
Yes, I understand that. But since you have to be clear about the form you want anyway, and are going to give them a hint when they don't do this, I don't understand the pedagogical value in having them possibly enter sets that are correct and forcing them to rewrite them in another form.

The reason I suggested this form was not because I didn't think it would be nice to have them write the set-buildner notation, but because this is a way to get the problem you want right now with the tools available. It is a way that works, that gives appropriate feedback, and that marks correct answers correct and incorrect answers incorrect. That is not going to be the case for your string-based checking (see our other conversation about string checking).