Mathematics tools

Examples of algebra syntax

 
 
Picture of Zbigniew Fiedorowicz
Examples of algebra syntax
 

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@@
 
Average of ratings: -
Picture of Lars Jensen
Re: Examples of algebra syntax
 
Hi Zig,

Great job!

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

Lars.
 
Average of ratings: -
Picture of Zbigniew Fiedorowicz
Re: Examples of algebra syntax
 

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

 
Average of ratings: -
Picture of Yip wing chiu
Re: Examples of algebra syntax
 
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@@ .
 
Average of ratings: -
Picture of Zbigniew Fiedorowicz
Re: Examples of algebra syntax
 

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.

 
Average of ratings: -
Picture of Sergio Di Fiore
Re: Examples of algebra syntax
 
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
 
Average of ratings: -
Picture of Sergio Di Fiore
Re: Examples of algebra syntax
 
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
 
Average of ratings: -
Picture of Lars Jensen
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
Picture of Zbigniew Fiedorowicz
Re: Examples of algebra syntax
 
How about $$\frac{x}{(x+1)(x-1)}$$?
 
Average of ratings: -
Picture of Lars Jensen
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
Picture of Zbigniew Fiedorowicz
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
Picture of Lars Jensen
Re: Examples of algebra syntax
 
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.

 
Average of ratings: -
Picture of Zbigniew Fiedorowicz
Re: Examples of algebra syntax
 

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

 
Average of ratings: -
Picture of Lars Jensen
Re: Examples of algebra syntax
 
Hi Zig,

Tried it out - it works wonderfully!

Thank you so much,
Lars.
 
Average of ratings: -
Picture of Frank Park
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
Picture of Marc Grober
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
At work
Re: Examples of algebra syntax
 

Hi!

How can i display literally the dollar signal : $ 

Today if i type a dollar it is parsed as a algebric notation.

Thank's in advance

 
Average of ratings: -
Đồng Quốc Vương
Re: Examples of algebra syntax
 
@@asin(x/y)@@
test
 
Average of ratings: -
Picture of Richard Williamson
Re: Examples of algebra syntax
 
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.

 
Average of ratings: -
Picture of Zbigniew Fiedorowicz
Re: Examples of algebra syntax
 
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$$
 
Average of ratings: -
Picture of Richard Williamson
Re: Examples of algebra syntax
 

Just what I was looking for.

Thanks Zig smile

 
Average of ratings: -
Picture of Yew Rong-shyang
Re: Examples of algebra syntax
 

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

     98
    ×76
    588
  6860
  7448

 
Average of ratings: -
Picture of John Forkosh
Re: Examples of algebra syntax
 
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 \
 
Average of ratings: -
Picture of Yew Rong-shyang
Re: Examples of algebra syntax
 

Thanks John,it's helpful~~~~~

$$thank^{n} \Rightarrow x= \infty$$

 
Average of ratings: -
Picture of Frank Park
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
Picture of Marc Grober
Re: Examples of algebra syntax
 
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....



 
Average of ratings: -
Picture of S Moodle
Quadratic Formula?
Group Particularly helpful Moodlers

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)@@

 
Average of ratings: -
Picture of Lars Jensen
Re: Quadratic Formula?
 
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.
 
Average of ratings: -
Picture of Frank Park
Re: Quadratic Formula?
 
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.
 
Average of ratings: -
Picture of Michelle Ricketts
Re: Examples of algebra syntax
 
Thank you thank you thank you!!!

You answered my question before I even asked it.
This is exactly what I was looking for

approveMichelle
 
Average of ratings: -
Picture of Fred Portier
Re: Examples of algebra syntax
 

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.

 
Average of ratings: -
Picture of Gustav W Delius
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
Picture of Gregory Gorny
Re: Examples of algebra syntax
 
Hi,

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

Thank You very much for any answer.

Grzegorz Górny
 
Average of ratings: -
Picture of Gregory Gorny
Odp: Re: Examples of algebra syntax
 
Me again ;)

I've found what I was looking for..

thanks anyway..

Greg


 
Average of ratings: -
Picture of Fei Zheng
Re: Examples of algebra syntax
 

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

 
Average of ratings: -
Picture of javi gallego
Matrix
 

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

 
Average of ratings: -
Picture of Yakov Keselman
Re: Matrix
 
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|
 
Average of ratings: -
Picture of Jo Lopez
Re: Examples of algebra syntax
 

hello Zig

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

thank you

Georges 

 
Average of ratings: -
Picture of Ricardo Dias
Re: Examples of algebra syntax
 

just want to try! approve

 

@@x^2@@

 

 
Average of ratings: -
Picture of rigwarl back
Re: Examples of algebra syntax
 
$$\int_{0}^{\infty}f(x)dx$$
 
Average of ratings: -
Picture of John Isner
Re: Examples of algebra syntax
 
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.
 
Average of ratings: -
Picture of Jerald Calinisan
subscript syntax
 

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

 
Average of ratings: -
Picture of John Isner
Re: subscript syntax
 
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\}$$
 
Average of ratings: -
Picture of Jerald Calinisan
Re: subscript syntax
 
Thank you very much John for your answer. One more question please... How can mixed number eg: 3 and 1/4
 
Average of ratings: -
Picture of John Isner
Re: subscript syntax
 
$$$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.
 
Average of ratings: -