Examples of algebra syntax

Examples of algebra syntax

על ידי Zbigniew Fiedorowicz בתאריך
מספר תגובות: 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@@
ממוצע דרוגים: -
בתגובה ל: 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.
בתגובה ל: 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

בתגובה ל: 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@@ .
בתגובה ל: 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.

בתגובה ל: 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
בתגובה ל: 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
בתגובה ל: 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.
בתגובה ל: Lars Jensen

Re: Examples of algebra syntax

על ידי Zbigniew Fiedorowicz בתאריך
How about $$\frac{x}{(x+1)(x-1)}$$?
בתגובה ל: 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.
בתגובה ל: 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.
בתגובה ל: 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.

בתגובה ל: 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

בתגובה ל: 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.
בתגובה ל: 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.
בתגובה ל: 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.

בתגובה ל: 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$$
בתגובה ל: 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

בתגובה ל: 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}
בתגובה ל: 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.
בתגובה ל: 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....



בתגובה ל: 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)@@

בתגובה ל: 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.
בתגובה ל: 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.
בתגובה ל: 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.

בתגובה ל: 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.
בתגובה ל: 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
בתגובה ל: 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

בתגובה ל: 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

בתגובה ל: 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|
בתגובה ל: 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 

בתגובה ל: Jo Lopez

Re: Examples of algebra syntax

על ידי Ricardo Dias בתאריך

just want to try! מאשר

 

@@x^2@@

 

בתגובה ל: 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.
בתגובה ל: 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

בתגובה ל: 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\}$$
בתגובה ל: 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
בתגובה ל: 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.