1/3 as a periodic decimal fraction in stack

1/3 as a periodic decimal fraction in stack

by Björn Gerß -
Number of replies: 2

Hello,

I’m doing some exercises with pupils at the age of 12 in stack/moodle.

We are working on fractions. Is there a way to handle periodic decimal fractions in stack and maxima.

For example, are moddle, stack and maxima able to write numbers as 0,3 in the question or the student answer?

Best regards,

Björn


Average of ratings: -
In reply to Björn Gerß

Re: 1/3 as a periodic decimal fraction in stack

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Björn,
This is an interesting and important topic. The short answer is "no" we don't have code for this situation out of the box.

However, the flexibility of Maxima means you could create a function which supports this situation. E.g. a function 
recurring(n,m) which holds the non-recurring bit n and then the recurring bit m. More recent versions of STACK allow you to then deal with this with tex. Assuming you are happy with the recurring bit as an integer you would do

texput(recurring, lambda([ex], sconcat(tex1(first(ex)),".\\bar{",tex1(second(ex)),"}") ));

 Then, in the PRT you can define the function "recurring" as a rational expression, i.e.

recurring(n,m) := block([k], k:1+floor(float(log(m)/log(10))), n+m/10^k);

You probably want a more flexible situation in which you can do more, so your display function becomes

texput(recurring, lambda([ex],if integerp(first(ex)) then sconcat(tex1(first(ex)),".\\bar{",tex1(second(ex)),"}") else sconcat(tex1(first(ex)),"\\bar{",tex1(second(ex)),"}") ));

  This is, of course, all untested. I hope this gives you a pointer as to how you could define a Maxima function to represent a recurring decimal, and (a) display it, and (b) evaluate the function later in terms of the rational number it represents. The input side of things is more difficult. We have ambitious plans to enable teachers to have much more flexible input options, to either interpret students' input or combine two boxes (start and recurring bit) into a single value to show the student "your answer is ...." For now input is somewhat fixed. Anyway, I hope this gives you some idea of what would need to be done.
Average of ratings: Useful (1)
In reply to Christopher Sangwin

Re: 1/3 as a periodic decimal fraction in stack

by Björn Gerß -
Hi Chris,
thanks for the answer.
I will try to set up some questions. The students will have to enter the fraction, for a given periodic decimal fraction.