Saturday, 23 July 2016

Using jsxgraph to create a triangle in moodle

Below is a the diagram shown in my introductory post.
It also, incidentally, proves that jsxgraph can create diagrams in blogger.
I have left the delimiters on. They are used by moodle to filter the variables through the question type and mathjax so that the display has a maths look.
 In this instance the question type is formulas but this setup will work in calculated question type which has the same ability to pass variables into question text. Again in this instance, that would be OK as a single answer is prompted for.
In a later post I propose to look at the jsxgraph functions and/or modules used in this construction.


Not to scale.

`PQR` is an isosceles triangle, `PQ=PR`.

Friday, 22 July 2016

Why?

After several years of dabbling in Moodle, I have learnt a huge amount and know that there is far more to learn still.

The biggest issue I have come up against has been how to handle Mathematics in E-learning. There are different types of problems depending on whether the aim is to accept Mathematical input or display output. I will be concentrating on output, that is getting the LMS to display questions in a more media-rich way.

Displaying is relatively straightforward when creating questions as there are various filters ranging from latex, asciimathsml to the Mathjax. Some of these nowadays can optimize for the output device. Of course there are others but these are the ones I have used/explored before and of which I have some experience.

I have also explored using dynamic diagrams in questions. This arose because I did not want to create images which would, more often than not, be large and eat up bandwidth. My biggest headache though when using images was that I could not back-up/copy questions retaining the images. This is quite aside from the inadequacy of images which could not be labeled dynamically, meaning that if they were used that on one static question could be created. That meant I would have to replicate images and adjust the image-based labels if I wanted to create more questions of the same type. Come moodle 2, I stumbled on the use of "div" to place labels. At once this meant that I could create one instance of a question but allow the label to vary by introducing a variable label within the question. For instance I could use a sketch of a triangle to find the missing angle by labeling the two others with a range of values, contrasting with the previous case where the given angles were part of the image and so could only contain one set of values and therefore only produce one static question. I could vary the given angle. For instance the range of values 30 degrees to 40 degrees could be displayed with the over the diagram. This was progress but it came with other problems, notably the browser/theme dependencies which meant that if I changed browsers or themes the labels would migrate unacceptably around the page. Of course the inability to copy/backup either of these questions remained and I had to find the optimal coordinates by trial and error.

When I searched I found reference to the same user experiences but not many solutions. Occasionally I did notice some explanations but only found extremely complex work-arounds rather than solutions.

While struggling with these issues encouragement came from the coordinate question type, later renamed formula. This is a very clever question type which allows question parts to be asked so that the different parts can be answered in the same question. This was a departure from single answer questions. Asciimathml filter and code allowed a dynamic java-script-based diagrams to be included in html pages. I could create a script which would draw a triangle by defining the vertices and I could insert text labels in the code to label the vertices and angles including variable values. At once this meant I could copy/backup the questions and not worry about the images. There was not separate image file stored somewhere to be linked to but a chunk of text within the question which would be carried around and interpreted with no need to ensure that the image location was defined the link verified. Provided the user browsed with particular browser they could see my images and not necessarily be able to tell that they were generated by a small piece of code.

Moodle though, moved on and outgrew asciimathml... Next it was jsxgraph up to the plate... Here is an example of a question I produced using formulas question type to randomize the data; and jsxgraph to insert the labels, including varying data on the diagram. No image needs to be stored. No link needs to be verified. Its all a chunk of text...

The next persisting problem is when reviewing completed quizzes. All the "div's" overlap so effectively only one question can be reviewed.

This is my next bit of learning. Before that, or preferably while learning, I am proposing to show some of the questions I have made.