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.

calling Algebrite.print() throws "ReferenceError: Eval_display is not defined"

See original GitHub issue

I am trying to turn the result of Algebrite.simplify('x+x+x') into a string. I thought Algebrite.print() might do that, but it fails, throwing the exception “ReferenceError: Eval_display is not defined”.

Some background: What I am actually trying to accomplish is testing whether two expressions (this could be equations, too) are equivalent to each other. I was using Algebrite.run(expr1) == Algebrite.run(expr2), but this has side effects and does not work for equations or inequalities. I thought simplify might be the better way to go.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
eweitnauercommented, Sep 28, 2016

So my idea was to run something like this piece of code

rationalize_real = function(num) {
  if (Math.round(num) === num) return num;
  var parts = num.toString().split('.');
  return '(' + (parts[0]==='0' ? parts[1] : parts[0]+parts[1]) + '/1'
             + Array(parts[1].length+1).join('0') + ')';
}

to replace each number in the input by a rational to avoid any floating point operations in Algebrite. It would not change 1/3, since only the 1 and the 3 would be passed to the function, but it would turn 0.5 into 5/10 and 3.3333 into 33333/10000.

What is the more general case you mentioned? Where should I best add the test cases?

0reactions
davidedccommented, Oct 11, 2016

approxratio now works on entire expressions: https://github.com/davidedc/Algebrite/blob/eb1ed2e6a3720435f60ad88100329d58b733b88f/tests/approxratio.coffee . So this should cater for typical ratios entered as floats. Hopefully most people would still enter irrational and transcendental numbers with an appropriate expression rather than as a float. Those other cases to be picked up later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught ReferenceError: is not defined - Stack Overflow
The browser will try to find a global variable google , and a property into google named com , so it won't find,...
Read more >
How to fix "Uncaught ReferenceError: x is not defined" in ...
JS Casts 04 - How to fix "Uncaught TypeError: x is not a function " in JavaScript.Visit https://javascriptcasts.com/episodes/04 for a summary ...
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