Formulas question type

Formulas question type

by hon wai lau -
Number of replies: 152

Hi all, I have recently made few improvements over my old question type, in particular, you can make complex questions using multiple answer boxes:

This is a question type plugin for Moodle that allows multiple subquestions and random values. Also, answer boxes can be placed anywhere so that it provides an intuitive way to create questions involving complex structure such as coordinate, polynomial and matrix. This functionality is especially useful for making questions in the field of physics, mathematics and engineering.

Details can be found here and it can be downloaded here . Note that the new name for this question type is called formulas.

Feel free to leave comments here.

HonWai

Average of ratings: Useful (2)
In reply to hon wai lau

Re: Formulas question type

by mana mboh -

Thanks for the plugin.  I've been trying to develop Maths questions and was struggling some until I found the  coordinates question. I guess 'Thanks' doesn't express it.

just one quick question as I don't want to go into the entrails of my server without proper understanding: in your instructions for installing formalas 1.0 you mention 'drop the data table' before installing. Could you be more specific. For instance, what is the filename of the data table? And do you just mean delete it?

I have found a bunch of mdl*coordinate* and mdl*formulas* files. Would these be the ones you are referring to?

Thanks in advance

mana

In reply to mana mboh

Re: Formulas question type

by hon wai lau -

Hi, mana

I am glad to know that someone find my previous question type useful.

Assuming you have installed the files of coordinate-0.8, you do NOT need to delete anythings in order to use the new question types. You can just leave those database table there. Though these two question types are not compatible (that is you cannot use both question types at the same time), but you can reuse all questions by export and reimport using the step written in the ChangeLog (just updated).

Basically, you need to export the questions when only coordinates/ folder presents, and import those questions when only formulas/ folder presents. You can always use back you coordinates question by moving the coordinates/ folder back there.

Anyway, it is strongly recommended that you try the import in a test server first because there is some changes that is not compatible, as written in the ChangeLog. Also, do not forget to backup you database.

HonWai

In reply to hon wai lau

Re: Formulas question type

by Maria Asuncion Montes -

Hi I'm Asuncion:I just installed the formula question in my moodle plataform. But I can´'t use the placeholder as the tutorial show. Please tell me what I'm doing wrong

Input:

Thanks

P.S Please I'm doing my quiz I need your tool

In reply to Maria Asuncion Montes

Re: Formulas question type

by mana mboh -

Hi Asuncion ,

May I suggest you post an example of the questions you've tried to create, someone will be able to spot what the error is.

Screen print or the text would do

Thanks

Mana

In reply to hon wai lau

Re: Formulas question type

by Steve Turley -

Thank you for your wonderful work on this.  It is just what I need!

Are you planning on upgrading this so it will work with Moodle 2.0?

In reply to Steve Turley

Re: Formulas question type

by hon wai lau -

Thanks for the interest. smile

I will upgrade it to work in moodle 2.0. It is easy, but need some testings. I should have time to do it after the start of the next semester.

In reply to hon wai lau

Re: Formulas question type

by Tabitha Parker (was Roder) -

Have you started work on upgrading to Moodle 2.0? We have possibly got someone to test for you.

In reply to Tabitha Parker (was Roder)

Re: Formulas question type

by Philipp Jovanovic -

I'm also very interested in an updated for Moodle 2.0! Are there any news about that?

In reply to Philipp Jovanovic

Re: Formulas question type

by hon wai lau -

Hi,

Thanks for the interest. I have just finished the work for this semester, so I have some times to work on it. I will first merge the improvement I made so far for our course. Then I will port it to moodle 2.0.

Hon Wai, Lau
Research assistant, Phys dept, HKUST

In reply to hon wai lau

Re: Formulas question type

by Lev Abramov -

Hi!

Plz don't take this for a nudge - but we are really breathlessly awaiting this plugin ported for Moodle 2. Any progress? smile

Yours -

Lev

In reply to hon wai lau

Re: Formulas question type

by Matt Yamamoto -

Hi All-

I'm having an issue with the export/import or backup/restore functionality in Moodle with the formulas questions. 

I have a need to move questions from one Moodle installation to another.  Both Moodle installations are at 1.9.12.  When I try to use a Moodle XML file for export I get the following error on import:

Could not insert quiz record in database question_formulas_answers! (id=)

A similar issue occurs when I try to use the backup funcion within Moodle.

Any help?
Thanks

In reply to Matt Yamamoto

Re: Formulas question type

by hon wai lau -

Yes, I have noticed this problem before. This worked before the version 1.0 but have been broken for the release and the testing need repeated backup/ restore that is time consuming. I will try to fix it in the next release.

The import/export should work fine, but there is a problem when importing question that contains some characters such as ' or " in the subquestion text format. A temporary solution is to remove these symbol manually. You can try to manually export/import a small category one by one to figure out the problematic questions.

In reply to hon wai lau

Re: Formulas question type

by Paola Manzini -

First of all, many thanks for this plugin!

I am trying to setup calculus questions, which would require students to use wildcards in exponents. For instance, I would like to be able to ask something like "Differentiate $${a}x^{b}$$ with respect to x", where {a} and {b} would be integer numbers. I tried with the calculated question type, but when entering the answer as "{a}*{b}*pow(x,{b}-1)" I get an error message.

Would it be possible to ask such questions with your plugin? The reason I ask is because in the polynomial type question I see that the exponents to teh x are given to teh studetns, while obviously I'd like them to provide them themselves.

Many thanks!

In reply to Paola Manzini

Re: Formulas question type

by Pierre Pichet -
something like "Differentiate with respect to x", where {a} and {b} would be integer numbers. I tried with the calculated question type, but when entering the answer as "{a}*{b}*pow(x,{b}-1)" I get an error message.
Mostly because x has no meaning in a calculated formula.
What is the response that you expect ?
A numerical value or more probably a formula that contains the x with the correct coefficients. If this so , a multiple choice with Latex to formulate the possible answers could be a better choice.
Pierre
In reply to Pierre Pichet

Re: Formulas question type

by Paola Manzini -

Hi PIerre,

thanks for the answer -as you suspected, I'd like to ask questions like "take the derivative of $$x^8$$ and get them to tell me that it is $$8*x^7$$. Yes I do realise I can do it with multiple choices, but I'd like the students to show they are able to actually derive the result. 

I'd like to be able to use the calculated question type because this way the weaker students can do tons of differentiations without me having to write tons of questions! I was hoping that the "pow(a,b)" operator would accept string variables or someting similar, is this possible?

I should add that my uni uses Moodle 2.0, as far as I know.

Thanks!

In reply to Paola Manzini

Re: Formulas question type

by Pierre Pichet -
If you have moodle 2,0, then you could experiment with the calculatedmulti questiontype.
Pierre
P.S I will try something tonight ...
In reply to Pierre Pichet

Re: Formulas question type

by Paola Manzini -
If you have moodle 2,0, then you could experiment with the calculatedmulti questiontype.

mmh, but I still woulnd't be able to enter a string in the "pow()" operator, right?

P.S I will try something tonight ...

that would be great, many thanks!

In reply to Paola Manzini

Re: Formulas question type

by Pierre Pichet -
The most simple way is to create a cloze question using the following text
Donner la dérivé de 2x3. {1:NM:=6:.1}x{2:NM:=2:.1} Note the use of sup HTML to get the exponent. You create one question that works correctly then create as many as you want all in the same category. (10-20 will be OK) that do not contain other questions. You create a quiz with random question ( i.e. 2). Each student will have a different combination. As the grade is not the same for each part of the subquestion, if they grade 1 they anwer weel the coefficient and is the grade 2, the exponent is OK. This is better than multiple choice as they need to calculate.
However they cannot answer 2x with 1 as an exponent unless you give them specific instruction to use 1 as exponent for this specific case.
Pierre
Average of ratings: Useful (1)
In reply to Pierre Pichet

Re: Formulas question type

by Paola Manzini -

Dear Pierre, I am not sure I entirely follow, but I think I get the general gist (I started myself on Moodle last night, so I am an absolute beginner).

I have been able to create a question as you say, so that is good, but in order to understand your suggestion completely I think I have to better understand the role of categories, and quizzes with random questions. But even if I do not yet fully understand you, I've got the feeling you really solved my problem: many many thanks!

 

EDIT: I think I now understand you - more in detail to follow your suggestion I should:

  1. go to the question bank, and create a category (say "derivatives of a polynomial";
  2. create the first question in that category, e.g. "The derivative of 2x3 is  {1:NM:=6:.1}x{2:NM:=2:.1}"
  3. then create 19 more questions of the same type in a category, e.g. another one could be "The derivative of x-3 is  {1:NM:=-3:.1}x{2:NM:=-4:.1}"
  4. now I create a quiz that picks e.g. 2 questions at random from this category.

So if the above is correct, this definitely solve the problem of the students calculating the answers themselves. Unfortunately though I cannot use wildcard to make coefficients vary (but perhaps I can automate this outside Moodle and then import the questions) - I have in excess of 100 students in one course, and in excess of 300 in another, so I need a lot of questions.

Again, many many thanks for your help!

In reply to Paola Manzini

Re: Formulas question type

by Pierre Pichet -
You got the right planning.
To help you create the questions, edit an existing one but save it as a NEW question.
Pierre
In reply to Paola Manzini

Re: Formulas question type

by hon wai lau -

Using the formulas question type, you can use create questions with variant at once. You may use the following setting:

Random variables: a = {2:8}; exponent = {-10:-1,2:10};

Subquestion: The derivative of {a}x{exponent} is  {_0}x{_1}

Answer: [a*exponent, exponent-1]

Note that the {_0} and {_1} are the first answer and second answer respectively. It will generate different set of a and exponent everytime so that you do not need to make 20+ question manually. By default, the student must get both correct to get marks.

Anyway, you may want to use cloze as there are other functions and it will be better support.

Average of ratings: Useful (1)
In reply to hon wai lau

Re: Formulas question type

by Paola Manzini -

Hon wai lau, many thanks! and just to be clear, the exponent box is simply obtained with the <sup> code?

Finally, if I wanted to use fractions, e.g. ask for the derivative of $$\frac{1}{4}x^2$$ (which will result in a fraction in the exponent, too) should I make {a} and {b} fractions, or can I use expressions like "{a}\{b}x{exponentnum}{exponentden} " (I presume I have to stick to html code)?

Many thanks!

In reply to Paola Manzini

Re: Formulas question type

by hon wai lau -

Yes, it would work. I have just tried but the effect is not very clear, the answer box would be slightly higher:

It can be easier extended into three boxes using html.

BTW, I have implemented the algebraic formula and will be put into the new version that it will check directly of multiple equation together:

Average of ratings: Useful (1)
In reply to hon wai lau

תשובה ל: Re: Formulas question type

by anat peri -
hi. by yors answer i hope that the plugin FORMULAS for 2.0 is ready? i'm waiting for it so mach.
In reply to anat peri

Re: תשובה ל: Re: Formulas question type

by Jean-Michel Védrine -

Hello,

I have already made a 2.0 version of the formulas question type and posted it in that thread. Please test and report.

Warning : backup/restore is not already done (should be ready in a few days) and help is not complete. All others features should work as the 1.9 version including XML import export (both xml files generated by 1.9 and 2.0 versions). New feature : you can insert images in the subquestions text.

In reply to Pierre Pichet

Re: Formulas question type

by hon wai lau -

If it is possible, I would prefer allowing student to enter free form equation. In mathematics course teaching about the concept, however, it would be useful to check whether the student understand the concept by asking them about the restricted form, such as the polynomial expansion. say the question is something like (2x-3)(x-2) = { } x2 + { } x + {}, where the space { } are left for the answer.

In contrary, most questions in the physics only care about the correctness of the answers as far as they are algebraically the same, that is, both the answer (2x-3)(x-2) and 2x2 - 7x + 5 should be both correct or both wrong. And in this case, it is better not show the "hint" to the student but asking them to enter a equation directly.

Average of ratings: Useful (1)
In reply to hon wai lau

Re: Formulas question type

by hon wai lau -

Hello, everyone, I am going to release a new enhranced version of the formulas question type. I need someone to help me to test whether it works the same way with their old questions and whether the format check works in different browsers.

The new features include allowing algebraic answer, new functions for list of number, improvement in editing interface and format check of students answer. It will be released after I finish the documentation of the new features.

You can download the release candidate formulas-2.0-rc which is for moodle 1.9.

Average of ratings: Useful (1)
In reply to hon wai lau

Re: Formulas question type

by mana mboh -

Hi,

I just had a quick go literally just installed and checked if the 2.0RC will read my old questions. This is a huge improvement from the previous, which rejected questions from 1.0 and 0.92.

The good news is that it could preview and edit my version 1.1 questions no problem.

The problem I encountered was that 2.0RC would not process asciimathml delimiters. 

This is a big issue for me as i have been creating questions with asciisvg diagrams. E.g. I have a question set for the surface area/volume of a cuboid which is coded to draw the diagram. There are reasons for drawing that way rather than inserting an image - one of which is being able to insert variable length labels onto the diagrams directly - and not worrying, if i export the question, that the image will elect to not follow the rest of the components ...

So my question is whether this is a security feature or just a product of tidying up.

Thanks for the effort.

Mana

In reply to mana mboh

Re: Formulas question type

by hon wai lau -

Thanks for testing! I am not quite sure whether you are talking about the questions already in the database or the questions you want to import from the xml files.

If it is the import problem, then it should be a security bug that I have just fixed. The same import should also fail in the formulas-1.0 and 1.1, so you may also find problem when importing before. Try to replace the following line in file formulas/questiontype.php, function import_from_xml():

$qotag[] = $format->getpath($answer, array('#',$tag,0,'#','text',0,'#'),'0',false,($nodeqtype == 'coordinates') ? '' : 'error');

by

$qotag[] = addslashes($format->getpath($answer, array('#',$tag,0,'#','text',0,'#'),'0',false,($nodeqtype == 'coordinates') ? '' : 'error'));

To see whether it works. It should work for the syntax of the build in Tex filter. This question type shoud not support image very well, so if you embed any image in the text, the import may fail to load them.

In reply to hon wai lau

Re: Formulas question type

by mana mboh -

Hi,

It is not an import problem.  This image is an example of what Iam trying to say.  The diagram is drawn using asciimathml code so it is generated each time the question is run, displaying the angle values and labels. The blue components are all filtered through the asciimathml delimiters.

When run through formulas 20RC the drawing is processed. Instead some of the code is output.

My suspicion is that when the question processed,  the delimiters, "`" are stripped.  If necessary , I am happy to post the xml/html of the question .

Thanks

Mana

Question with an asciisvg drawing

In reply to mana mboh

Re: Formulas question type

by hon wai lau -

Hello,

You are right, I have used the "`" as separator so they have been stripped away, which will certainly cause many trouble. I have no questions using such symbols so I havent notice that. It is fixed now, you may replace the variables.php by the new one at

http://moodle-coordinate-question.googlecode.com/svn/trunk/formulas/variables.php

Hon Wai

In reply to hon wai lau

Re: Formulas question type

by mana mboh -

Thanks Hon Wai.

That was a very prompt reply and you managed to sort my issue in that time.

I have replaced the file as you suggest. It is working on all the questions I have looked at including the asciisvg components.

I can also see the answer options for number, numeric, algebraic ...

Will investigate more. Cant wait for the full release.

Thanks

Mana

In reply to mana mboh

Re: Formulas question type

by hon wai lau -

I have attached a demo file for the new answer type features. You may play around it and see whether it works reasonable. I would appreciate if someone can help me to test the some of the following:

1. Test the portability: Open the questions in different browsers to see whether format check works. If it works, you will see a popup window when you click the answer field in the quiz interface, otherwise a warning sign will be shown at the lower right corner at the beginning.

2. Unit test for variables handling: Uncomment the last line of formulas/variables.php and then go to the path of this file, then it will run itself. The end of the page should show 0 fail case.

3. Consistency check: I have changed some codes for grading and variables, the behaviour should be the same but I want to know whether there is any problem. Clone the whole database to a test server. Regrade all questions using formulas-1.1 and regrade again using the formulas-2.0. It should be a problem if any different arise.

In reply to hon wai lau

תשובה ל: Re: Formulas question type

by anat peri -
thanks for your plagin it is grate/ i was waiting for it . but i have some problems. i'l appreciate every help 1. is "correctness condition" by documentation the "grading criteria"in the question? 2. if the answer is pozitive - i don't anderstand why i get the error 3. i try to ask in the question to put in only one letter even not formula. but it doesn't work, the sistem marks error, but when i ask the "fill with correct - i get the same one leter that wath market like error.
Attachment ScreenHunter_01 Aug. 05 10.13.gif
In reply to anat peri

Re: תשובה ל: Re: Formulas question type

by Jean-Michel Védrine -

Hello,

If javascript is working when you edit questions, you should see this :

And if you clic on the checkbox on the left you should see this

So either you have a problem with your javascript or you are using the version for Moodle 2.0 that I posted a few days ago because in this version javascipt is broken blush. I will post a corrected version as soon as possible.

But you can still make it working, just type

_err == 0 in the field and it will work.

In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type

by anat peri -
thanks. it was a problem with javascript, so i haven't seen it/
In reply to hon wai lau

תשובה ל: Re: Formulas question type

by anat peri -
more problem/ i try to use "playholder" as is writen in tutorial, (i don't copy it, i print it by myself) but when i put the holder in the answers, i get an error
Attachment ScreenHunter_03 Aug. 05 10.55.gif
In reply to anat peri

Re: תשובה ל: Re: Formulas question type

by Jean-Michel Védrine -

Hello,

I think you are confusing 2 differents things :

Placeholders in main question text

To use it you type #1 in the Placeholder name as you have done but you need also to include {#1} in you main question text at the place where you want the subquestion to appear !

You will need 2 subquestions with #1 and #2 as placeholder names for this example above to work.

You are not restricted to put a number after the # sign, you can use anything : #3a and #B are valid placeholders names. The only condition is that the placeholders between { and } in the main question text and the placeholders names of the subquestions must match.

Placeholders for the answers fields in each subquestion text

Here you need to type {_0} for the first answer, {_1} for the second, ... and {_u} for the unit in the subquestion text

Note that in that case contrary to the first example you don't need to put something in the Placeholder name field.

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type

by anat peri -
hi. i've written the same
Attachment ScreenHunter_06 Aug. 05 16.58.gif
In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type

by anat peri -
,hi. i've written the same but it doesn't work
Attachment ScreenHunter_06 Aug. 05 16.58_2.gif
Attachment ScreenHunter_06 Aug. 05 16.58.gif
In reply to hon wai lau

תשובה ל: Re: Formulas question type

by anat peri -
hello. f = ["zero","one","two","three"][A]; this is the line that i took from tutorial, but when i try to use it in my question i get an error what can be a problem? any help?
Attachment ScreenHunter_09 Aug. 05 20.04.gif
In reply to anat peri

Re: תשובה ל: Re: Formulas question type

by hon wai lau -

The variable f should be defined in the "Global variables", not "Random variables". They are intentionally separated.

In reply to hon wai lau

תשובה ל: Re: תשובה ל: Re: Formulas question type

by anat peri -
thanks, i've got it.
In reply to hon wai lau

תשובה ל: Re: Formulas question type

by anat peri -
hello, hon wai lau. i try to use yours plugin in questions . man walks with speed {V} km/h during {t} h. sign in what letter we use for speed {_0} and i try to get in feeld of answer the letter "V" but it doesn't work. any sugestions?
In reply to anat peri

Re: תשובה ל: Re: Formulas question type

by Lev Abramov -

first of all, thanks for the wonderful plugin (which even seems to be working OK! - I installed it in our test environment and it did not crash the system! smile ) - our team are happy to have it at last.

May I make a suggestion? Can someone who has succeeded to make it work post an exported MoodleXML file with the output of 2-3 questions please. We could then import the file and see what a correstly filled-out question form looks like. We seem to be having trouble figuring out how to fill it out correctly! smile

Thanx in advance!

In reply to Lev Abramov

Re: תשובה ל: Re: Formulas question type

by Jean-Michel Védrine -

Hello,

Here is the file that was on Hon Wai Lau's website before 2.0rc was released, and that works both with formulas 1.1 and 2.0rc I think. I have used that file to test that the version I made for Moodle 2.0 can import XML files made by the version for Moodle 1.9

If you have installed the 2.0rc version of formulas that Hon Wai Lau posted a few days ago, you can also look at the new example file wich is now on his website : examples-new.xml.

In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type

by anat peri -
hello i downloaded the example file examples-new.xm as you suggested and imported it to our probe server.there is some error in the question 2.4 - answer type - Algebraic formula .
Attachment ScreenHunter_03 Aug. 06 10.36.gif
In reply to anat peri

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type

by Jean-Michel Védrine -

Hello,

What version of Moodle are you using ?

What version of the formulas question type are you using ?

Did you try the file that I attached to my previous message (examples.xml not examples-new.xml) ? Does it works ?

In reply to Jean-Michel Védrine

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type

by hon wai lau -

Thanks for your help to answers the problem smile.

I think that I should have to make things more clear.

In reply to hon wai lau

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type

by Jean-Michel Védrine -

Hello,

I think your explanations are very usefull.

In fact the problem is that the formulas question type is very powerfull and has a lot of features and possibilities. THis is why people need some help understanding it.

In fact there are some features that I only understand now that I am working on the code, but that I have never used before ! For instance (I am a math teacher so units aren't the primary goal of my teaching and testing) I only realized yesterday how powerfull your unit conversions functions are. I think that if a teacher using Moodle quiz is interested in questions with units he should really have a look at what you have done and at the formulas question type because your work is impressive cool

I will try to give an example of units handling in this forum if I can



In reply to Jean-Michel Védrine

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type

by hon wai lau -

Hi,

I have intentionally make it generic so that I can create many different type of questions in math and physics. It should be easy to use also, at least, for those with a some mathmatics and programming background. Though, I do not know whether it is easy to understand by general teachers.

I have tried to improve the documentation and the tutorial, but it seems that it does not improve much due to my presentation. The most poorly written part is the Unit system, yet it is the most elegant and sophisticated system in this question type that I find almost no improvement for it. Probaly give some visualization will help people to understand it better.

Actually, to tell our student about it, I just give them a complete table of the units. They skim it and get the idea because it is almost the format is exactly the same as the unit written in textbook.

In reply to hon wai lau

תשובה ל: Re: תשובה ל: Re: תשובה ל: Re: Formulas question type

by anat peri -

hello hon wai lau.

once more thanks for this wonderfull plugin.

i use it in my mathematic kurs/ but i can"t make the question that the

answer is FRAKTION it sends me an error  n+{_3}} " src="http://schiffman.biz/shmoodle/filter/tex/pix.php/da64d43065398a4d366d621d009ebab3

do you have some help mor me?

Attachment ScreenHunter_01 Aug. 16 10.31.gif
In reply to Jean-Michel Védrine

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type

by Jean-Michel Védrine -

Just to be clear for people lost between versions :

Go to the download page of the formulas project

If you are running Moodle 1.9

Download the file formulas-2.0.zip and if you want the example file examples-new.xml

If you are running Moodle 2.0

Download the file formulas-3.0-rc.zip and if you want the example file examples-new.xml.

This is a new file Mr Hon Wai Lau has just made available and it is a lot better than the one I have posted a few days ago because it is based on the 2.0 version rather than the 1.1 version that I had used and it also have some bugs corrected (for instance javascript that was broken in my version is now working).

I am sorry because I realized I have not published the backup/restore functions that I have already done. But I will send it and it will surely be included in a future version. Sorry for that.

I am very gratefull to Mr Hon Wai Lau for publishing this version because he had made my (small) work of upgrading this question type to Moodle 2.0 a lot better.Thanks a lot.

If you are running Moodle 2.1

Sorry no version ready (yet) sad

In reply to hon wai lau

Re: Formulas question type

by hon wai lau -

=== New release of formulas qtype ===

Note: This one is still for the Moodle 1.9, the one for Moodle 2.0 will be released later.

Format check in the quiz: A warning sign will be shown if the input is wrong for a particular answer type. An interpretation will also be shown if it is different from the input from student.


Figure 1: Format check

Support new answer types: The new answer types including the algebraic formula, numerical formula and numeric. For its use, please read the updated tutorial and documentation.

Shorten the editing interface: Now subquestion can be switched by using button in the navigation.

Variable instantiation, preview and statistics: Different realization of the variables can now be generated without reloading the page.

Show answers when no further trial: Missing function in the previous release. It can be activated by selecting the show answer option of the quiz.

New variables handling: Improving the parsing. The evaluation is now the same for all variables in random, global, local and grading.

Fix the XML import problem: Some questions cannot be imported previously are now possible

For more new features, please read the ChangeLog.

 Subquestion nagvigation

Figure 2: Subquestion navigation

 

Figure 3: Variables instantiation

Average of ratings: Useful (1)
In reply to hon wai lau

Re: Formulas question type

by Joshua Westerway -

Hi,

I have installed the latest version of formulas (2.0) for moodle 1.9 and the page hangs and nothing appears when you select to add a formulas type question.

Install was fine, nothing appeared problematic, the version is correct, what has not worked?

Moodle 1.9.10 LAMP install with PHP 5.2.3

-Josh

In reply to Joshua Westerway

Re: Formulas question type

by Jean-Michel Védrine -

Hello,

Unfortunately it is not possible to answer when people says "my page is blanck what is wrong ?"

We can have no clue at the problem if you don't give us more informations.

To get these informations :

  • Go to Site Administration > Server > debugging
  • Then in the dropdown menu labeled "Debug Messages" choose DEVELOPER
  • Click on "Save Changes" button
  • Navigate to the page that was blanck noting exactly any error message if any such message is now displayed
  • Post these messages in the forum

The infortunate case is when no message is displayed sad

But hopefully you will get some errors messages and we will be able to help you smile

Also searching the forums for blanck page will give you the most commons problems

In reply to Jean-Michel Védrine

Re: Formulas question type

by Joshua Westerway -

Well the worst case is apparent here... even with Developer error messages turn on the page appears blank.

I will have a look around the forums, not sure what is happening....

In reply to Joshua Westerway

Re: Formulas question type

by Jean-Michel Védrine -

Hello Joshua,

Well, as you have just installed formulas question type, if I were you, I would just re-install :

  • go again to the formulas download website and re-download formulas-2.0.zip (just in case the zip was not transfered OK)
  • unzip and verify the structure (just one folder formulas with all files and subfolders in it : db, lang, pix, script, answer_unit.php, conversion_rules.php, ... ) the most common error is that people have one folder level too much : formulas/formulas
  • completely delete the question/type/formulas on the server
  • upload or move (depending if you server is local or distant) the new formulas folder inside question/type so that you get question/type/formulas. If you use ftp to transfer files sometimes files get corrupted during transfert.
  • go to Site Administration > Notifications ans see if any update button is displayed, if yes, click it and update
  • use phpmyadminor similar tool to verify that your database has 2 tables mdl_question_formulas and mdl_question_formulas_answers if not something goes wrong during previous steps no need to continue, you must find what goes wrong in the previous steps
  • go to the question creation page and see if the problem is still there tongueout
  • report on this forum success or fail
In reply to Jean-Michel Védrine

Re: Formulas question type

by Joshua Westerway -

Thanks for the help.

  • Deleted formulas directory, re downloaded the package and uploaded the directory using PHP uploader filethingy not FTP
  • directory structure OK - question/type/formulas/ all folders and files are correct in this directory
  • Site admin showed no messages this time (did last time on first upload)
  • database tables question_formulas and question_formulas_answers exist but no records are in them

Unfortunatly... still getting a blank page, even with developer messages turned on there are not notifications of errors, just blank white page....

 

 

In reply to hon wai lau

Re: Formulas question type

by anat peri -

Folks, please help - there's a simple problem I'm trying to solve.

I'm trying to use this type of question to teach simple fractions. How can I build the question so as to require the student to enter the answer as a simple fraction? Is it possible at all? If it is - how can this be done? Can someone post an example (preferably as an exported MoodleXML file) please?

I have found a way - "enter the numerator"; "enter the denominator" - but it isn't sufficiently "elegant'. I need a better approach.

Ideally, I need two fields - one for the numerator and the other one for the denominator - AND A WAY TO PLACE THEM ONE ABOVE THE OTHER with a horizontal line between, to make the fraction apparent. So far I have not figured out how to do that.

Any takers? Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeez!

Thanx in advance!

In reply to anat peri

Re: Formulas question type

by mana mboh -

Hi anat,

Here's screen print of one of the examples from formulas version 1.0

If this is what you meant, I believe it is setup using tables to place the fields.

It is in the examples file on Hon Wai's  page.

Sorry I could insert the link, but if you're using the formulas question type, its exactly the same download page.

Not also that the new numerical formula answer type allows your students to enter fractions in one answer field, separating the numerator and the denominator with a "/". This does not sound like what you are looking for though.

Mana

In reply to mana mboh

תשובה ל: Re: Formulas question type

by anat peri -

mana,thanks for your answer. this is exactly my question - i can't put in the

line

it is setup using tables to place  - 

Attachment ScreenHunter_01 Aug. 17 18.30.gif
In reply to anat peri

Re: Formulas question type

by Jean-Michel Védrine -

Hello,

Just look in Hon Wai Lau examples-new.xml file you can download on his website there is a question example that does exactly that :

As you see the name of the question is "Possible question type - fractions" and it explain how you can have full mark for the simplified fraction and a partial mark for correct but non simplified fractions.

May I suggest to people intending to use formulas questions to study carefully this example file. It is full of ideas and suggestions of use.

I know it rather well now, as it's the file I use to test my work on a 2.1 version.

By the way don't you notice anything on the above screenshot ? Yes it's Moodle 2.1 running formulas questions ! Still not finished, still some bugs but it's alive.

In reply to Jean-Michel Védrine

תשובה ל: Re: Formulas question type

by anat peri -

jean-michel thanks

this is exactly what i looked for. we're waiting for 2.1

In reply to Jean-Michel Védrine

Re: Formulas question type

by Ravi Vare -

Hi Jean & Hon,

Thanks for such nice Question Type.

I tried it on moodle 2.1 (mymoodle is - sun21)

Database created successfully.

But As i select 'Create new Question..'

Pl see screenshot

Best regards

Ravi

P.S.

All moodler are waiting this Q. Type for Moodle 2.1

Hope it will get soon

Attachment formula type.JPG
In reply to Ravi Vare

Re: Formulas question type

by Jean-Michel Védrine -

Hello Ravi,

formulas 2.0 is for Moodle 1.9

formulas 3.0 is for moodle 2.0

But there is no version ready now for Moodle 2.1

The changes between 2.0 and 2.1 are a lot more important than from 1.9 to 2.0.

Absolutely no question type made for moodle 2.0 can work for Moodle 2.1, it is not even necessary to try, this is absolutely not possible at all.

When a version for Moodle 2.1 will be ready it will be announced on this forum.

We are working on it.

 

In reply to Jean-Michel Védrine

Re: Formulas question type

by Ravi Vare -

Hi Jean,

Thanks for Response.

best of Luck to your entire team.

best regards,

Ravi

In reply to Ravi Vare

Re: Formulas question type

by Pascal Maury -
Picture of Plugin developers

Hi,

Just to say, I also tried to install formulas 3.0 in a Moodle 2.1 and it breaks
- the page where we can add questions
- the search engine in the admin block (!?)

So, I came here and I understood that formulas is not ready for 2.1

Could you confirm the way to remove it cleanly ?
- I deleted the question/type/formulas folder
- I deleted the tables "question_formulas" and "question_formulas_answers"

Is it enough ?
Is it the clean way ?

Thanks !

Pascal

In reply to Pascal Maury

Re: Formulas question type

by Jean-Michel Védrine -

Hello,

Unfortunately currently there is no other way than what you have done (delete the mod/question/type/qtype_name folder and go in the database and delete the tables created by the question type) to uninstall an incompatible questiontype.

This is because an incompatible question type break the admin questions administration page (and as you discovered it also break other pages including the question creation page).

I think this should be corrected and I will create a tracker issue.

But to answer your precise question, to my best knowledge your Moodle website should be OK now.

In reply to hon wai lau

Re: Formulas question type

by hon wai lau -

=== Port to Moodle 2.0 ===

I am happy to announce that the formulas question has been ported to the Moodle 2.0. Please download the formulas-3.0 from the Download page.

This release is the direct port from the formulas-2.0, so all functionalities are the same. In addition, it has one addition features that now images can be used in the subquestion text. Thanks for Jean-Michel to make this improvements.

The database has changed in this release, so if you have used any old release, please go to the Administration -> Notification. It also fixes few bugs in the release candidate, so please upgrade it.

Average of ratings: Useful (1)
In reply to hon wai lau

Re: Formulas question type

by Lev Abramov -

First of all, many many thanks for the great plugin - the jewel in the crown of math plugins! We cannot really imagine our math courses without it!

A question from one of our teachers - I am just quoting to make sure I do not miss anything:

"I would like to create a question for the topic dealing with raising numbers into powers. I need to assign a task comparing two values - X and Y - deriving from the equations X={A}^{N} and Y={A}^{M}, where A, M and N are assigned RANDOMLY, and where A can be either a positive or a negative value.

Can this be achieved using this plugin?

If it is possible, can you explain how to do it correctly?"

I hope this can be dealt with to the teacher's complete satisfaction. smile

Best -

Lev

In reply to Lev Abramov

Re: Formulas question type

by hon wai lau -

Likely yes, but I am not quite sure about your question.

If you are asking them to find the values of X and Y, and the correct criteria is X smaller than Y, then you can type the '_0 < _1' in the criteria input field?

If you are asking them to answer whether X is greater than Y, then you may ask them to type either 0 or 1 in the answer... you can type "X<Y" in the answer field so that the result will be 0 for false or 1 for true... But it may not be what you want

In reply to hon wai lau

Re: Formulas question type

by Lev Abramov -

What the student really gets is a statement

{A}^{M}>{A}^{N}

and they must decide whether this statement is true or false.

Like I said, A, M and N are values randomly assigned from their pools/ranges; A can be both positive and negative.

Have I made it better this time? I wish I could explain these things professionally - but I am just a messenger boy smile

L

In reply to Lev Abramov

Re: Formulas question type

by hon wai lau -

Short answer: yes.

Consider the question: "Suppose X = {A}{M} and Y = {A}{N}, which one is larger? " As I mentioned before, you can ask the students to type 0 if the X is larger, and 1 if the Y is larger. So a better way is to turn it into a simple MC, so it provides a simple way to do this. Please try to import the attachment here to test it, and you should see the screenshot below.

Something you may want to know:

1. It simply maps the first choice to 0 and the second choice to 1, you will need to know it in order to type a correct formula to check the answer.

2. It is an experimental features, so it is not documented yet. The current syntax is simply to attach a list of string to the answer box "{_0:choices}" where choices is a list of string. It may change to "{_0:MC:choices}" in the future, but it is just a minor change, so you may use it now.

3. This pattern of dynamically calculating the answer is not supported by the moodle MC, and there are more variety of the usage.

In reply to hon wai lau

Re: Formulas question type

by Paul Nicholls -

Great to see this updated for Moodle 2 - but can you please clarify whether this is for 2.0 or 2.1?  If it's for 2.0, do you have plans to upgrade it for the new question engine in 2.1?

Cheers,
Paul

In reply to Paul Nicholls

Re: Formulas question type

by hon wai lau -

Hello Paul,

It is for Moodle 2.0.

We are currently attempting to port it to the Moodle 2.1.

In reply to hon wai lau

Re: Formulas question type

by Lev Abramov -

And while you are at it: is there a way of adding FEEDBACK fields so as to provide feedback if a learner gives an incorrect answer? This seems like the only feature missing at the moment. All other question types we use for maths (including plugins) allow for feedback, and we see its efficiency. Getting feedback fields in this question type would be extremely helpful. Thanx in advance!

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

Hello Lev,

This is one of the feature that Hon Wai Lau has added in the latest formulas 3.0 release : a feedback field with an html editor for each subquestion.

So if you are running Moodle 2.0 can you have a look at this version and see if it suit your needs.

In the release for Moodle 2.1 I will also add hints for the interactive with multiple tries behaviour with checkboxes to optionnaly delete wrong answers and display the number of right answers in each question (same feature the match question for Moodle 2.1 has and the multianswer should have wink ).

Unfortunately, since the beginning of my courses 15 days ago, I struggle to find some time to work on this release !!

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

then apparently we are not using the LATEST release. There have been several, mostly posted within this forum discussion. I can try downloading the one referenced as the latest version at the plugins repository and see if anything changes in the display. I will let you know the results! smile

EDIT: looked at Modules and Plugins http://moodle.org/mod/data/view.php?id=6009 - a search with Formulas as keyword yields 0 results.

Can you please post a link? TIA!

Lev

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

For the formulas question type the refrence is Hon Wai Lau's Google code page : http://code.google.com/p/moodle-coordinate-question/

This is where new versions are always posted : http://code.google.com/p/moodle-coordinate-question/downloads/list

Can I also point out the very interestind documentation : http://code.google.com/p/moodle-coordinate-question/w/list

 

In reply to Jean-Michel Védrine

Re: Formulas question type

by hon wai lau -

Hello, the link to Module and Contrib in the first page is still not working. Do you know some method to fix it?

It is a little trouble for me and I think some people are block by this problem and dont know what to do with this qtype.

In reply to Jean-Michel Védrine

Re: Formulas question type

by Peter Halverson -

Hello,

I have installed Moodle 2.4 and the Formulas Question type and the example questions at http://code.google.com/p/moodle-coordinate-question/downloads/list, being sure to get the 3.0 set of questions.

They work OK but I have found a couple small problems

Example question 2.4 doesn't make sense.  I think the variables a and b (inside the question) are not being converted to numbers properly:

And in question 5.3 the Latex code isn't being processed properly:

I hope these little problems can be fixed...

Thanks,Peter Halverson

In reply to Peter Halverson

Re: Formulas question type

by Jean-Michel Védrine -

Hello Peter,

I think that in fact these problems are not in my formulas code but in Hon Wai Lau's sample questions smile. I reported him my thinking several years ago, but he was no interested in fixing it wink.

I think that question 2.4 is not mathematically correct. Here is how it is defined in the sample file:

Question text is What are the roots of the {k3}x<sup>2</sup> - ({k1}a - {=k2*k3})x + {=k1*k2}? <br>
x = {_0}, or <br>
x = {_1}

k1, k2 and k3 are random variables defined by:

k1 = {2,3,4,5};
k2 = {2,3,4,5};
k3 = {2,3,4,5};

and the expected answers are:

"k1/k3 a","k2 b"

You see ! This is no correct at all ! Nobody can find the "correct" answers.

But I think the equation is rendered as it should if you compare the question text and your screenshot.

But even as it is, this question is an excellent example of some features of the question type.

Exercise: create a similar but mathematically correct formula question wink

For question 5.3 it depends a lot on how TeX formulas are rendered on your Moodle website (TeX filter, Mathtran filter, MathJax, ...) so you must adjust the latex code so that it is correctly rendered by your website.

IMHO everybody should try MathJax because all other methods to render math formulas are now completely obsolete.

Exercise: modify this question so that it is correctly rendered by your preferred way of rendering mah formulas.

I will post my personal solutions to the exercises in a few days.

In reply to Lev Abramov

Re: Formulas question type

by Lev Abramov -

Checked the repository at http://code.google.com/p/moodle-coordinate-question/downloads/list

Aug 22, 2011 - File: formulas-3.0.zip   84.6 KB

This IS the latest release, and this is what we have installed. Apparently we are just misinterpreting some of the fields!

Can you please post a screenshot showing [one of] the fields that allow specific feedback for each subquestion?

TIA!

Lev

In reply to Lev Abramov

Re: Formulas question type

by hon wai lau -

Previously, I have preliminary tested the Moodle 2.1 and I thought that it may not be compatible with it, but it turns that it should not a problem. I do not want to release a possibly backward incompatible feature at that time, so just intentionally block it.

I will enable it for next release, and you can re-enable it now but editing the file formulas/script/editing.js, then search and replace the following line

loc.style.display = 'none';

by

//loc.style.display = 'none';

In reply to hon wai lau

Re: Formulas question type

by Jean-Michel Védrine -

Hello,

Oh yes thanks Hon Wai, I quite forgot that I had edited that line to re-enable this feature blush Sorry Lev.

Once you have re-enabled it, here is what you should see :

Clicking on the checkbox will make the editor for the feedback appear :

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

Thank you Hon Wai and Jean-Michel - looks like I'm in luck today. The team has been asking me to request this feature for what is considered "quite a long while" (which in our neck of the woods amounts to getting repeatedly pestered for a week+ smile ), and I expected the badgering to continue for a long more time.

Turns out all it takes is commenting one line of code!?

By the way, Jean-Michel, this is the second Ooops on your part in this thread. The first time was when you forgot to include the lib.php file in the distro; now this one... You obviously need a vacation. Talk to Tim about it: he has just had one, may be able to recommend a good retreat.

LOL

Lev

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

Hello Lev,

Well I'm quite used to forget various things, to lose things and it's not an effect of my age because it has always be like that !

I stopped counting the number of time I lost my wallet long ago. But as I am a very lucky man somebody always bring it back to me with all it's content approve

Unfortunately vacations are over and courses are here dead

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

Dear all (first of all Hon Wai Lau and Jean-Michel, of course) -

a month ago I reported a problem with the feedback fields (the posting is here in this thread) - so far no-one has responded, so I'm just reminding of it.

In the meantime, there is another one that seems plugin-specific.

In one of the courses where all the questions have been created using the Formulas 3.0 plugin, one of the quizzes (a sum-up quiz that uses questions from other categories and is not based on a specific category of its own) displays the following alert:

For question id 6676, the category id 981 is not identical with the shared wild card V1 category id 973. Edit the question.

As I was not the creator of the course, I have no way of knowing how this specific question was created and what went wrong.

Does this ring any bells? Any idea how to fix it? The problem is even more serious, as the quiz already has several attempts and so the quwstions probably cannot be edited... sad

I hope you can think of something and suggest a way out.

Lev

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

Hello,

As it was the first time I saw an alert like this, I did some research.

The only similar string that I found was in question\type\calculated\lang\en\qtype_calculated.php

$string['nocoherencequestionsdatyasetcategory'] = 'For question id {$a->qid}, the category id {$a->qcat} is not identical with the shared wild card {$a->name} category id {$a->sharedcat}. Edit the question.';

This string is no more called in the code of the latest Moodle 2.1 version, but in Moodle 2.0 it was called 2 times in question\type\calculated\questiontype.php

So we can conclude

  • This seems unrelated to formulas questiontype
  • You seems to have a problem with one of your calculated question somewhere (it seems in fact be a problem with a dataset ?)
  • Somebody (Pierre ?) has forgotten to delete this unused string in Moolde 2.1
  • In all case "nocoherencequestionsdatyasetcategory" seems a strange name for  a string smile
In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

My apologies. I did not mention the Moodle version. We are still using 2.0. The latest of course - 2.0.4.

So how do we go about it? Find that string in the code and weed out the offending "y" character? Or just upgrade to 2.1? I would gladly do the latter - but most questions we use are based on the Formulas plugin; can we safely upgrade to 2.1? Will these questions be working? Is the 2.1 version of the Formulas plugin ready?

TIA!

Lev

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

Sorry my message was unclear and I have confused you blush

The latest 2 items of my list were not directed at you but at Pierre Pichet and Tim Hunt because they forgot to remove this string from Moodle 2.1 and left a typo in the string name.

 

But for you Lev, no need to modify the code or to upgrade to Moodle 2.1 !

You "just" need to find the calculated question wich has a problem and correct it. The error message suggest that you need to edit this question to correct the problem. The difficult part is to find the offending calculated question. Maybe look in the database with the id given by the error message (6676) will help you to find this question ?

As you said as long as formulas for Moodle 2.1 is not ready, you can't upgrade. And unfortunately it is not ready yet.

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

Jean-Michel,

it's OK. As long as I get into such a good company as Pierre and Tim, I don't mind. smile

OK, I'll dig the offending question (in fact there were TWO - I just cited one) out of the DB to make sure we know what they are, and will ask the math team to try and fix them for good.

Thanx!

Lev

In reply to Lev Abramov

Re: Formulas question type

by Lev Abramov -

It looks like my exhilaration about the long-awaited feedback field has been premature.

Turns out that there is only ONE feedback field available, and this feedback is displayed after EVERY answer, no matter what - correct or incorrect. Besides, clicking on the "Blanks for 2 more choices" button does not invoke any changes in the number of fields displayed. (Can I comment smth out - or uncomment smth - to make it work?)

A question: is it possible to further sophisticate this question plugin to make it work in one of the following ways:

a) display a different feedback for wrong answers that for the correct one;

b) display feedback ONLY for the wrong answer

as it is a bit confusing the way it works now: after all, if your answer is correct, why see an explanation as a result? If my answer is correct, apparently I already know how to solve this question, right?

Thanks in advance!

Lev

Attachment image02.gif
In reply to Lev Abramov

Re: Formulas question type

by Lev Abramov -

Hmmm... it also looks like I am talking to myself. Ah well, I will keep trying.

In addition to the problems reported above, we seem to have another one.

If we use numeric characters, everything works fine. But if we expect an alphabetic character as an answer, then we observe an interesting (not to call it unpleasant) phenomenon:

NO MATTER IN WHAT ORDER WE FEED THE ANSWERS, AS LONG AS THEY ARE OVERALL CORRECT THEY GET ACCEPTED INDISCRIMINATELY.

Take a look at the attached screenshots - these pictures explain it better than words.

building a question

 

wrong answer 1: correct answers, wrong order

 

wrong answer 2: just one of the correct answers in three fields

 

Looks crazy, eh?

Now tell me what is wrong here. Are we using the question for purposes it was not intended to be used for? Or is it some validation problem than needs to be addressed in the code?

Thanks in advance!

Lev

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

Hello Lev,

Yes I think you are right something is not good in the way feedbacks are managed in the formulas question type.

The problem is that feedbacks are attached to subquestion (1 feedback for each subquestion).

In the multichoice question type feedbacks are attached to choices (1 feedback for each choice) and that works well because in that way student get the feedback(s) attached to their response(s)

In the shortanswer question type feedbacks are attached to answers (1 feedback for each answer) and that works well because student get the feedback associated with their answer.

But for formulas, that deosn't works so well because each subquestion is in fact a complete question that can be either correct, incorrect or partially correct. And if you check the box to display feedbacks everybody will get the same feedback.

So what are the options ?

The first option wich would require the less work is to display the feedback only for incorrect and partially correct responses to the subquestion. I think this would require to do changes only in 1 place in the code so this is only a small amount of work (this option can be a short term solution for you Lev, if you agree I can look at what changes are needed to display the feedback only when the student's response is not correct, so that you can wait for a better solution to come in the offical version of formulas question)

The second option would be to add to the formulas question a "conbined feedback" as it is done in latest versions of multichoice and match questions. This conbined feedback is made of 3 feedbacks (correct, incorrect and partially correct) and only one is displayed to the student accordingly to his grade for the question.

This would not be a lot of work because most of the code for this already exists in Moodle and even some methods can be re-used.

The drawback of this option is that the fededback will only depend of the student's grade for the question but not of his answers to each subquestion.

The third option is to add conbined feedback to each subquestion (correct, incorrect and partially correct feedbacks). This would make sense because each subquestion of a formulas question is in fact a question on it's own, with variables and main question text shared for all subquestions of a formulas question.

Of course this last option is the richest for the teacher because it gives him the most possibilities to provide feedbacks to the students.

The possible drawbacks I can see are

- it is of course the option that require the more work wink.

- we need to add 2 fields to the subquestion table (we can re-use the existing feedback field for one of the three feedbacks and copy it's content in the other 2 during upgrade to maintain compatibility, letting teachers to type different contents in each 3 feedbacks after the upgrade process)

- it will make the question creation screen even more complex adding 2 more TinyMCE editors (and the associated time to load and init them !)

As Hon Wai is the creator of the formulas question I think it is up to him to take the decision. Once the decision is taken, we can see how implement it in the 3.0 version for Moodle 2.0 and in the future version for moodle 2.1

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

Ah! at last someone is talking to me about it! And not just "someone" - Jean-Michel himself! smile

OK, let me put things in their proper perspective. Imagine a drowning person in the sea. Som 40 feet away, a yacht is bobbing on the waves, and the person on the deck says to the poor guy:

- You can have a choice of three types of saving belts. The relative advantages of the first type....

At this moment the drowning person yells:

- Cut it short and just throw SOMETHING! ANYTHING!

This more or less reflects the situation. smile JUST DO IT!

And our gratitude will be boundless and eternal.

LOL

Lev

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

Hello Lev,

One more time I have not been clear !

I was speaking to several people at the same time without saying it explicitly.

Part of my explanation of the 3 possibles options was for Hon Wai lau so that he can choose wich one he wants and that I can code it

But when I said "this option can be a short term solution for you Lev, if you agree I can look at what changes are needed to display the feedback only when the student's response is not correct, so that you can wait for a better solution to come in the offical version of formulas question" i was writting this for you Lev.

But for me it was essential to make a difference between a small hack I can very easily do for you so that the feedback is only displayed in case of incorrect responses, and the future solution that we can implement in the future.

So enought explanations here is the hack

in the question/type/formulas/questiontype.php file in the get_subquestion_formulation_and_controls function,

replace the lines :

            $feedback = $this->get_substituted_question_texts($question, $cmoptions, $localvars, $part->feedback, 'feedback formulas_local_feedback');
            $feedback = quiz_rewrite_question_urls($feedback, 'pluginfile.php',
                $context->id, 'qtype_formulas', 'answerfeedback', array($state->attempt, $state->question), $part->id);

With the lines

if ($sub->fraction < 1) {

                $feedback = $this->get_substituted_question_texts($question, $cmoptions, $localvars, $part->feedback, 'feedback formulas_local_feedback');
                $feedback = quiz_rewrite_question_urls($feedback, 'pluginfile.php',
                    $context->id, 'qtype_formulas', 'answerfeedback', array($state->attempt, $state->question), $part->id);

}

Don't forget the final closing brace !

And the feedback will only be displayed in case of partially correct or incorrect response to the subquestion.

If you prefer you can only display the feedback for incorrect responses replacing :

if ($sub->fraction < 1)

with :

if ($sub->fraction ==0)

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

Now you're talking business! smile

That much I can do - find the place and add the code.

Thanx!!!!!!!!!!

Lev

In reply to hon wai lau

Re: Formulas question type

by Matt Yamamoto -

I have a question about the History of Responses.  The issue seems to be that duplicate entries are being made in the database. 

For example, I am looking at the history of responses for a student's attempt at a quiz with a formulas qustions.  I can see the History of Responses table when I review their attempt; however, under the "#" column I will often have duplicate numbers.  In the particular one I'm looking at now the number 6 is repeated 51 times!  They all show the same timestamp though.   If I hover over the number in the "#" column (the link which shows me that particular attempt) I can see that the "state" value in the url is different for the repeated attempt numbers...but I'm not sure why this is. 

I should note that I am running my quizzes in adaptive mode on moodle 1.9.12.

This is troublesome for me because during review of attempts I have to scroll through very long lists of duplicate entries for each question.

Any help would be greatly appreciated.

In reply to Matt Yamamoto

Re: Formulas question type

by Lev Abramov -

To add to the previous posting: the same is happening in my 2.0.4 installation, so this phenomenon is probably version-independent.

But it looks worse than that: in addition to the Grade listings, there is a lot of Save rows - and it seems that these save incidents are invoked by submitting OTHER Formulas question answers within the same quiz. In other words, if there is a quiz that includes several Formulas-based questions, then one quiz attempt will look like

Save

Save

Save

Save

Save

Save

Save

Grade

Grade

(I'm presenting this as text so as to avoid including a screenshot - but you got the idea, right?). These Save instances precede the Grade instances, and their number is very large. I cannot imagine that a student would really save THIS question ten or twenty times before submitting, so the saves seem to come from other questions.

Am I making sense, and does this make sense?

In reply to Lev Abramov

Re: Formulas question type

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The formulas question type may be implementing the compare responses method incorrectly.

In reply to Tim Hunt

Re: Formulas question type

by Jean-Michel Védrine -

Hello,

Most probably this is true because in formulas for Moodle 1.9.x and Moodle 2.0.x the compare_responses code is commented so the code from base class must be used.

I don't know why this code is commented.

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

In other words, this code needs to be uncommented, right?

And... "Who will bell the cat?" smile

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

Hello Lev,

  1. The code is not mine. Hon Wai did it
  2. I didn't commented it. Hon wai did it. I suppose he had a good reason to do so and maybe the code was incorrect or having some issue ?
  3. I never tried to uncomment it and I really don't know what will happend if you try to uncomment it. Maybe it will break all the formulas questions or something even worst will happend

But now that I am aware of the problem I will surely have a look at it.

First I need to read again what the compare_responses method is supposed to do big grin

In reply to Jean-Michel Védrine

Re: Formulas question type

by Lev Abramov -

God bless those who can read the code - and especially those among the code-readers who can tell the head and the tail of it. Special prayers for good health and longevity of those who can also make changes in the code without breaking the entire plugin. And if, after the changes have been made, the plugin starts working as desired (or at least as expected)... we mere mortals will feel like we're in heaven.

sad

Lev

In reply to Lev Abramov

Re: Formulas question type

by Jean-Michel Védrine -

I am not quite sure I quite deserve all those compliments but in any case it's quite pleasant to hear big grin

Here is my attempt at a working compare_responses method for the formulas question 2.0 (for Moodle 1.9) and 3.0 (for moodle 2.0)

    // Define the equivalence of the responses of a formula question
    function compare_responses(&$question, $state, $teststate) {
        $res = true;
        foreach ($question->options->answers as $i => $part) {
            $names = array("${i}_");    // response["0_"] etc is not used when we have multiple box
            foreach (range(0,$part->numbox) as $j)  $names[] = "${i}_$j";
            foreach ($names as $name) {
                if (array_key_exists($name, $state->responses)) {
                    $value1 = trim($state->responses[$name]);
                } else {
                    $value1 = '';
                }
                if (array_key_exists($name, $teststate->responses)) {
                    $value2 = trim($teststate->responses[$name]);
                } else {
                    $value2 = '';
                }
                $res = $res && (((string) $value1) === ((string) $value2));
            }
        }
        return $res;
    }

To Tim : As you see I use Hon Wai Lau code to fill the $names array with all the expected responses keys, then I use something similar to the arrays_same_at_key_missing_is_blank helper function that you have done in the question engine 2. Tim, At first glance, do you think my code is going to work ?

To Lev : This code seems to work a lot better than the default compare_responses method that was in fact nearly always returning false for a formulas question.

But I would need a lot more tests to be sure that :

  • my code always detect a change in the students responses
  • my code doesn't detect a change when in fact responses are the sames

So feel free to test and report

In reply to Jean-Michel Védrine

Re: Formulas question type

by Jean-Michel Védrine -

I have already found at least 1 case where my code is failing.

Imagine a formulas question subquestion where the response is made of a number and a unit for instance 30 m/s. imagine the student has typed 30 m/s and don't change his response.

let 3 be the number of the subquestion

when compare_responses(&$question, $state, $teststate)  is called $state is the "new" state not yet analyzed so $state->responses[3_] will contain "30 m/s"

But $teststate is an old state maybe already analysed so $teststate->responses[3_] will be empty and $teststate->responses[3_0] will contain "30" and $teststate->responses[3_1] will contain "m/s"

So the compare_responses method will incorrectly return false as if responses were differents.

i need to modify the code to also works in that case !

Question to Hon Wai : do you think I can call $this->rationalize_responses($question, $state);

at the begining of the compare_responses method to solve this problem or do you think it will break other parts of the code ?

In reply to Jean-Michel Védrine

Re: Formulas question type - another problem found

by Lev Abramov -

Dear all -

one of the teachers using Formulas very intensively has recently reported a strange pattern of behavior of the Formulas plugin in Moodle 2.0.

When ONE question has been answered and submitted, the script saves EVERY Formulas question in that quiz. By the time the quiz has been completed, the number of Saves in the logs becomes overwhelming.

Not that it breaks anything - but checking the results of such quizzes becomes a very tedious task, as it becomes necessary to sort the Save instances from the Submit instances by manually going through a very long list.

Sorry about bringing bad news. sad

In reply to Lev Abramov

Re: Formulas question type - another problem found

by Jean-Michel Védrine -

Hello Lev,

Even if I have not looked at Moodle 2.0.x for months, I want to try to solve this problem. But I am not sure that I quite understand it.

Can you provide a step by step procedure to reproduce this for instance with a quiz containing only 2 formulas questions ?

Thanks.

P.S. Unfortunately I am still fighting to find some time to finish formulas for Moodle 2.1/2.2. Maybe this will give Tim Hunt some time to solve MDL-30442 (wich would be very interesting for the formulas question type) wink

In reply to Jean-Michel Védrine

Re: Formulas question type - another problem found

by Eugen Neuber -

Hello Jean-Michel!

If I can be any help in your effort porting formulas to Moodle 2.1/2.2 I would be very happy to support you and Mr. Hon Wai Lau !

kind regards,
Eugen 

In reply to Eugen Neuber

Re: Formulas question type - another problem found

by Jean-Michel Védrine -

Hello Eugen,

Thanks for your offer to help, but the actual state of the code is still a big mess and I don't know if anybody but me can find it's way in my totally unordered way of developping the code.big grin

Unfortunaltely there is no git or svn repository of the code, and I think it exists only on my computer (but I have also send it to Hon Wai just in case wink)

There are several things that are on the way to properly finish the Moodle 2.2/2.3 version of the formulas question type :

  • first and most important : I need to find some time to work on it but solving MDL-25492 (Unable to import Blackboard quiz)  is a highest priority. Fortunately summer holidays are not too far ...
  • also I am fighting to find a workaround around MDL-30442 (Question types must be able to store the results of expensive computations in methods like grade_response) because I don't think Tim will be able to solve it in a near future given all the more important tasks he has to do.
  • last (but not least) I think I need to change parts of what I have already done : when I started this, the new question engine was very new and I think I make a mistake deciding that class qtype_formulas_question should extends question_graded_automatically. I am more and more thinking I should have choosen question_graded_automatically_with_countback. this is not a big mistake because formulas question type uses its own behaviours but I need to rework the code because in fact the actual code duplicate part of the code already in Moodle rather than using it wich is not good.

Anyway if you really want to have a loot at the code, I can send you the files but be warned they can be used for nothing in their actual state.

In reply to Jean-Michel Védrine

תשובה ל: Re: Formulas question type - another problem found

by anat peri -

Good afternoon.
vacations've started and I hope that you will be able to finalize version 2.1 and 2.2. I am looking forward to it eagerly.
I would like to recall some priblemy work.
1 - adding images to Subquestion text. uploaded images are not reflected in the question.
2-Showing graded and ungraded attempts for each user: When there are a few questions FORMULAS  in the test , after answering the first question is not reflected in the answers to new questions. until the test is completed and commissioned the system shows that there is an answer only to the first question.

When ONE question has been answered and submitted, the script saves EVERY Formulas question in that quiz. By the time the quiz has been completed, the number of Saves in the logs becomes overwhelming.

Not that it breaks anything - but checking the results of such quizzes becomes a very tedious task, as it becomes necessary to sort the Save instances from the Submit instances by manually going through a very long list.

 


 These Save instances precede the Grade instances, and their number is very large. I cannot imagine that a student would really save THIS question ten or twenty times before submitting, so the saves seem to come from other questions.

Am I making sense, and does this make sense?  

3 -
If we use numeric characters, everything works fine. But if we expect an alphabetic character as an answer, then we observe an interesting (not to call it unpleasant) phenomenon:

NO MATTER IN WHAT ORDER WE FEED THE ANSWERS, AS LONG AS THEY ARE OVERALL CORRECT THEY GET ACCEPTED INDISCRIMINATELY.
4 - will it be possible to use  wiris the questions  ?

In reply to anat peri

Re: תשובה ל: Re: Formulas question type - another problem found

by Jean-Michel Védrine -

Hello anat,

Yes Summer holidays did begin big grin

Yes I restarted my work on formulas question type,  the first part was trying to understand what I did a year ago smile

Can you tell me what version of Moodle and formulas you are using ?

1) This sound like a bug but I remember very well that I tested that and it worked. I will test it again.

2) Do you mean in adaptive mode when the student press the "Test nutton" or something else ? I don't understand very well what you want to say. But I remember somebody reported something similar in a previous message of that thread and I suggested a fix. I will try to look at this issue.

3) I don't understand. can you give an example of a formula question showing the problem (maybe with a screen capture) so that I can see what the problem is ?

4) I don't use or know wiris tools.

In reply to Jean-Michel Védrine

Re: תשובה ל: Re: Formulas question type - another problem found

by Jean-Michel Védrine -

I search previous messages and found that :

The problem of multiple saves has been reported by Matt Yamamoto and Lev abramov on Monday November 14th 2011
and Tim Hunt has answered "The formulas question type may be implementing the compare_responses method incorrectly."
On the same day I have posted a first try at rewritting the compare_responses method but realised after that it will fails in some cases.


So I will have another look at it and try to post a corrected version when it is ready.

The problem of all questions in quiz been saved when only one question has been answered and submitted has been reported by Lev Abramov on Monday February 13th 2012.
I remember I tried to replicate this in my (unfinished !) version of formulas for Moodle 2.1 and if I remember well I was unable to replicate this behaviour.
But I think nobody has worked on this bug in Moodle 1.9 and 2.0. Unfortunately I don't have time to work on this myself because I prefer to concentrate on the 2.1/2.2/2.3 version

In reply to Jean-Michel Védrine

Re: תשובה ל: Re: Formulas question type - another problem found

by Jean-Michel Védrine -

On 24 september 2011 Lev Abramov reported :
Turns out that there is only ONE feedback field available, and this feedback is displayed after EVERY answer, no matter what - correct or incorrect.
A question: is it possible to further sophisticate this question plugin to make it work in one of the following ways:

a) display a different feedback for wrong answers that for the correct one;

b) display feedback ONLY for the wrong answer

as it is a bit confusing the way it works now: after all, if your answer is correct, why see an explanation as a result? If my answer is correct, apparently I already know how to solve this question, right?

On November 7th 2011, I answered :

I think something is not good in the way feedbacks are managed in the formulas question type.

The problem is that feedbacks are attached to subquestion (1 feedback for each subquestion).

In the multichoice question type feedbacks are attached to choices (1 feedback for each choice) and that works well because in that way student get the feedback(s) attached to their response(s)

In the shortanswer question type feedbacks are attached to answers (1 feedback for each answer) and that works well because student get the feedback associated with their answer.

But for formulas, that doesn't works so well because each subquestion is in fact a complete question that can be either correct, incorrect or partially correct. And if you check the box to display feedbacks everybody will get the same feedback no matter if his answer is correct or not.

So what are the options ?

The first option wich would require the less work is to display the feedback only for incorrect and partially correct responses to the subquestion. I think this would require to do changes only in 1 place in the code so this is only a small amount of work (this option can be a short term solution for you Lev, if you agree I can look at what changes are needed to display the feedback only when the student's response is not correct, so that you can wait for a better solution to come in the offical version of formulas question)

The second option would be to add to the formulas question a "conbined feedback" as it is done in latest versions of multichoice and match questions. This conbined feedback is made of 3 feedbacks (correct, incorrect and partially correct) and only one is displayed to the student accordingly to his grade for the question.

This would not be a lot of work because most of the code for this already exists in Moodle and even some methods can be re-used.

The drawback of this option is that the fededback will only depend of the student's total grade for the question but not of his answers to each subquestion.

The third option is to add conbined feedback to each subquestion (correct, incorrect and partially correct feedbacks). This would make sense because each subquestion of a formulas question is in fact a question on it's own, with variables and main question text shared for all subquestions of a formulas question.

Of course this last option is the richest for the teacher because it gives him the most possibilities to provide feedbacks to the students.

The possible drawbacks I can see are

- it is of course the option that require the more work.

- we need to add 2 fields to the subquestion table (we can re-use the existing feedback field for one of the three feedbacks and copy it's content in the other 2 during upgrade to maintain compatibility, letting teachers to type different contents in each 3 feedbacks after the upgrade process)

- it will make the question creation screen even more complex adding 2 more TinyMCE editors (and the associated time to load and init them !)

As Hon Wai is the creator of the formulas question I think it is up to him to take the decision. Once the decision is taken, we can see how implement it in the 3.0 version for Moodle 2.0 and in the future version for moodle 2.1

Unfortunately nobody has answered sad and I am now at a point I need to take a decision.
I think I will choose a mix of option 1 and 2 :
I will modify the code so that the feedback for each subquestion is only displayed for incorrect and partially correct responses to the subquestion
AND
I will also add a "combined feedback" to each question.
This seems to me as a rather good solution because I think that in most cases all subquestions in a formula question will be related to the same problem so a combined feedback for the whole question should be enough for the teacher (for instance to display a worked solution of the whole problem) .
At the same time I see no reason to remove the feedback in each subquestion because teachers may have entered valuable data here in previous versions of the formulas question type, so the only change is that this "subquestion feedback" will no more be displayed if student answers correctly the subquestion.

If anybody wants to comment on this decision, please do it quickly because I will stick with it once implemented wink !!

In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by anat peri -

hello jean-michel. 

"

this "subquestion feedback" will no more be displayed if student answers correctly the subquestion."

is the right solution. i like the opportunity to give the right answer if the student's answer is wrong. 

for me it is very important that the plugin will be ready at the end of august, so i wish you wouldn't spend much time on this feedback.

cool

In reply to anat peri

Formulas question type - problem found

by Bernat Martinez -

I have been testing formulas question type Moodle1.9.19, it works great but when restoring the course, debugging shows:

Notice: Undefined property: stdClass::$questiontext in /home/benedu/public_html/question/type/formulas/questiontype.php on line 979

Could not restore categories and questions!

 

Any help will be apreciated. Thanks.

In reply to Bernat Martinez

Re: Formulas question type - problem found

by Jean-Michel Védrine -

Hello,

Unfortunately I never looked at the backup/restore code in formulas 2.0 for Moodle 1.9. The first backup/restore code I wrote is the code in formulas 3.0 for Moodle 2.0 (wich is nearly identical to the code I use in my version of formulas for Moodle 2.3/2.4)

Line 979 is in the validate method so most likely the sign that restored data are damaged. But it's impossible to diagnoze the problem without further study. Maybe something went wrong during backup, or during restore ? As I say impossible to say without further study.

If you backup is not too big, and if you are OK you can send it to me (send me a private message so that I send you a mail adress to send the file, don't use my adress at the University, it will fail !).

But I can't promise anything because as I said I never studied the 1.9 backup/restore code and also my time is now limited because courses have started again.

Additionally I prefer to spend time on improving the version for Moodle 2.3/2.4.

Last thing: if your backup file is correct and if your problem is during restore, formulas for Moodle 2.3/2.4 should be able to restore it (of course not attempts, questions and quiz only) because the code is entirely different. So this is another reason why I am interested in testing your backup file.

In reply to Jean-Michel Védrine

Re: Formulas question type - problem found

by Bernat Martinez -

Thanks, Jean Michel, I've already send you a message 

In reply to Bernat Martinez

Re: Formulas question type - problem found

by Jean-Michel Védrine -

I have received Bernat's file and began testing.

The first very good thing is that this file restore without any problem in Moodle 2.3/2.4 using my latest version of formulas. So the backup file is not damaged at all and my code to restore 1.9 backups is working big grin

Then I looked at the restore code in formulas 2.0 for moodle 1.9 and I am puzzled. Given the over-zealous verifications the code is doing I think ALL restore including formulas question MUST fail.

Has anybody using formulas with Moodle 1.9 been able to restore a course with formulas questions ? I don't think so ! The code to import an XML export of formulas questions is OK but the code to restore a backup is wrong.

Despite I don't want to spend too much time on formulas 2.0 for Moodle 1.9, I think I must release a corrected version as a service to long time users. I have already done a patch that seems to work. I will do some more tests and release a 2.01 version of formulas ASAP.

Note : a few days ago I was asking myself a question "How many users of formulas question are there in the word ?". I know that anat peri is using them a lot, I know that I use them too, some years ago mana mboh was using them (and he did wonderfull things using asciimath and asciisvg to include graphics in his questions, this gave me the idea to do the same thing in mine) but he is no more subscribed to that forum. Can all users post a short message ? Thanks.

In reply to Jean-Michel Védrine

Re: Formulas question type - problem found

by mana mboh -

Hi  Jean-Michel,

Just to say that I still following developments even if I don't appear to be here.

Well done for the work developing the latest Formulas plugin. 

I have managed to install it on a clean moodle 2.4.1 setup but cannot manage to get it to install on plugin-laden oft-upgraded setups...

Mana

In reply to mana mboh

Re: Formulas question type - problem found

by Jean-Michel Védrine -

Hello mana,

It's good to see you are still following this thread smile

As I said I found you idea to use asciimathml and asciisvg with formulas questions excellent and I never had this idea before seeing your post some time ago.

And now that global (and local variables too for part's feedback) can be included in general feedback, combined feedback and hints I use it quite a lot because it permit me to show the solution to the students with the values they get for the question, including in math formulas and in graphics. Very cool !

Some important note to users of formulas 2.0 for Moodle 1.9, formulas 3.0 for Moodle 2.0, and the beta version I released for Moodle 2.3/2.4.

If you go to my github account, you will see that there are now different branchs. This is because after finding bugs in backup/restore of 2.0 and 3.0 versions of formulas, I decided to fix them. Be sure to download the right version or you will be in big trouble !

branch MOODLE_19_STABLE -> formulas 2.x for Moodle 1.9.x

branch MOODLE_20_STABLE -> formulas 3.x for Moodle 2.0.x

branch master -> formulas 4.x for Moodle 2.3/2.4

The other branchs are not in a stable state and should not be used.

One branch is not done yet and is important : the branch for Moodle 2.2.x

It is important because this is the step that will permit people to upgrade from older branchs

For people using Moodle 1.9, the steps will be

Moodle 1.9 -> Moodle 2.2 -> Moodle 2.3 or 2.4

For people using Moodle 2.0 the steps will be

Moodle 2.0 -> Moodle 2.2 -> Moodle 2.3/2.4

But as long as the branch for Moodle 2.2 is not done, don't attempt to upgrade because it will not work !!!!

 

In reply to Jean-Michel Védrine

Re: Formulas question type - problem found

by mana mboh -

Hi Jean-Michel,

You may recallmy issues installing "formulas" on my establised.

I finally decided it is worth starting over with a new installation to include "formulas" and then plugin other modules.  I think its worth exporting other questions (though not formulas yet!) from my old server.

As a maths teacher you will understand when I say I think you are working on possibly the should-be core maths question type - respect to Hon Wai who first created it.

I read from your post that you are using drawing scripts such as asciisvg? I would be interested to know which you are using and how they are set up as I have not been able to use them in any moodle ≥ 2.0.

As a work-around I investigated how to place text on an image(jpg,png...) using div tags but fell foul of css styles in themes displacing the text. Also to mention, the tedium of having to iterate trial-and-error to find the right coordinates.

Mana

 

In reply to mana mboh

Re: Formulas question type - problem found

by Jean-Michel Védrine -

Hello mana,

Here is the setup I use both on my local test install (Moodle 2.5 dev branch) and on my production server (Moodle 2.4.1).

I know I should not run formulas on my production server, but:

  • I like living dangerously
  • I am prepared to deal with problems when they appear
  • My students help me to find the bugs
  • It was interesting to build new formulas questions about probability (this is the subject of my courses this semester)

For all TeX and Asciimathml stuff I use MathJax. I find mimetex awfull;

But as I also want to use ASCIIsvg, and mathjax is currently not processing it, I can't get rid of the asciimath script.

I also use jsxgraph

So here si what is in my head additionnal HTML:

<script type="text/javascript" src="http://mywebsite/lib/asciimath/AM.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/2.0-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.94/jsxgraphcore.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.94/GeonextReader.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://mywebsite/lib/jsxgraph/distrib/jsxgraph.css" media="screen" />
<script type="text/javascript">
var AScgiloc = "http://mywebsite/lib/asciimath/php/svgimg.php";
var ASdloc ="http://mywebsite/lib/asciimath/d.svg";
var dsvglocation = "http://mywebsite/lib/asciimath/";
</script>

With this setup to make asciisvg create a drawing, I insert for instance:

<embed type="image/svg+xml" src="http://mywebsite/lib/asciimath/d.svg" script="
 initPicture(-6,6,-6,6);
 a = [-1,0];
 b = [-3,0.5];
 c = [3,0.5];
 d = [2,-5];
 text(a,&quot;{tc}&quot;,belowright);
 text(b,&quot;{t}&quot;,above);
 text(c,&quot;x&quot;,above);
 text(d,&quot;{u}&quot;,above);
 stroke = &quot;red&quot; ;
 circle([-2,0],3.5);
 stroke = &quot;blue&quot; ;
 rect([-5.8,-5],[5.8,5],null,.5,1);
stroke = &quot;purple&quot; ;
 circle([2,0],3.5);
 " class="ASCIIsvg" height="200" width="200" />

And when {tc}, {c} and {u} have values randomized by formulas I get a little diagram like:

diagram

In reply to Jean-Michel Védrine

Re: Formulas question type - problem found

by mana mboh -

Thanks Jean-Michel,

This exactly what I needed to completely upgrade. As it happens I have recently taught venn diagrams and would have loved to add to my question bank then.

I will try to replicate your diagram but for that I will need to disable tinymce's security. My experience is that it does not allow me to save any html including the embed tag for one, and possibly other apparent "open doors".

How did you overcome that?

Mana

In reply to Jean-Michel Védrine

Re: Formulas question type - problem found

by Stephen Webb -

Hi Jean-Michel,

Just wanted to let you know that we've been testing the formulas question type on Moodle 2.3.3, and it's wonderful!

Thank you for all your hard work on this: it's opening up lots of possibilities for us.

In reply to Jean-Michel Védrine

Formulas question type and graphs

by Bernat Martinez -

Hi Jean-Michel, 
I have tried to include graphs in the formulas question using the chart.apis.google and including random variables {x1},{x2} and it works fine.

This is the code and the result is in the attachment

 <b>A partir de la gráfica escribe la ecuación de la recta</b><br /> <img vspace="0" hspace="0" border="0" title="a" alt="a" src="http://chart.apis.google.com/chart?cht=lc&chd=t:{x1},{x2}&chco=FF0000&chg=10,10&chs=300x300&chxt=x,y,x,y&chxl=0:%7C0%7C2%7C4%7C6%7C8%7C10%7C1:%7C0%7C2%7C4%7C6%7C8%7C10%7C2:%7C%7Cx%7C3:%7C%7Cy<http://chart.apis.google.com/chart?cht=lc&chd=t:%7Bx1%7D,%7Bx2%7D&chco=FF0000&chg=10,10&chs=300x300&chxt=x,y,x,y&chxl=0:%7C0%7C2%7C4%7C6%7C8%7C10%7C1:%7C0%7C2%7C4%7C6%7C8%7C10%7C2:%7C%7Cx%7C3:%7C%7Cy>" /><br />

Attachment Captura de pantalla 2013-04-01 a la(s) 11.39.45.png
In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by anat peri -

despite the problems it is a brilliant plugin and I love working with him.
there is a problem that it is desirable to solve.
I ask the children to enter the formula for calculating
such a formula calculation of power through the current and voltage.

In this case, the order of writing makes the difference
but in the case of calculating the current through the voltage and power should be allowed to change the order of writing.
I send the slide to form a question and below - two options, one (obviously wrong), both of which are marked as correct.

Attachment power,current,voltage.gif
In reply to anat peri

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by Jean-Michel Védrine -

Hello anat,

At first I had some trouble understanding all the hebrew characters wink but I think I understand enough to explain the problem.

The formulas question type accepts both questions with numeric answers and with algebraic answers. When the answer is an algebraic expression (like in your question P/U) you must understand how formulas qtype decides if the student's answer is exact or wrong.

Contrary to Moodle question type like Stack, formulas don't unclude a computer algebra system (also called a cas, stack use maxima as cas) so it use evaluation and if the student answer and the teacher answer give the same results for all evaluation points then the student answer is considered as exact.

But it's the teacher's responsability when he writes the question to give good evaluation points.

In your question you give P ={1}; U={1} this is not good at all because both P/U and U/P will evaluate to the same value for your unique evaluation point.

look at Example 5 on Hon Wai Lau's website : to check if the student's answer is sqrt(x^2+y^2) it uses x={1:10}; y={-10:10:0.1}; the chance that the student's answer would be different from sqrt(x^2+y^2} but gives the same values for all the evalution points are pretty small !!

But there is a warning : as said in example 5 "The set of points must be in the valid domain of the formula".

Imagine that reading this message you choose :

P={1:10};

U ={-10:10:0.1}

It will not works because U will take the value U=0 wich will not be good in the P/U evaluation surprise !

So you must take care that 0 is not included in the values for U, for instance U={1:10:0.1} will works.

In reply to Jean-Michel Védrine

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by Jean-Michel Védrine -

Here is another example of a formulas question with an algebraic answer

This example is extracted from Hon Wai Lau's examples file but slightly reworked as the original one had a problem.

Random variables
k1 = {2,3,4,5};
k2 = {2,3,4,5};
k3 = {2,3,4,5};
Global variables
(empty)
Question Text
 Answer type - Algebraic formula : You can type in every numerical formula and any algebraic variables.
Note that the format check will not tell you which variables are correct, so if you want to hint student about the symbol, you should write them explicitly.
Only 1 subquestion
Local variables
a = {-100:100:1};
b = {-100:100:1};
Answer type
Algebraic formula
Answer
["k1/k3 a","k2 b"]
Grading criteria
_err < 1e-10
Subquestion text
What are the roots of the equation {k3}x2 - ({k1} a + {=k2*k3} b)x + {=k1*k2} a b?

x = {_0}, or

x = {_1}

One instanciation of the question may display something like this to the student :

algebraic formulas

(this display is extracted from my work in progress in Moodle 2.3 and as you see there are still some glitches : for instance the "Mark: 0/2" should not be here blush as the question is unanswered !!)

As you can see the system has choosen k1= 5;k2=3; k3=5 for this instance of the question.

Let's now imagine a clever student uses roots' sum and product and calculate that the 2 roots are a and 3b, if he enters these values he will be rewarded by a "Correct Mark 2.00 of 2.00" but let's examine how the system decided the response was correct : simple because of the assignments

a = {-100:100:1};
b = {-100:100:1};

His response will be evaluated for each of these values and if it is equal to the model ["k1/k3 a","k2 b"] it will be cosidered as correct.

Note : there is a caveat in this question as I have presented it here : the roots need to be entered in a certain order to be considered as corrects, if the student enter "3b" and "a" his response will be considered as false. I think it is quite possible to modify the question to overcome this problem but I didn't took the time to look at it.

In reply to Jean-Michel Védrine

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by Itamar Tzadok -

Jean-Michel, are you planning to port this qtype to 2.3 or do you know of anyone who is working on that? smile

In reply to Itamar Tzadok

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by Jean-Michel Védrine -

Hello Itamar,

I am porting this to 2.1/2.2/2.3 (in fact I am porting this to Question engine 2 smile). As I use Moodle 2.3 , it will be likely the first released version, then I will backport to 2.1/2.2 if possible.

1.9 version was enterely done by Hon wai Lau

I did most of the work needed to make it compatible with 2.0, but of course this was a small step compared to the changes needed for QE2.

I already worked on it during 2011 summer (summer is the only time where I can work on projects like this). I left it alone when summer holydays finished in september 2011 and I resumed my work 2 weeks ago.

The bad side of this long break is that I had forgotten a lot of details of my 2011 work, so I had to learn again how the code works.

But the good side is that in the meantime my understanding of QE2 is I hope somewhat better. Also while reading the 2011 code, I found some bugs smile.

And more important, the really good side is that in the meantime Tim has worked on the Stack questiontype and I can use his adaptive multipart behaviour, also as Stack is the only question type I know whose complexity exceeds that of formulas, now when I wonder how to do something I thinks "let's see how it's done in Stack ..."

I must admit I like Stack a lot (I have installed the recently released version and played with it). But as all I can afford for my production website is a 10$/month shared hosting, I know I won't be able to use Stack with my students, so this is why I decided about a year ago to work on formulas as a "poor man's Stack".

I should add that for a physics teacher a big advantage of formulas over Stack is the ready to use units conversion system, but as I teach maths Stack would permit quite a lot of questions that I can't see how to do with formulas.

Last thing : as I work on this on a very slow pace, no release date can be given. In fact it is nearly working since september 2011 in non interactive and non adaptative behaviours (still need work on the rendered where the code is a big mess) but a lot of code need to be refactored and adaptative/interactive modes need a really good work (the problem is to correctly grade each question's parts and to output corrects feedbacks for each part).

The screenshot in my previous message was done in Moodle 2.3.1+ with the actual state of my code in interactive with multiple tries behaviour and clearly the "Mark: 0/2" display is wrong as the question is not yet answered. This question has only 1 "part" and the vector answer dimention is 2 but even in that simple case there are errors in the renderer display.

In reply to Jean-Michel Védrine

Re: תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by Itamar Tzadok -

Thanks Jean-Michel. I've been asked about porting this qtype but since you are already working on it I suppose I can explore other (stackless) approaches to a similar effect. smile

In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by anat peri -

hello jean-Michel.

thank you for your answer. 

I probably did not explain himmyself to the end. I want the student wrote the correct formula for calculations. but your response prompted me the right way - do not give the same value for both parameters. Now I asked the different values for U and P, and get the right answers.
thanks for the help

Attachment ScreenHunter_12 Jul. 15 22.44.gif
In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by anat peri -

hello, jean-Michel.

1.we are using moodle 2 & formulas question 3.0

"But I remember somebody reported something" yes/ my admin is Lev Abramov and I asked for him to rreport you because my english is bad.

i/ll send you some examples//

I created a test of the two questions.
I changed the status to "student" and responded to these questions, but not passed the test completely (not pressed the Finish review).

THe first question was made with an error, so the score for it have to be 30 instead of 50.
The second question was made exactly to the estimate 50.
the slide "Showing graded and ungraded attempts for each user," you can see that there exists an estimate only for the second question (50), and the site of the first issue (which was answered).

i can't attach more than 1 file, so i'll send it in the next message.

- slide "first" and "first") - an empty space.
In addition, the slides are not "first" and "second" vydny History of responses:
- 12:21:54 on 15/07/12 verified answer to the first and the second question.
-12:22:56 On 15/07/12 and again checked the answer to the first and the second question.
If the test is not 2 and 10 questions, each question when applying proveryaetyutsya all 10 questions, but howing graded and ungraded attempts for each user affects only the last question.
I apologize for my English.

 

Attachment Showing graded and ungraded attempts for each user.gif
In reply to anat peri

תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by anat peri -

i'm sending more slides

Attachment first question+.gif
In reply to anat peri

תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by anat peri -

the last one

Attachment second question+.gif
In reply to anat peri

Re: תשובה ל: Re: Formulas question type - another problem found

by Jean-Michel Védrine -

Hello anat,

I have not yet studied you recent answers but this is an answer at the first problem you reported in your July 12th message.

When you say that "adding images to Subquestion text. uploaded images are not reflected in the question."

do you mean that backup/restore of images in subqtext is not working ?

If yes this is quite understandable because backup/restore of images in subquestions is broken in the formulas-3.0.zip that you can download from Hon Wai Lau's website.

I have attached to this message the version of formulas 3.0 that I use and backups/restore works fine for me including images in subquestion text and subquestions feedbacks.

Please can you replace the files you are using with this ones and tell me if it solves your problems

the only changes are in question/type/formulas/backup/moodle2: and in the question/type/formulas/questiontype.php file.

If it don't solve your problem, can you give me enough informations so that I can reproduce the problem on my system ? Thanks.

In reply to Jean-Michel Védrine

תשובה ל: Re: תשובה ל: Re: Formulas question type - another problem found

by anat peri -

hello, Jean-Michel/

thanks for yuor answer. i'll send it to my admin for replacing the files and will try it.

now i have another problem. i need to make question for transfering the binary or decimally number to hexadecumaly.

for this i want to use the formulas plugin, but somesing is wrong in my sintax, because when the number is 0-9 it works, 

but when the number is 10-15 and the answer is not number , but letter - i have problem. in feedback i give the wright answer.

may be it need another structure? help please/

Attachment question to forum.GIF
In reply to hon wai lau

Re: Formulas question type

by Luís Cláudio :-) -
Hello all ... I have performed as written in the instructions, but after it was installed formula for Moodle 1.9, the categories are no longer accessible. This has happened before? After completing the installation it "said" everything was successful, but there was this side effect. Does anyone know how to solve this problem?
In reply to Luís Cláudio :-)

Re: Formulas question type

by Jean-Michel Védrine -

Hello Luis,

What is your precise Moodle version ?

What is the exact version of the formulas question type that you have installed ?

Are yoiu sure there is no mismatch between those 2 versions ?

In reply to hon wai lau

תשובה ל: Formulas question type

by Lior A -

Hi,

I installed the examples (2.0 version on moodle 1.9+), but when I translated the text to Hebrew, I got "??????" instead on Hebrew text.

The Question text is OK (Hebrew is shown), but in the Subquestion text  (where { } is used), question marks replace the Hebrew latters.

Is there any way to fix it?

Thanks,

Lior

In reply to Lior A

Re: תשובה ל: Formulas question type

by Jean-Michel Védrine -

Hello Lior,

This is quite surprising because I think Hon Wai have tested it with Japanese language so I can't see why it would not works with Hebrew language. Unfortunately I don't know how to test the problem as it will be really uneasy for me to switch my Moodle to hebrew language ??

In reply to hon wai lau

Re: Formulas question type

by Jean-Michel Védrine -

Hello to all users of the formulas question type.

I am planning a little change to the formulas question type: my experiences using it for my probability course show that it would help a lot if I add some functions to the list of available functions

I am planning to add fact( n ) (factorial function), comb(n, r)  (combinations), perm(n, r) (permutations)

This is the first time I make some changes to the variables unit written by Hon Wai Lau but after studying it I think I am able to do that without breaking it.

Is there any other function that you would like to be added at the same time ?

Average of ratings: Useful (1)
In reply to hon wai lau

Tárgy: Formulas question type

by imre zsolt -

Hi,

I think this (and its pair by Jean-Michelle) is the best plugin for moodle, with this plugin all needs of elementary maths (+physiscs/chem) can be solved easily.

One question is on the design side: how (if anyhow) can I change the size (width or length) of answer boxes ? the _1, _2 etc

In most cases the simple numerical answers needs only 2-6 digits, but the input box is 20-25 digit long, so it is very hard to implement an inline question with this size.

thx for support !

Zs