ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 23 Oct 2012 16:19:47 +0200Map a function to each element of a matrix?https://ask.sagemath.org/question/9459/map-a-function-to-each-element-of-a-matrix/Is there a direct way to apply a function to each entry of a matrix and return the resulting matrix?
A = matrix([[1,2],[3,4]])
B = matrix([[j^2 for j in i] for i in A])
Not terribly hard, but it's not ideal.daniel.e2718Tue, 23 Oct 2012 16:19:47 +0200https://ask.sagemath.org/question/9459/