Ask Your Question

canonicalize_radical for matrices.

asked 2016-08-02 13:46:22 -0500

Saul Schleimer gravatar image

updated 2016-08-25 16:39:46 -0500

tmonteil gravatar image

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()
sage: v.canonicalize_radical()

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?

edit retag flag offensive close merge delete


you will find relevant links on this related question

mforets gravatar imagemforets ( 2016-08-05 13:28:12 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2016-08-06 15:50:47 -0500

tmonteil gravatar image

updated 2016-08-25 16:40:13 -0500

Regarding your last question, ask.sagemath is not a bad place since quite a lot of developers are looking around, see the tags confirmed_bug and fixed_bug.

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
  • 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, Fangan Dosso opened and filled trac ticket 21332 about that, so the feature will be available in the next versions of Sage.

edit flag offensive delete link more

answered 2016-08-02 14:12:53 -0500

FrédéricC gravatar image

Like that:

sage: M.apply_map(lambda u: u.canonicalize_radical())
edit flag offensive delete link more


Yes, 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.

Saul Schleimer gravatar imageSaul Schleimer ( 2016-08-02 15:14:55 -0500 )edit

In 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.

Saul Schleimer gravatar imageSaul Schleimer ( 2016-08-05 12:52:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-08-02 13:46:22 -0500

Seen: 64 times

Last updated: Aug 25 '16