Examples of algebra syntax

Examples of algebra syntax

โดย Zbigniew Fiedorowicz -
Number of replies: 44

InputOutput
@@@x^2@@@@@x^2@@
@@@A=pi r^2@@@@@A=pi r^2@@
@@@dy/dx=3x^2/y^3@@@@@dy/dx=3x^2/y^3@@
@@@asin(x/y)@@@@@asin(x/y)@@
@@@int(x/(x^2+4) dx)@@@@@int(x/(x^2+4) dx)@@
@@@int(x/(x^2+4) dx,0,1)@@@@@int(x/(x^2+4) dx,0,1)@@
@@@sqrt(x^2+y^2)@@@@@sqrt(x^2+y^2)@@
@@@sqrt(x^2+y^2,3)@@@@@sqrt(x^2+y^2,3)@@
@@@x>=1@@@@@x>=1@@
@@@x<=pi@@@@@x<=pi@@
@@@x<>infty@@@@@x<>infty@@
@@@cos(x,2)+sin(x,2)=1@@@@@cos(x,2)+sin(x,2)=1@@
@@@cosh(x,2)-sinh(x,2)=1@@@@@cosh(x,2)-sinh(x,2)=1@@
@@@lim((x-2)/(x^2-4),x,2)=1/4@@@@@lim((x-2)/(x^2-4),x,2)=1/4@@
@@@lim(x/(x^2+1),x,infty)=0@@@@@lim(x/(x^2+1),x,infty)=0@@
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Lars Jensen -
Hi Zig,

Great job!

Is there any way to avoid the superfluous parentheses in the denominators of some of these expressions?

Lars.
การประเมินโดยเฉลี่ย: -
In reply to Lars Jensen

Re: Examples of algebra syntax

โดย Zbigniew Fiedorowicz -

Is there any way to avoid the superfluous parentheses in the denominators of some of these expressions?

No, not the way the filter currently works. It relies on the WeBWorK parsing engine, which puts in the extra parentheses.  Martin doesn't like it either, because it's written in Perl.sad

การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Yip wing chiu -
Excellent! Thank you very much. Now I can post mathematical expression to my students. I want to know where I can find the whole set of functions/constants/greek chars list. I found that pi is @@pi@@ but alpha is not @@alpha@@ .
การประเมินโดยเฉลี่ย: -
In reply to Yip wing chiu

Re: Examples of algebra syntax

โดย Zbigniew Fiedorowicz -

Currently @@pi@@ is the only Greek letter that the algebra filter recognizes.  It would not be difficult to add other Greek letters to the list of allowed constants/variables.  However the algebra filter is really meant to handle only very simple expressions.  More complicated expressions are supposed to be handled with the TeX filter.  For instance $$$\alpha$$$ => $$\alpha$$.  You can use the algebra debugger I posted here to translate a calculator type algebraic expression into TeX, edit it manually to add extra symbols, delete unwanted parentheses,  etc., then paste it within double dollar signs to be handled by the TeX filter.

A long term goal that Martin and Janne are hoping to realize is to integrate a mathematics editor into the HTML Editor to output MathML.

การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Sergio Di Fiore -
As for the Π, I found it very small, and was not able to resize... After all, I just used the HTML &Pi; and workr very clean and well.

Actually, a lot of things can be done that way, without much processor use approve
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Sergio Di Fiore -
As for the Π, I found it very small, and was not able to resize... After all, I just used the HTML &Pi; and workr very clean and well. Actually, it is how it's done here...

Actually, a lot of things can be done that way, without much processor use approve
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Lars Jensen -
It seems like all that is needed to remove the superfluous parentheses is to strip the outer pair parentheses (if they exist) from any denominator.

Lars.
การประเมินโดยเฉลี่ย: -
In reply to Lars Jensen

Re: Examples of algebra syntax

โดย Zbigniew Fiedorowicz -
How about $$\frac{x}{(x+1)(x-1)}$$?
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Lars Jensen -
Hi Zig,

You produced this with the TeX filter, right? My comment went on the calculator filter - not the tex filter.

It is hard to produce the above expression with the calculator filter - correct me if I'm wrong. For an expression like the above, most students will enter, @@@x/((x+1)(x-1))@@@ to produce this:

@@x/((x+1)(x-1))@@

Wouldn't stripping the first \left and the last \right  from the tex-translation of the denominator of a calculator notation expression solve this problem?

Lars.
การประเมินโดยเฉลี่ย: -
In reply to Lars Jensen

Re: Examples of algebra syntax

โดย Zbigniew Fiedorowicz -
OK, you've convinced me. I've now added an extra transformation rule to the filter to strip out the outermost parentheses in denominators. I've posted the updated filter to the CVS.
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Lars Jensen -
Hi Zig,

There does seems to be a problem here - I think I may be coming around to your original point of view that it may be problematic to remove any parentheses:

Check out these:
@@@1/( (c+d)/(e+f) )@@@, which produces: @@1/( (c+d)/(e+f) )@@
@@@1/( (c+d)/(e+f)/(g+h) )@@@, which produces: @@1/( (c+d)/(e+f)/(g+h) )@@
@@@1/( (c+d)/(e+f)(g+h) )@@@, which produces: @@1/( (c+d)/(e+f)(g+h) )@@

Lars.

การประเมินโดยเฉลี่ย: -
In reply to Lars Jensen

Re: Examples of algebra syntax

โดย Zbigniew Fiedorowicz -

Hi Lars,

I think I've pinpointed the place in WeBWorK's AlgParser.pm where the superfluous parentheses are added to fractions. Try the new cvs algebra filter.

Zig

การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Frank Park -
How were you able to show that expression so cleanly?  Is that latex or mimetex?  I am trying to render equations cleanly like that but all I can do is display mimetex which is quite rigid.
การประเมินโดยเฉลี่ย: -
In reply to Frank Park

Re: Examples of algebra syntax

โดย Marc Grober -
Frank,

Please stick to your other thread where I have posted info about open_basedir.
As I said, you are not getting anything from the tex binaries and are getting the results of mimetex only.
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Richard Williamson -
Zig, is there a way of whowing a standard x for multiplication?

What I want to show is @@(3.72 x 5.13)/0.2=1.4   with the x appearing as a times sign.
This is for a GCSE exam practice and is needed for an example.

การประเมินโดยเฉลี่ย: -
In reply to Richard Williamson

Re: Examples of algebra syntax

โดย Zbigniew Fiedorowicz -
You can't do it currently in algebra syntax.  You can do it with TeX:
$$$(3.72\times 5.13)/0.2=1.4$$$ => $$(3.72\times 5.13)/0.2=1.4$$
or
$$$\frac{3.72\times 5.13}{0.2}=1.4$$$ => $$\frac{3.72\times 5.13}{0.2}=1.4$$
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Yew Rong-shyang -

Hi,Zbigniew Fiedorowicz :
Would please show me below in TeX syntax(or algebra),thank you very much!

     98
    ×76
    588
  6860
  7448

การประเมินโดยเฉลี่ย: -
In reply to Yew Rong-shyang

Re: Examples of algebra syntax

โดย John Forkosh -
TeX syntax $$$\Large \begin{array}{r} 98 \\ \times 76 \\ \hline 588 \\ 6860 \\ \hline 7448\end{array}$$$

renders

$$\Large \begin{array}{r} 98 \\ \times 76 \\ \hline 588 \\ 6860 \\ \hline 7448\end{array}$$

Oops. The copy of mimetex on moodle is several years old and doesn't seem to recognize \hline. Download a recent copy of mimetex from http://www.forkosh.com/mimetex.html which will render (with slightly better antialiasing and gamma video correction than the old version, too)

mimetex.cgi?\Large \begin{array}{r} 98 \\ \times 76 \\ \hline 588 \\ 6860 \\ \hline 7448\end{array}
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Frank Park -
How were you able to render that equation so cleanly? If I put that exact tex into my moodle site, it produces the equation very messy and jagged. If you can assist me to producing such clean tex, it would be of great help.
การประเมินโดยเฉลี่ย: -
In reply to Frank Park

Re: Examples of algebra syntax

โดย Marc Grober -
There may be some confusion.
The algebra filter parses text expressions using the webworks algebra parser, then essentially passes the results to the Moodle tex filter.
If you are writing TeX then there is arguably no reason to use the algebra filter. If you are looking for something simpler than TeX, then I would argue you look at asciimathml, but that is neither here nor there.

The display of your text expressions is handled either via your local tex installation, or if there is some issue with that, via the mimetex binary shipped with Moodle.

If your display, then, is problematic, I would suggest reviewing the docs on the tex filter and use the debug page to review your tex installation.

If you find issues with your tex install, I would post in a thread focusing on debugging tex, not in the algebra filter thread, though subscription is by forum, so everyone subscribed to this forum will see your post no matter where you post it....



การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Quadratic Formula?

โดย Sam Mudle -

I'm trying to get the quadratic formula in the algebra filter.

http://www.sosmath.com/algebra/quadraticeq/quadraformula/quadraformula.html

As you can see I'm not getting the result I want:

@@@(-b+sqrt(b^2-4ac))/(2a)@@@

gives

@@(-b+sqrt(b^2-4ac))/(2a)@@

การประเมินโดยเฉลี่ย: -
In reply to Sam Mudle

Re: Quadratic Formula?

โดย Lars Jensen -
Hi Jeremy,

Looks like the algebra filter is broken. Use tex instead:
$$$\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$$

gives,

$$\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$

Lars.
การประเมินโดยเฉลี่ย: -
In reply to Lars Jensen

Re: Quadratic Formula?

โดย Frank Park -
How were you able to render that equation so cleanly? If I put that exact tex into my moodle site, it produces the equation very messy and jagged. If you can assist me to producing such clean tex, it would be of great help.
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Fred Portier -

I am looking for a complete list of what is possible using the algebra filter. Is the set of examples above complete? I intend to use Moodle in a caclulus II class and I was thinking TeX may be too much to require.

การประเมินโดยเฉลี่ย: -
In reply to Fred Portier

Re: Examples of algebra syntax

โดย Gustav W Delius -
It is true that TeX is a very powerful syntax that can do almost anything. However TeX can also be very simply if you only need simple formulas. There is would advise you to use TeX syntax for your class. There are also new tools coming in a few weeks for getting an immediate preview of the typeset formulas as you type them in using TeX. These tools will not be available for the algebra syntax.
การประเมินโดยเฉลี่ย: -
In reply to Gustav W Delius

Re: Examples of algebra syntax

โดย Gregory Gorny -
Hi,

Where can I find those previews of the typeset formulas for TeX???

Thank You very much for any answer.

Grzegorz Górny
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Fei Zheng -

Hi, I've tried to input these algebra syntax in different activities such as Resource, Chat, Forum, Journal, etc. But they all show up like as I input, @@x^2@@ instead of math output. Could you tell me how to make it interpret as a math notation?

Thanks very much,

Fei

การประเมินโดยเฉลี่ย: -
In reply to Fei Zheng

Matrix

โดย javi gallego -

Hello, I want to know if this syntax suports matrix, in order to write something like this:

| 0 0 1 2 |
| 1 2 1 1 |
| 3 3 2 1 |
| 1 2 3 1 |

thank a lot

การประเมินโดยเฉลี่ย: -
In reply to javi gallego

Re: Matrix

โดย Yakov Keselman -
You can use this script: $$ \left| { \begin{array}{4} 0 & 0 & 1 & 2 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 1 & 2 \end{array} } \right| $$ Notes: You can replace each "&" with an "&". Use text mode. Watch out for disappearing backslashes (known bug). \left| { \begin{array}{4} 0 & 0 & 1 & 2 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 1 & 2 \end{array} } \right|
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

Re: Examples of algebra syntax

โดย Jo Lopez -

hello Zig

Is there a book, manual, file giving all the possible algebra syntaxes?

thank you

Georges 

การประเมินโดยเฉลี่ย: -
In reply to Jo Lopez

Re: Examples of algebra syntax

โดย Ricardo Dias -

just want to try! approve

 

@@x^2@@

 

การประเมินโดยเฉลี่ย: -
In reply to Jo Lopez

Re: Examples of algebra syntax

โดย John Isner -
Interesting.... I couldn't find any syntax reference for Algebra, only examples like the one at the beginning of this discussion. Even the official Moodle documentation on the Algebra filter doesn't contain any useful references.

Since Moodle translates Algebra notation to LaTeX, I recommend that you use the LaTeX language with the TeX filter. LaTeX is an international language, not a local dialect, and there are millions of good LaTeX references on the Web.

Don't wait for Zbigniew Fiedorowicz to reply. He is no longer subscribed to this forum.
การประเมินโดยเฉลี่ย: -
In reply to Zbigniew Fiedorowicz

subscript syntax

โดย Jerald Calinisan -

Sir good day:

Please help me how to write subscript in moddle quiz. I want to write that in Multiple choice space not on the feedback space.

Thank you

Jerry

การประเมินโดยเฉลี่ย: -
In reply to Jerald Calinisan

Re: subscript syntax

โดย John Isner -
Make sure the TeX filter is on. Then you can type most anywhere...

$$$\{a_1, a_2, a_3, a_4\}$$$

and it will display as

$$\{a_1, a_2, a_3, a_4\}$$
การประเมินโดยเฉลี่ย: -
In reply to John Isner

Re: subscript syntax

โดย Jerald Calinisan -
Thank you very much John for your answer. One more question please... How can mixed number eg: 3 and 1/4
การประเมินโดยเฉลี่ย: -
In reply to Jerald Calinisan

Re: subscript syntax

โดย John Isner -
$$$3 \frac{3}{4}$$$

displays as

$$3 \frac{3}{4}$$

You need a good LaTeX reference sheet, like this one.

If you don't want to learn LaTeX, you can also use DragMath. It is a WYSIWYG equation editor that launches from the Moodle HTML editor toolbar. It creates the LaTeX for you.
การประเมินโดยเฉลี่ย: -