ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 06 Aug 2016 15:50:47 -0500canonicalize_radical for matrices.http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/The following all works
sage: a = sqrt(2)*sqrt(3)*sqrt(6)
sage: v = vector([a])
sage: M = Matrix([v, v])
sage: a.canonicalize_radical()
6
sage: v.canonicalize_radical()
(6)
However the following doesn't work:
sage: M = Matrix([v, v])
sage: M.canonicalize_radical()
EDIT: Could somebody please tell me the right place to ask for "vectorization of canonicalize_radical for matrices" as a new feature of sage?Tue, 02 Aug 2016 13:46:22 -0500http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/Comment by mforets for <p>The following all works</p>
<pre><code>sage: a = sqrt(2)*sqrt(3)*sqrt(6)
sage: v = vector([a])
sage: M = Matrix([v, v])
sage: a.canonicalize_radical()
6
sage: v.canonicalize_radical()
(6)
</code></pre>
<p>However the following doesn't work:</p>
<pre><code>sage: M = Matrix([v, v])
sage: M.canonicalize_radical()
</code></pre>
<p>EDIT: Could somebody please tell me the right place to ask for "vectorization of canonicalize_radical for matrices" as a new feature of sage?</p>
http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?comment=34344#post-id-34344you will find relevant links on this [related question](http://ask.sagemath.org/question/8090/filing-feature-requests/)Fri, 05 Aug 2016 13:28:12 -0500http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?comment=34344#post-id-34344Answer by tmonteil for <p>The following all works</p>
<pre><code>sage: a = sqrt(2)*sqrt(3)*sqrt(6)
sage: v = vector([a])
sage: M = Matrix([v, v])
sage: a.canonicalize_radical()
6
sage: v.canonicalize_radical()
(6)
</code></pre>
<p>However the following doesn't work:</p>
<pre><code>sage: M = Matrix([v, v])
sage: M.canonicalize_radical()
</code></pre>
<p>EDIT: Could somebody please tell me the right place to ask for "vectorization of canonicalize_radical for matrices" as a new feature of sage?</p>
http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?answer=34361#post-id-34361Regarding your last question, ask.sagemath is not a bad place since quite a lot of developers are looking around, see the tags [confirmed_bug](http://ask.sagemath.org/questions/scope:all/sort:activity-desc/tags:confirmed_bug/page:1/) and [fixed_bug](http://ask.sagemath.org/questions/scope:all/sort:activity-desc/tags:fixed_bug/page:1/).
However, since you are able to add the feature yourself and since we need more developers, let me suggest you to:
- ask for an account on [trac](https://trac.sagemath.org/)
- open a ticket
- make your changes on the source code (adding a method on `src/sage/matrix/matrix_symbolic_dense.pyx` following the existing `simplify_full` method)
- push your changes
- ask for a review
**EDIT** : during [sage days 75](https://wiki.sagemath.org/days75), Fangan Dosso opened and filled [trac ticket 21332](https://trac.sagemath.org/ticket/21332) about that, so the feature will be available in the next versions of Sage.Sat, 06 Aug 2016 15:50:47 -0500http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?answer=34361#post-id-34361Answer by FrédéricC for <p>The following all works</p>
<pre><code>sage: a = sqrt(2)*sqrt(3)*sqrt(6)
sage: v = vector([a])
sage: M = Matrix([v, v])
sage: a.canonicalize_radical()
6
sage: v.canonicalize_radical()
(6)
</code></pre>
<p>However the following doesn't work:</p>
<pre><code>sage: M = Matrix([v, v])
sage: M.canonicalize_radical()
</code></pre>
<p>EDIT: Could somebody please tell me the right place to ask for "vectorization of canonicalize_radical for matrices" as a new feature of sage?</p>
http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?answer=34303#post-id-34303Like that:
sage: M.apply_map(lambda u: u.canonicalize_radical())
[6]
[6]
Tue, 02 Aug 2016 14:12:53 -0500http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?answer=34303#post-id-34303Comment by Saul Schleimer for <p>Like that:</p>
<pre><code>sage: M.apply_map(lambda u: u.canonicalize_radical())
[6]
[6]
</code></pre>
http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?comment=34340#post-id-34340In the end, I went with
M = Matrix([v.canonicalize_radical() for v in M])
because it feels a bit more "pythonic". I suppose what I really want is to be told how to make a feature request. I'll add that to the original question.Fri, 05 Aug 2016 12:52:51 -0500http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?comment=34340#post-id-34340Comment by Saul Schleimer for <p>Like that:</p>
<pre><code>sage: M.apply_map(lambda u: u.canonicalize_radical())
[6]
[6]
</code></pre>
http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?comment=34307#post-id-34307Yes, I know that I can write some code to do want I want (and I have done so!). However, as my question states, I am asking for a feature to be implemented - namely the simplify methods should work the same for "scalars", "vectors", and "matrices". In any case, thank you for the reply.Tue, 02 Aug 2016 15:14:55 -0500http://ask.sagemath.org/question/34302/canonicalize_radical-for-matrices/?comment=34307#post-id-34307