Hello,

I want to pose quesitons to my students such as "Remove
surds from the denominator of \(\frac{3+\sqrt{2}}{\sqrt{8}-\sqrt{2}}\)". I
want STACK to recognize \(\frac{1}{2} \cdot (3 \cdot \sqrt{2}+2)\) and \(\frac{3 \cdot \sqrt{2} +2}{2}\) as correct answers. When I use AlgEquiv
test, the initial fraction \(\frac{3+\sqrt{2}}{\sqrt{8}-\sqrt{2}}\) will
be a correct answer, but when I use EqualComAss or CasEqual, only \(\frac{3 \cdot \sqrt{2} +2}{2}\) will be accepted as the correct answer
(even if I put \(\frac{1}{2} \cdot (3 \cdot \sqrt{2}+2)\) in the prt).

Is
there a possibility to get both simplified fractions as correct answer
but not the inital fraction or some semi-simplified fraction?

### STACK - Remove surds from denominator

Number of replies: 5### Re: STACK - Remove surds from denominator

Martin,

Yes, but this is a new features in STACK 4.1 which I released yesterday!

This code is what you are looking for:https://github.com/maths/moodle-qtype_stack/blob/master/stack/maxima/assessment.mac#L253

If you have STACK 4.1, then it will be available to you as a teacher. The reason for returning a list of offending items is that you can use it to give feedback to your students. E.g. "please remove the following from the denominators of fractions: ....".

Also, the algebraic input and the new numerical input type (https://stack2.maths.ed.ac.uk/demo/question/type/stack/doc/doc.php/Authoring/Numerical_input.md) allow teachers to reject expressions with surds in the denominator as *invalid*. Later on you can prevent x/sqrt(2) as invalid, just as floats and 2/4 can be rejected. This, of course, is a choice which would be silly in your example since that is what you are testing! But the option is new.

I don't have Maxima code to take \( \frac{3+\sqrt{2}}{\sqrt{8}-\sqrt{2}} \) and re-write it in an equivalent rationalized form. That might be a fun for anyone looking for a holiday project.

Chris

### Re: STACK - Remove surds from denominator

Thanks for the quick response. I will ask our moodle admins to install STACK 4.1

### Re: STACK - Remove surds from denominator

Dear Chris,

I have tried the new numerical input type with the option rationalized. Then the input \(\frac{3+\sqrt{2}}{\sqrt{8}-\sqrt{2}} \) gets rejected, as required, but the input \( \frac{(3+\sqrt{2}) \cdot (\sqrt{8} + \sqrt{2})}{8-2} \) will be viewed as a correct answer.

Can you tell me which options I have to pick for the answer input and the prt such that only the final forms \( \frac{1}{2} \cdot (3 \cdot \sqrt{2} + 2) \) and \(\frac{3 \cdot \sqrt{2}+2}{2} \) will be accepted?

Best

Martin

### Re: STACK - Remove surds from denominator

Thanks for your interest and for letting me know the option in the new numerical input is working.

To assess this I would use the "EqualComAss" test to test equivalence up to commutativity and associativity. However, more than one such test is needed since we get the following result:

ATEqualComAss((1/2)*(3*sqrt(2)+2), (3*sqrt(2)+2)/2) = [0, "ATEqualComAss: (AlgEquiv:true)."];

That is to say, under this test \(\frac{1}{2} \cdot (3 \cdot \sqrt{2} + 2)\) and \( \frac{3 \cdot \sqrt{2}+2}{2} \) are considered to be different! Attached is a sample question. I hope this helps?

Chris

### Re: STACK - Remove surds from denominator

Thank you, that works.

Is there a particular reason for node 1 and the AlgEquiv test? I guess we should get the same result without node 1, since if ans1 passes one of the EqualComAss tests of nodes 2,3,4 it also passes the AlgEquiv test of node 1?