Algebra filter and negative numbers

Algebra filter and negative numbers

by Jennifer Cass -
Number of replies: 6

Hi-

I'm having trouble with inequalities that have negative numbers:

@@@x<>-2@@@, @@@x<=-2@@@ and @@@x>=-2@@@ all give @@x-2@@.

Any suggestions?

Thanks.

-Jennifer

Average of ratings: -
In reply to Jennifer Cass

Re: Algebra filter and negative numbers

by Zbigniew Fiedorowicz -
Sorry, it's a bug.  I'll try to fix it tomorrow.  In the meantime, a workaround would be to write the inequalities backwards: @@@-2<>x@@@ ==> @@-2<>x@@ etc.  Another workaround would be to use the debugging script http://yourmoodlesite/filter/algebra/algebradebug.php, enter the expression without the negative sign, click on "Second Stage Tex Translation", put the minus sign there, and then enter the resulting expression in TeX syntax:
x<= 2   -----> x \leq 2  ----> x \leq -2 ----> $$$x\leq -2$$$ ----> $$x \leq -2$$

In reply to Jennifer Cass

Re: Algebra filter and negative numbers

by Zbigniew Fiedorowicz -
I've put a bug fix for this problem in the cvs.  The files affected are
  • filter/algebra/filter.php
  • filter/algebra/AlgParser.pm
  • filter/algebra/algebradebug.php
You will need to use the algebradebug.php script to delete the cache database entries for any expressions which were processed by the previous buggy versions of the algebra filter.php
Average of ratings: Useful (1)
In reply to Zbigniew Fiedorowicz

Odp: Re: Algebra filter and negative numbers

by Łukasz Sanokowski -
I have a problem with negative numbers used in lim parameters. When for example variable in base (I'm not sure if i name this correctly in english) goes to negative number, the algebra filter display it incorrectly. Example:

lim((x^3-3x^2+2)/(x^2-4),x,-7) displays as @@lim((x^3-3x^2+2)/(x^2-4),x,-7)@@

After removing minus sing from number "7" algebra filter display it correctly.

Thanks in advance for response.
In reply to Łukasz Sanokowski

Re: Odp: Re: Algebra filter and negative numbers

by Mauno Korpelainen -

Why not use Tex or Asciimathml instead of Algebra filter that has a very limited subset of commands you can use in Tex. For example

\lim_{x\to{-7}}\frac{x^3-3x^2+2}{x^2-4} between double dollars

gives

$$\lim_{x\to{-7}}\frac{x^3-3x^2+2}{x^2-4}$$