How can I simplify the expressions of the values in an association in a simple way?
For example,
as = <|c1 -> x, c2 -> y x + y x + x x + y y , c3 -> z|> ;
as// Simplify
does not give the result
<|c1 -> x, c2 -> (x + y)^2, c3 -> z|>
in Ver 11.0.
How can I simplify the expressions of the values in an association in a simple way?
For example,
as = <|c1 -> x, c2 -> y x + y x + x x + y y , c3 -> z|> ;
as// Simplify
does not give the result
<|c1 -> x, c2 -> (x + y)^2, c3 -> z|>
in Ver 11.0.
Simplify threads over lists, but not over associations, so
as // Normal // Simplify
{c1 -> x, c2 -> (x + y)^2, c3 -> z}
works, but
as // Simplify
doesn't. Recommend using Map
Simplify /@ as
Association[c1 -> x, c2 -> (x + y)^2, c3 -> z]
as suggested in the comments to your question.
AssociationThread[Keys[as], Simplify[Values[as]]], among others... – ciao Mar 03 '17 at 01:28Simplify /@ asreturns<|c1 -> x, c2 -> (x + y)^2, c3 -> z|>-- what do you get? – Mr.Wizard Mar 03 '17 at 01:31