MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Expressions as images

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117368] Re: Expressions as images
  • From: James Stein <mathgroup at stein.org>
  • Date: Wed, 16 Mar 2011 06:28:21 -0500 (EST)

[Caveat: I don't know what I'm doing]

I think the gratuitous wrapping of a long expression into multiple lines has
something to do with the width of the notebook in which evaluation occurs,
at the time of evaluation.  Try this experiment: copy these three lines into
each of two cells of a notebook.

   (1/m^2 - (3 m)/n + 2/(m n)) (m^3 + Sqrt[16 m^4 n^6] + 5 n^5) (m^5 +
   Sqrt[16 m^5 n^7] + Pi^5)
Export["filename.png", %, ImageResolution -> 300, ImageSize -> {2000, 75}];
Import[%]

On my 15" (diagonal) MacBook Pro, I find the following:

(1) Widen the notebook to the full width of the screen (about 12.5"), and
evaluate one of the cells. Results are as you desire (image shows expression
on one line).
(2) Narrow the notebook to about 6", and evaluate another of the cells.
Results show a wrapped expression in the image.
(3) Notice that as you drag the width of the notebook back and forth, the
output of the first line will wrap/unwrap as necessary to fit the available
width, but the image will change size without affecting the wrapping.

If your expressions are very long, I assume Mathematica has some option to
specify width of a notebook. Failing that, you can slide a notebook
leftward, then drag the lower right corner further to the right to make a
notebook wider than your screen -- several times, if necessary -- and
achieve an unwrapped image.

You can keep Mathematica from simplifying an expression by inputting it as a
string.
Your example, for example:

   "((3 a b)/(25 x^2 y^2))^-3/((4 a)/(5 x y^2))^-3"
Export["filename.png", %, ImageResolution -> 300, ImageSize -> {1000, 40}];
Import[%]

-- James


2011/3/15 =C5 er=C3=BDch Jakub <Serych at panska.cz>

> Dear Mathgroup,
>
> I would like to create .png images from some expressions using Mathematica.
> It works, but it has two problems:
>
> 1) How to hold exactly the form in which I have entered the expression? For
> example this expression:
>
> ((3 a b)/(25 x^2 y^2))^-3/((4 a)/(5 x y^2))^-3
>
> (entered in 2D form using for example Palettes)
>
> is always simplified by Mathematica to:
>
> 1/(((3 a b)/(25 x^2 y^2))^3/((4 a)/(5 x y^2))^3)
>
> I tried to use Hold and Defer but it is always simplified.
>
>
> 2) Export is "optimising" images so that long expression is divided into
> more lines. How to keep it in one line? I tried the AspectRatio and
> ImageSize options, but without any success.
>
> Example (in original also entered in 2D form):
>
> Export["filename.png",
>  Defer[(1/m^2 - (3 m)/n + 2/(m n)) (m^3 + Sqrt[16 m^4 n^6] + 5 n^5)],
>  ImageResolution -> 300]
>
> Thanks for any info
>
> Jakub
>
>


  • Prev by Date: Re: how to partition a list
  • Next by Date: Re: $MaxNumber
  • Previous by thread: Expressions as images
  • Next by thread: Re: Expressions as images