2

I am experimenting with the ComplexityFunction of Simplify and came up with this one:

ComplexityFunction->Function[e,Rasterize[HoldForm[e],"BoundingBox"][[1]]]

It gets the width of the bounding box of the image representation for the expression. The expression which generates an image with less width, is the chosen one. It works, but since it uses Rasterize, it is very slow.

I would like to know if there is a faster way to measure the displayed size the expression output. Any ideas?

Giovanni F.
  • 1,911
  • 13
  • 20
  • I can't imagine how you could measure an image without generating it first. Perhaps the problem is more like finding another almost equivalent weighting function – Dr. belisarius Dec 07 '14 at 22:50
  • There is another way, by measuring the BoundingBox. It works, but is slow too. See http://mathematica.stackexchange.com/questions/67482/how-to-get-the-content-size-in-pixels-of-the-output-in-an-output-cell – Giovanni F. Dec 08 '14 at 01:03
  • You mean ComplexityFunction-> Function[e,StringLength[ToString[InputForm[e]]]] cannot meet request? – yode Dec 08 '16 at 06:15
  • No, the string representation is not good for some expressions. – Giovanni F. Dec 08 '16 at 20:20

0 Answers0