Help for STACK question for simple algebra

Help for STACK question for simple algebra

by Philip Norton -
Number of replies: 11

Hi all,

I wonder if anyone can help me. I'm new to the STACK question type. A lot of the documentation jumps in at a fairly advanced level of algebra. However, I'm attempting to set up an introductory algebra quiz. 

I'm starting with a simple question: "simplify by gathering like terms".

Currently, my question variables are: 

aa:5-rand(10);
bb:5-rand(10);
cc:5-rand(10);
dd:5-rand(10);
ee:5-rand(10);
ff:5-rand(10);
v:rand([a,b,c]);
w:rand([a,b,c]);
x:rand([a,b,c,d]);
simp: false;
z:ev(aa*w,simp)+ev(bb*x,simp)+ev(cc*w,simp)+ev(dd*v,simp)+ev(ee*x,simp)+ev(ff*v,simp);

This, produces the required question, z, in my previews. The question text is:

Simplify the following expression: @z@

input:ans1
validation:ans1

However, because this is basic algebra, I'm focusing a lot on the format. I need to know that their answer is not only algebraically equivalent, but written in its simplest form. I don't want them to simply type in the question and get it correct.

The first node in my answer tree checks for algebraic equivalence and seems to be working as anticipated. However, once it is evaluated as algebraically equivalent, I need to ensure it is in simplest form. I don't seem to be able to get this to work. The check for "LowestTerms" always seems to indicate that it is, even if it is clearly not the case.

I've also tried to use the "nterms" function to count the terms, but it also seems to simplify the terms.

Any pointers on how to achieve this would be appreciated.

Average of ratings: -
In reply to Philip Norton

Re: Help for STACK question for simple algebra

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

" A lot of the documentation jumps in at a fairly advanced level of algebra"

I'd like to second that. I think the features of the question type would make it useful for a wide range purposes but I couldn't get past the first example.

In reply to Philip Norton

Re: Help for STACK question for simple algebra

by Hiram Bollaert -

And Philip

Did Tims suggestion help?

Can you share with us your current complete question setup?
I kind of am trying to do something likewise

thanks

Cheers
Hiram

In reply to Hiram Bollaert

Re: Help for STACK question for simple algebra

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There are lots of good examples in the STACK demo course.

If you look inside question/type/stack in your install, specifically you want samplequestions/STACK-demo.mbz. Restore that, then look through the sample quizzes and the question bank.

For example, the "6. Simplifying algebraic expressions (7)" category might hold some useful clues.


In reply to Tim Hunt

Re: Help for STACK question for simple algebra

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Thanks for that Tim, I found an example I understood from your tip.

In reply to Tim Hunt

Re: Help for STACK question for simple algebra

by Hiram Bollaert -

Thank you tim for the quick response

and I looked at the examples

but i'm trying to find the best way to test if students can simplify

$$ \frac{1}{c - d} - \frac{c}{c^2 - d^2} + \frac{1}{2 \times c + 2 \times d} $$

to

$$ \frac{1}{2 \times (c - d)} $$

And with best way I mean:

- how to set up the variables

- minimize the use of latex in the question text

- how to set up the PRT checking if students just retyped the orginal algebraic expression, gave a algebraic correct expression in the form of one fraction, or gave the smallest form of the expression (which can vary in some exercises)

Currently I end up with a lot of trial and error...

In reply to Hiram Bollaert

Re: Help for STACK question for simple algebra

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hiram,

This is *exactly* what STACK is designed to do. I've included question variables as follows:

p1:1/(c-d)
p2:-c/(c^2-d^2)
p3:1/(2*c+2*d)
p:p1+p2+p3
ta:ratsimp(p)

This is probably more complex than you need...

The question text is then just

Write \[@p@\] in single fraction form. [ [input:ans1] ] [ [validation:ans1] ]

The input just has "ta" as the correct answer.

The potential response tree uses a single node to test for the correct answer with the "Single fraction" answer test.  The property you are trying to establish is that the student's answer is equivalent to the teacher's expression, and in the "single fraction" form.  That is exactly what this test is designed to do.

If you want to also check the student's answer is in lowest terms, then this is a separate property.  Add another node and check that the numerator and denominator have no common factor, this can be done with

ATAlgEquiv(gcd(num(ans1),denom(ans1)),1)

Writing this question has taken me about 20 mins (including writing the automatic testing!). I've exported and posted my question here: http://www.maths.ed.ac.uk/~csangwin/stack/2016-2-19-Hiram.xml

I hope this helps.

Chris


In reply to Christopher Sangwin

Re: Help for STACK question for simple algebra

by Hiram Bollaert -

Splendid Chris

I will test your suggestion thoroughly, running all answers student come up with smile

Especially the "gcd(num(ans1),denom(ans1))" part is a new angle for me.

Thanks a lot
Cheers
Hiram

In reply to Christopher Sangwin

Re: Help for STACK question for simple algebra

by Hiram Bollaert -

Ah Chris

(2*c+2*d-2*c+c-d)/(2*(c-d)*(c+d)) is considered correct, although I find 1/(2*(c-d)) a "better" (=simpler) answer.

(students tend to be lazy and minimize their work smile)

Sorry to drag on, but do you have another 10 mins for me smile

cheers
Hiram

In reply to Hiram Bollaert

Re: Help for STACK question for simple algebra

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok,

This is easy as well.  In the PRT switch "Auto-simplify" to "No".  This means that expressions in the numerator will not be automatically gathered by Maxima's default simplification.

You try see this on a desktop version of Maxima:

p:(2*c+2*d-2*c+c-d)/(2*(c-d)*(c+d));
simp:false
p:(2*c+2*d-2*c+c-d)/(2*(c-d)*(c+d));

I probably should have thought of that first time round as well.....

Chris


In reply to Christopher Sangwin

Re: Help for STACK question for simple algebra

by Hiram Bollaert -

Indeed Chris
This actually does the trick

thanks

cheers
Hiram