On Mar 12, 5:23 am, Jan Groenewald <j...@aims.ac.za> wrote:
> Hi
>
> Is this the intended behaviour, for A==B to say False instead of returning
> the expression?
>
> sage: A=matrix([(x+1)*(x-1)]); B=matrix([x^2-1]);
> sage: A==B
> *False*
> sage: A.simplify_rational()==B
> *True*

What surprises me is that equality testing of matrices with SR
elements seems more picky than pairwise equality testing of their
entries, not that it gets eagerly converted to a boolean (as in most
of sage), rather than turned into a "symbolic equation" (as happens
with SR elements).

Indeed,

sage: [ bool(a==b) for a,b in zip(list(A),list(B))]
[True]

so it may be worth looking into. I would expect that "A==B" would give
the same result as

sage: all(a for a,b in zip(list(A),list(B)) if a==b)
True

and it doesn't.

If you would prefer that

_(x,y)=0
A=matrix([x])
B=matrix([y])
A==B

returns a symbolic equation rather than True/False you would need to
change Matrix_symbolic_dense. In the process, you'd probably have to
break its inheritance from Matrix as well, so you'd end up
implementing the whole linear algebra stack separately. You'd also
have to somehow account for a "Matrix_symbolic_dense" being a
component of " ... == ..." and hence being an element of SR itself. It
would make SR even more of a black hole than it already is.

In return, you might be able to write

det( matrix[[a,b],[c,d]]^n - matrix[[1,0],[0,1]])

whether you'd be able to do anything with it would depend on the
various back-ends.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to