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.
F.
For example,
D = matrix([[-(e^3+2)/(e^3-1) + (2*e^3+1)/(e^3-1),1],[2,0]])
In sage, this returns a complex matrix.
D[0][0].simplify_full() returns 1.
I've noticed that matrices have the methods D.simplify,
D.simplify_trig and D.simplify_rational, and all these work as
expected. Is there a reason that simplfy_full() isn't implemented?
--
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