Open rtoy opened 5 months ago
Imported from SourceForge on 2024-07-03 15:53:53 Created by willisbl on 2016-05-28 11:23:29 Original: https://sourceforge.net/p/maxima/bugs/3169/#d880
setequal({ abs(m), -abs(m) } , { m, -m }) --> false is consistent with the user documentation:
-- Function: setequalp (, )
Returns 'true' if sets and have the same number of elements
and 'is(
Of course it would be terrific if setqual was better about detecting sematic equality of sets. Maybe you could suggest an algorithm?
Imported from SourceForge on 2024-07-03 15:53:57 Created by tomasriker on 2016-06-02 07:27:02 Original: https://sourceforge.net/p/maxima/bugs/3169/#013c
An interesting problem (and not a bug, as Barton mentioned). If this was my problem, I'd probably write a function that simplifies sets of the form {abs(m), -abs(m), ...}
to {m, -m, ...}
and apply that function before comparing the sets.
I don't think that this functionality is needed in setequalp
.
Imported from SourceForge on 2024-07-03 15:54:00 Created by kjak on 2016-06-03 01:39:12 Original: https://sourceforge.net/p/maxima/bugs/3169/#360d/a1d6
Hi, Sebastian. I think you will more clearly see what's happening if you look at the resulting set alone (without immediately passing it to setequalp):
(%i1) {abs(m),-abs(m)};
(%o1) {-abs(m),abs(m)}
(%i2) assume(m>0)$
(%i3) {abs(m),-abs(m)};
(%o3) {-m,m}
So in your example with this assumption setequalp is just comparing {-m,m} to {-m,m}.
Imported from SourceForge on 2024-07-03 15:54:04 Created by robert_dodier on 2016-06-11 20:01:05 Original: https://sourceforge.net/p/maxima/bugs/3169/#488a
Diff:
--- old
+++ new
@@ -1,11 +1,11 @@
The crux of the problem is that maxima does not recognize the 2 sets below as equal:
- { abs(m), -abs(m) } and { m, -m }
+ `{ abs(m), -abs(m) }` and `{ m, -m }`
I expect the 2 sets to be equal. (if we make the assignment m:5, Maxima recognize it as equal). Here is some background.
My program writes Maxima commands to confirm the correctness of manipulating an equation.
eg. in deriving the quadratic formula, after completing the squares, this is a common step
- step 1 is: ( x - b/(2*a) )^2 = ( b^2 - 4*a*c ) / ( 4*a^2 )
- step 2 is: x - b/(2*a) = +- sqrt( ( b^2 - 4*a*c ) / ( 4*a^2 ) ). (note the +- plus/minus sign)
+ step 1 is: `( x - b/(2*a) )^2 = ( b^2 - 4*a*c ) / ( 4*a^2 )`
+ step 2 is: `x - b/(2*a) = +- sqrt( ( b^2 - 4*a*c ) / ( 4*a^2 ) )`. (note the +- plus/minus sign)
I deem the move from step 1 to step 2 is correct if the { solutions of step 1 } = { solutions of step 2 }
Here's the transcript:
Imported from SourceForge on 2024-07-03 15:54:07 Created by robert_dodier on 2016-06-11 20:01:06 Original: https://sourceforge.net/p/maxima/bugs/3169/#36c8
Since setequalp
is working as documented, I'm closing this report as "won't fix".
I agree that there is an opportunity here for setequalp
to be strengthened. If OP or anyone has an idea about how to proceed with that, my advice is to open a feature enhancement ticket or raise the issue on the maxima-discuss mailing list.
Imported from SourceForge on 2024-07-03 15:54:11 Created by macrakis on 2018-07-02 15:14:19 Original: https://sourceforge.net/p/maxima/bugs/3169/#cc7e
Of course, even these fancier comparison techniques wouldn't help in the case of {m,-m} vs. {abs(m),-abs(m)}, where the sets are always equal even though the individual elements are not.
Imported from SourceForge on 2024-07-03 15:53:52 Created by numiri on 2016-05-27 04:38:52 Original: https://sourceforge.net/p/maxima/bugs/3169
The crux of the problem is that maxima does not recognize the 2 sets below as equal:
{ abs(m), -abs(m) }
and{ m, -m }
I expect the 2 sets to be equal. (if we make the assignment m:5, Maxima recognize it as equal). Here is some background.My program writes Maxima commands to confirm the correctness of manipulating an equation.
eg. in deriving the quadratic formula, after completing the squares, this is a common step step 1 is:
( x - b/(2*a) )^2 = ( b^2 - 4*a*c ) / ( 4*a^2 )
step 2 is:x - b/(2*a) = +- sqrt( ( b^2 - 4*a*c ) / ( 4*a^2 ) )
. (note the +- plus/minus sign) I deem the move from step 1 to step 2 is correct if the { solutions of step 1 } = { solutions of step 2 }Here's the transcript:
I expected the final output to be TRUE. Thank you for your help.