Johan Falk

Results 100 comments of Johan Falk

+1 on this feature request!

Another example: 2(a+b) = 2*(a+b) A possible difficulty with implicit multiplications is if you have multi-character variables: Parser.parse("ab + 1").simplify({ab : -1, a : 5, b : 2}); // Should...

Here's one way of attacking implicit multiplication: ``` /** * Processes an expression string to make implicit multiplications explicit. * * @var expressionString * A string with a complex expression,...

The code suggested above has problem with parsing negative terms. I'm currently struggling with a replacement algorithm that can parse both `x-2y` and `x/-2y` properly. I'll post again if I...

Ok, this seems to work. I have a feeling that it would be good to have some tests on this. ``` var re = {}; // Turns '2sin(x)' into '2*sin(x)'....

No, there are still problems. Parsing expressions like `2x^2x` requires that the algorithm takes order of operations into account – in the second case 2x should be interpreted as `(2*x)`,...

I did some more reading, and it seems very difficult to parse `2x^2x` into `2*x^(2*x)` using generic rules. Most parsers accepting implicit multiplication treat it as `2*x^2*x` – so I...

Hi again. I've done some more reading and testing, and have found a way to handle implicit multiplication that works better than the previous example: It introduces less parentheses, and...

Ok, to me it sounds pretty difficult, but I'm glad if others find it non-difficult. :-) If anyone's interested: I've found a PHP library that does these sort of things...

@Beakerboy: Interesting algorithm, but a shame that only simple exponents are allowed. Another library I looked at some time ago (https://github.com/josdejong/mathjs, built on JavaScript) had lists of both unary and...