Stack with Solve

Stack with Solve

av Stuart Jones -
Antal svar: 4

Hello,


I have been playing with Stack and I'm pretty certain I'll be using it this year for my class, as it's amazingly useful and flexible. However, one problem I've ran into is how to make the Answer Tests work with the Solve command. For example, if the question is to solve a quadratic equation, and the answer is [x=3, x=-1], it says it's incorrect if you type [x=-1,x=3]. I thought maybe the ComAss test would work, but it doesn't. Is there an easy straightforward way for stack to handle this? 

Medeltalet av utvärderingarna: -
Som svar till Stuart Jones

Re: Stack with Solve

av Christopher Sangwin -
Bild av Particularly helpful Moodlers Bild av Plugin developers


The first thing to say is that I almost never use "solve".  In general it is far better to start with the solutions, and reverse engineer the question.  I guess these are roots to a quadratic?  I'd start with integers and then create the appropriate equation.  Having the two roots as numbers you can then work much more flexibly.

In this case, solve return a *list* which is ordered.  If you don't want order you can turn the object into a set.  The following Maxima code might come in useful:

l1:[x=-1,x=-3];
l2:maplist(rhs,l1);
s:setify(l2);

If you'd like to do this to the student's answer you can put commands which depend on the input name (e.g. ans1) into the *feedback variables* before you apply an answer test.

I documented a number of related issues here: https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Equations.md

Chris




Medeltalet av utvärderingarna:Useful (1)
Som svar till Christopher Sangwin

Re: Stack with Solve

av Stuart Jones -

Very helpful, thanks. That's actually a great idea to start with the answers and reverse-engineer the question. Essentially something like this?


m : 1 + rand(9);

n : 1 + rand (9);

p : expand((x-m)*(x+n));

Or something along those lines. And just I'd just add a couple more variables for rational (instead of integer) solutions. 


I find it interesting to use the list components, and that might be useful at times, but I think your advice about starting with the answers and reversing it will be a lot more useful in practice.

Medeltalet av utvärderingarna: -
Som svar till Stuart Jones

Re: Stack with Solve

av Christopher Sangwin -
Bild av Particularly helpful Moodlers Bild av Plugin developers

Yes Stuart,

This is exactly what I meant.  If you want *different positive* roots you can always do something like

m : 1+rand(4);
n : m+1+rand (3);
p : expand((x-m)*(x-n));
There are lots of "tricks of the trade" like this.  Can I ask for your help?  Please could you keep a diary of "things I'd wish I'd known"?  I'd really value this as I forget what new users need, and when.  Any suggestions for improving the docs is very welcome indeed.  

Chris



Medeltalet av utvärderingarna: -