> Hello, >> Any chance that we can add simplify_full on matrices? So that each element >> is simplified if possible? > /1/ I suppose you know the map function that operate over each term of a list. > > map (lambda x: 3*x, [1,2,3]) # computes [3,6,9] > > # you can replace 3*x by the function simplify_what_you_want. > > map (lambda t:t.simplify(), L) > map (lambda t:simplify(t), L) > map (simplify, L) > > are very close. L is of corse a list of expressions. > > /2/ map in Maple operates over all the arguments of every object, even over > f(a,b,c). > map in Sage operates over the sequences and only returns a list. > Then there is no map possible inside any matrix spaces. > > A matrix is a sequence of lines. > > /3/ The same (or other) ability to map a list uses the [...for...] syntax. > [3*x for x in [1,2,3]] and map (lambda x:3*x, [1,2,3]) are near. > And it's easy to combine the [..for...] syntax for list of lists, cartesian > products, and so. > > Now test > > matrix ([[simplify(z) for z in L] for L in Mat]) > > where Mat is your matrix.
Perhaps Matrix (and other classes) should have a method .map() that does this, and maybe an .inplace_map() to not create another object. This seems like a useful feature. -Ivan -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
