## Question types: Formulas question type

qtype_formulas
Maintained by Jean-Michel Védrine
This is a question type plugin for Moodle with random values and multiple answer fields.
380 sites
23 fans
Moodle 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4

This is a question type plugin for Moodle with random values and multiple answer fields.

The answer fields can be placed anywhere in the question so that we can create questions involving various answer structures such as coordinate, polynomial and matrix.

Other features such as unit checking and multiple subquestions are also available.

These functionalities can simplify the creation of questions in many fields related to mathematics, numbers and units, such as physics and engineering.

### Contributors

hon wai lau: Original creator

### Awards

• Wed, 3 Dec 2014, 7:46 PM
Hi Jean-Michel. Thanks for sharing yet another excellent piece of work. I was able to successfully test the functionality of some
samples provided. Some notes collected during the code review:

Documentation on creating formulas question would really help. Hopefully it's something you can ask the users community to help
with. In the styles.css file, some CSS selectors might be defined more strictly to make sure they apply to the given question type
only. See core question types for some good examples of it (typically using appropriate .que prefix etc).

The variables.php defines some functions in the global PHP scope. It is generally considered as a bad practise due to eventual
collisions. You may wish to encapsulate those as static methods of some correctly prefixed/named class.

I am happy to see both moodle1 and moodle2 backup formats supported, as well as included unit tests. I am sure this question type
will soon find a solid user base. Good luck with maintaining it, and thanks for your patience with the review and approval process.
You are cleared to land now, welcome to the Plugins directory!
• Mon, 8 Dec 2014, 10:11 AM
Hi Jean Michel,

Documentation page started at https://docs.moodle.org/28/en/Formulas_question_type . Please feel free to add or correct as needed.
• Mon, 19 Oct 2015, 2:20 AM
Hi Jean Michel,

It has been reported that there are some problems in the answer fields length, we have made some changes at css file and it seems to display correcty.
http://benedu2.net/styles.css
After making the changes you will need to clear caches at
• Tue, 29 Nov 2016, 8:25 PM
Hi Jean Michel,

Thank you for this great question type.

One question that I could not solve: Is it possible to use the random variable system inside \TeX notation?

Example:
Random variables: A = {2,3,4,5}; B = {2,3,5}
Question Text: Simplify that radical: $$\sqrt{ {=A*A*B} }$$

Obviouly, \TeX is overriding the variable system function. Is there any way to have the calculation been done first?

Best, Wolfram
• Tue, 29 Nov 2016, 8:54 PM
Hello,
I am now retired and I don't even have a Moodle website with the formula question type installed, but what you says is very surprising to me because I have done tons of formulas questions with TeX formulas involving formulas variables with no problem because the calculations are done on the server before the webpage is served to the client and TeX rendering is done on the client side (I was using MathJax which is standard in latest Moodle versions) so I think the calculation is always done before TeX rendering
And even if you are not using the MathJax filter (for instance if you are using a filter where teX formulas are replaced by images) I think that unless Moodle code has changed a lot since I left Moodle development, any TeX filter will always modify the page content after the formulas questions has done all the calculations. So I am puzzled by your report.
• Tue, 29 Nov 2016, 8:56 PM
If I can find some time I will install the latest Moodle release and install the formulas question type to see if I can reproduce the problem. It will remember me of "the good old time" when I was a teacher
• Mon, 3 Apr 2017, 4:08 PM
Dear Jean-Michel, I would be very glad if you would extended your plugin for the most recent Moodle.
• Tue, 4 Apr 2017, 7:39 PM
Hello Miro,
As I said in a previous message I am now retired. When I retired about a year ago, I was expecting that even if I don't use Moodle anymore I would be able to continue to maintain this plugin, but unfortunately it's a too big job to stay in touch with all Moodle evolutions. I am sad to report that most probably there will be no new version from me and I will put this plugin in the "seeking for adoption" list.
• Sun, 9 Apr 2017, 10:52 AM
Hello Miro,

I agree with Jean-Michel that this plugin may need a new maintainer. When I leave my previous job, I am glad that he was able to take the maintenance, for more than five years. I have found that it is quite tough to maintain it while I am not using it myself.

The question engine evolves slowly so constant communication with the official team may be required to change the related codes. For a new version, re-running on many existing questions (that I don't have now) is needed to make sure things work. It may not be a lot of work, but continuous participation is needed. A good candidate may be a user with programming background like what Jean-Michel did. I might be able to provide some supports for the things not related to the interface with Moodle question engine.
• Sun, 9 Apr 2017, 11:02 AM
I should also mention that my old documentation have been ported here recently, thanks to Dominique Bauer
https://docs.moodle.org/29/en/Formulas_question_documentation

I am not sure why I cannot find the directly link in this moodle website.
• Tue, 3 Oct 2017, 11:19 PM
Hello Jean, first I must thank you for the long you keep this project up. It helped me a lot. I would like to know about this "adoption". Just a few moments ago the moodle administrator here in my institution reported a possible incompatibility of the Formula types question with another plug-in. He suspects it is due to incompatibility of Formula Type question with Moodle 3.3.1. If you can just point me out some directions, maybe I can see what I can do to keep the project alive, or at least contribute in some way.
Again, thanks for the work you already did.
• Mon, 9 Oct 2017, 4:28 PM
First, you will need to understand what the problem is and the error messages. Then, you may locate the codes with the problem. You may ask the developers of the question engine for helps. Each upgrade have minor changes that may break the some plugins. There is a need for constant maintenance to change a small part of the code to make it work again. Or, you may help the documentations.
• Sat, 13 Jan 2018, 1:26 AM
Hi Jean-Michel, is there a way to ignore spaces AND to have math symbols such as * % in one answer ?
For example I'd like to write : M ← (N * 2) % 4 (with left arrow, asterisk and modulo).
Either in Formula or Algebra.
Thank you.
• Tue, 6 Feb 2018, 3:58 PM
An presentation decides if the peruser will keep on reading the essay further. Specialists at Essay writing Service offering essay writing service can help you influence first experience with section alluring so it picks up consideration and individuals appreciate understanding it. Without an appealing presentation, your essay will stay of low quality paying little heed to how great the substance is.
• Tue, 13 Feb 2018, 10:35 PM
I am so happy to receive this article and good information. The information you have shared both on this page and on other pages of your site is very useful for my site of Friv games that I have just created. I hope you have many useful articles to share with all of us from whom we can learn. Surely I will come back to read your future articles. Great Moodle!