3

If I compare two expressions in Maxima, it tells me they are equivalent, as expected:

(%i25) is(equal( sqrt(2)*sqrt(5), sqrt(10) ));
(%o25)                               true

But if I multiply each expression by a constant, it then tells me they're not equivalent any more:

(%i26) is(equal( sqrt(2)*sqrt(5)*2, sqrt(10)*2 ));
(%o26)                               false

Surely they must still be equivalent if I do the same thing to both expressions? If I try adding a constant instead of multiplying, it returns true as expected:

(%i27) is(equal( sqrt(2)*sqrt(5)+2, sqrt(10)+2 ));
(%o27)                               true

version info

(%i2) build_info(); 
(%o2) Maxima version: "5.32.1" 
      Maxima build date: "2014-01-10 01:52:55" 
      Host type: "x86_64-unknown-linux-gnu" 
      Lisp implementation type: "GNU Common Lisp (GCL)" 
      Lisp implementation version: "GCL 2.6.10"
miracle173
  • 11,359
John B
  • 272
  • 1
    Answer is very simple,It's a bug in software. – Mariusz Iwaniuk Jan 31 '20 at 16:35
  • Is Maxima doing these symbolically or numerically? Clearly $2 \sqrt 2 \sqrt 5 = 2 \sqrt{10}$, but $2 \times 1.4142 \times 2.236 \neq 2 \times 3.1623$. It would have more numerical precision, but the discrepancy might be enough to cause problems. – David R. Jan 31 '20 at 22:38
  • @DavidR. I'm not sure. Symbolic calculations are kind of the point of Maxima (I thought) but I've noticed that it returns "unknown" if I do it like this:

    is(equal( sqrt(a)sqrt(b), sqrt(ab) ));

    – John B Feb 02 '20 at 01:05
  • Relevant meta post on implementation (coding) problem. – Lee David Chung Lin Feb 02 '20 at 10:52
  • 1
    @JohnB Maxima is doing this symbollically but I think unknown is the correct output to is(equal( sqrt(a)*sqrt(b), sqrt(a*b) )); unless you set radexpand=all or assume(a>0) or assume(b>0) I think this is simply a bug – miracle173 Feb 03 '20 at 15:10
  • @DavidR. Maxim uses symbolic computation here. – miracle173 Feb 03 '20 at 15:11
  • @JohnB can you post the result of build_info(); – miracle173 Feb 04 '20 at 09:19
  • @miracle173 here you go:

    (%i2) build_info(); (%o2) Maxima version: "5.32.1" Maxima build date: "2014-01-10 01:52:55" Host type: "x86_64-unknown-linux-gnu" Lisp implementation type: "GNU Common Lisp (GCL)" Lisp implementation version: "GCL 2.6.10"

    – John B Feb 04 '20 at 14:50

1 Answers1

2

Interestingly enough

is(equal( sqrt(2)*sqrt(5)*7, sqrt(10)*7 ));  

will evaluate to true as will

is(equal( sqrt(2)*sqrt(5)*c, sqrt(10)*c ));  

is(equal(a,b)) tries to simplify a-b and gives true when a-b equals zero. Problem with $\sqrt{2}*\sqrt{5}*2$ is that it simplifies to
$ 2^\frac{3}{2} \sqrt{5} $ which then confuses maxima (obviously a bug)

miracle173
  • 11,359
shortmanikos
  • 1,435