rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

2/sqrt(2) doesn\'t simplify #1554

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:33 Created by macrakis on 2003-04-15 03:45:23 Original: https://sourceforge.net/p/maxima/bugs/299


2/sqrt(2) doesn't simplify. Similarly for 2/2^(2/3).

On the other hand, x/sqrt(x) => sqrt(x).

And of course sqrt(2) simplifies to itself -- it doesn't become 2/sqrt(2)!!

I believe the original examples should simplify to sqrt(2) and 2^(1/3). Note that 2^(4/3) => 2*2^(1/3) (the current behavior) is probably CORRECT, in order to make things like 10^(10/3) intelligible.

Or is there something I'm missing?

Maxima 5.9.0 gcl 2.5.0 mingw32 Windows 2000 Athlon

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:35 Created by willisb on 2003-04-17 18:44:09 Original: https://sourceforge.net/p/maxima/bugs/299/#6b56


Logged In: YES user_id=570592

Try ratsimp with algebraic : true

(C1) z : 2/sqrt(2);

(D1) 2/SQRT(2)

(C2) ratsimp(z);

(D2) 2/SQRT(2)

(C3) ratsimp(z),algebraic;

(D3) SQRT(2)

(C4) z : 2/2^(2/3);

(D4) 2/2^(2/3)

(C5) ratsimp(z);

(D5) 2/2^(2/3)

(C6) ratsimp(z),algebraic;

(D6) 2^(1/3) (C7)

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:38 Created by macrakis on 2003-04-17 18:53:22 Original: https://sourceforge.net/p/maxima/bugs/299/#9ab0


Logged In: YES user_id=588346

Yes, of course there are ways within Maxima to perform this simplification. But it should be the default in the general simplifer. The logic already appears to be in the general simplifier, but there is a bug in this particular case. If the general simplifier's philosophy were to leave such things untouched, why does it simplify x/sqrt(x) and the like?

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:42 Created by macrakis on 2003-10-09 03:21:07 Original: https://sourceforge.net/p/maxima/bugs/299/#c085


Logged In: YES user_id=588346

More examples. Right-hand side is after ratsimp/algebraic. I believe the general simplifier should be giving those forms.

1/(2*2^(2/3)) 2^(1/3)/4 1/2^(2/3) 2^(1/3)/2 1/(2*SQRT(2)) SQRT(2)/4 1/SQRT(2) SQRT(2)/2 1/(2*2^(1/3)) 2^(2/3)/4 1/2^(1/3) 2^(2/3)/2

Things get worse with non-numeric contents. In the following, each group of expressions denotes the same thing, but none simplifies to the others. I have put *** next to those forms which are the results of ratsimp/algebraic. Note that in several cases, there is more than one equivalent ratsimp'ed form....

1/(a*b)^(5/2) 1/(a^2*b^2*SQRT(a*b)) *** SQRT(a*b)/(a^3*b^3) ***

1/(a*b)^(3/2) 1/(a*b*SQRT(a*b)) *** SQRT(a*b)/(a^2*b^2) ***

1/(a*b)^(7/6) 1/(a^(2/3)*b^(2/3)*SQRT(a*b)) *** SQRT(a*b)/(a^(5/3)*b^(5/3)) *** (a*b)^(5/6)/(a^2*b^2) ***

1/(a*b)^(5/6) *** 1/(a^(1/3)*b^(1/3)*SQRT(a*b)) *** (a*b)^(1/6)/(a*b) *** SQRT(a*b)/(a^(4/3)*b^(4/3)) ***

1/SQRT(a*b) *** SQRT(a*b)/(a*b) ***

a^(1/3)*b^(1/3)/SQRT(a*b) *** 1/(a*b)^(1/6) *** SQRT(a*b)/(a^(2/3)*b^(2/3)) *** (a*b)^(5/6)/(a*b) ***

Now it is true that these expressions are in fact not all equivalent as to principal value, but I will leave that exercise for later. Many of them are, and they are not being canonicalized.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:45 Created by robert_dodier on 2006-07-06 06:01:20 Original: https://sourceforge.net/p/maxima/bugs/299/#ed9e


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:49 Created by robert_dodier on 2006-08-27 00:24:11 Original: https://sourceforge.net/p/maxima/bugs/299/#75fd


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:52 Created by macrakis on 2007-12-19 14:59:35 Original: https://sourceforge.net/p/maxima/bugs/299/#cd72


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:56 Created by macrakis on 2007-12-19 14:59:35 Original: https://sourceforge.net/p/maxima/bugs/299/#004b


Logged In: YES user_id=588346 Originator: YES

I have raised the priority of this bug, because it is very close to the surface (i.e. easy for just about any user to run into). See also 1853191, where algebraic gives strange results...

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:59 Created by dgildea on 2008-01-11 12:55:47 Original: https://sourceforge.net/p/maxima/bugs/299/#969e


Logged In: YES user_id=1797506 Originator: NO

(%i6) (1/2)*sqrt(2); (%o6) sqrt(2)/2

(%i7) sqrt(2)*(1/2); (%o7) 1/sqrt(2)

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:03 Created by rtoy on 2008-03-28 16:42:45 Original: https://sourceforge.net/p/maxima/bugs/299/#e852


Logged In: YES user_id=28849 Originator: NO

The issue appears to be in timesin. The basic issue is that timesin isn't commutative, as dgildea shows.

I have a partial fix for this which fixes this particular issue, but it causes many failures in the testsuite, mostly due to a different ordering of the answer. But some tests now cause errors to be signaled, and some are no longer simplified as before or not simplified at all.

Bummer.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:06 Created by crategus on 2009-06-23 20:59:02 Original: https://sourceforge.net/p/maxima/bugs/299/#1326