7x = 3x + 24 (calculated)

7x = 3x + 24 (calculated)

Ahmad Amer -
回帖数:13

Salam Alykom

I created the following:

\( {a} \times x = {b} \times x + {c} \)

 with the following answer formula: {c} / ({a} - {b})

 Few questions:

1) Am I doing right?

2) Should I use calculated or calculated simple

3) Is it possible to make sure that x - ({c} / ({a} - {b}) - is always positive and an integer (no fractions or decimals)


Shukran - thank you

回复Ahmad Amer

Re: 7x = 3x + 24 (calculated)

Dominique Bauer -
Documentation writers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

And peace be upon you, too.     وَعَلَيْكُمُ ٱلسَّلَامُ

You should use the "Calculated" question type.

The equation to solve is:

\[{ax=bx+c}\]

Rearranging, we have:

\[{x=\dfrac{c}{a-b}}\]

Let \({a-b}\)  be equal to a positive integer, say:

\[{a=b+d}\]

Where \({x}\), \({b}\) and \({d}\) are random positive integers from three ranges (identical or different from one another), for example:

\[{x=\{3:13\}}\]

\[{b=\{3:13\}}\]

\[{d=\{3:13\}}\]

To write the equation in the question text, it is easier to use MathML rather than LaTeX because LaTeX has {} which interferes with the variables of the Calculated question, while MathML does not have {}.

The HTML code of the question text should therefore look like this:

<p>
    Solve the following equation for <math style="font-family:stix"><mstyle mathsize="18px"><mi>x</mi></mstyle></math>:
</p>

<p style="text-align:center;">
    <math style="font-family:stix"><mstyle mathsize="18px"><mn>{=({b}+{d})}</mn><mi>x</mi><mo>=</mo><mn>{b}</mn><mi>x</mi><mo>+</mo><mn>{={x}*{d}}</mn></mstyle></math>
</p>

The rest is pretty standard. I have attached an XML file for your question.

回复Dominique Bauer

Re: 7x = 3x + 24 (calculated)

Ahmad Amer -
Thank you very much Dominique.
It works very well.

I wonder whether there are available MathML resources of other codes for different math questions that can be used automatically as HTML codes!
回复Ahmad Amer

Re: 7x = 3x + 24 (calculated)

Dominique Bauer -
Documentation writers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像
Hello Ahmad,

Here (moodleformulas.org)  you will find an exhaustive list of free online editors to get the LaTeX and MathML codes of an equation.

With some of these editors, you can enter the equations by hand (MyScript) or capture an equation displayed on any web page (EquatiIO). Quite nifty.    

Did I understand correctly and answer your question?
回复Dominique Bauer

Re: 7x = 3x + 24 (calculated)

Ahmad Amer -

I have tried the following but it did not work as expected!!

附件 IMG_1613.jpg
附件 IMG_1614.jpg
回复Ahmad Amer

Re: 7x = 3x + 24 (calculated)

Dominique Bauer -
Documentation writers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像
Hello Ahmad,

Sorry. Actually, the roots are -5 and 3.
回复Dominique Bauer

Re: 7x = 3x + 24 (calculated)

Ahmad Amer -
When I click on "FILL ON CORRECT RESPONSES" it gives 1 and 1 !!!

These are the correct answers in my moodle after importing the xml file !!1
回复Ahmad Amer

Re: 7x = 3x + 24 (calculated)

Dominique Bauer -
Documentation writers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像
Hello Ahmad,

Attached is the corrected XML file.

回复Dominique Bauer

Re: 7x = 3x + 24 (calculated)

Ahmad Amer -
Thanks Dominique,
It accepts the answers -5 3
but not 3 -5
!
回复Ahmad Amer

Re: 7x = 3x + 24 (calculated)

Ahmad Amer -
and one more question (not related to the above)
In the link https://moodleformulas.org/login/index.php the username and password appears automatically without typing them. How to do this?
回复Ahmad Amer

Re: 7x = 3x + 24 (calculated)

Dominique Bauer -
Documentation writers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像
回复Dominique Bauer

Re: 7x = 3x + 24 (calculated)

Ahmad Amer -
Thanks Dominique,
This one gives the answers 1 and 1 too.
When I click on "FILL ON CORRECT RESPONSES" it gives 1 and 1 !!!

These are the correct answers in my moodle after importing the xml file !!1

I can see: Grading criteria* (_0 == root1 && _1 == root2) || (_0 == root2 && _1 == root1) but the answers are 1 and 1!!!