question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

accept implicit multiplication as input

See original GitHub issue

Hi Davide,

Look at the lines below:

var a=require('algebrite');
var expr="(2x-5)*(3x-3)*(x+4)";
var exprS = a.simplify(expr).toString();
console.log(exprS);   // display  3 (2 x^3 + x^2 - 23 x + 20)
console.log(a.expand(exprS).toString());    // display nil
exprS = exprS.charAt(0) + "*" + exprS.slice(1);  // put a "*" between 3 and the rest
console.log(a.expand(exprS).toString());   // display 6 x^3 + 3 x^2 - 69 x + 60

Simplify produces a expression with implicit multiplication (“*”) but expand does not accept it. I believe that the best approach would be expand come around to accepting implicit multiplication.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
davidedccommented, Sep 23, 2017

can now parse the example above - can parse whenever one of the factors is a “naked” number. See tests at the commit linked in the “closure” message above.

0reactions
paulobuchsbaumcommented, Sep 23, 2017

Great, @davidedc, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Order of Operations: Implicit Multiplication? - The Math Doctors
Implied multiplication has a higher priority than explicit multiplication to allow users to enter expressions, in the same manner as they ...
Read more >
"implied multiplication" operator precedence?
Updated: Implied multiplication is everywhere, 1x = x and x/1=x. Any number times 1 is that number and any number divided by 1...
Read more >
Allow implicit multiplication of multiple single-character variables ...
Enhancing the MathJS expression syntax to allow multiple single-character variables to be implicitly multiplied would make it more closely resemble mathematics ...
Read more >
ANTLR Implicit Multiplication - grammar - Stack Overflow
Specifically, I've tried adding some simple functions, negative numbers and so on, to familiarize myself with ANTLR. However, I've run into a bit...
Read more >
Ambiguous PEMDAS - Harvard Mathematics Department
Under this more sophisticated convention, the implicit multiplication in 2(2 + 2) is given higher priority than the explicit division in 8÷2(2 +...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found