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

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.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 19 (12 by maintainers)

Most upvoted comments

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?