MathGroup Archive 2012

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

Search the Archive

Re: File size 5.5MB

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126445] Re: File size 5.5MB
  • From: A Retey <awnl at gmx-topmail.de>
  • Date: Fri, 11 May 2012 00:12:50 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jog02s$g2c$1@smc.vnet.net>

Hi,

> Very new to CDF format of Mathematica, but concerned at the file size
> of a simple file.
>
> Something as simple of this, along with its output,  is 5.5MB. How
> come?

Because it contains 3 nontrivial 3d vector graphics? I won't argue that 
this could not probably be done more efficient, but it isn't that bad 
that I'd consider it a real problem (if you look into the file or the 
cell expressions you will find that the graphics content even is 
compressed by default).  Maybe you want to explain what your problem 
with the file size exactly is, so we can suggest what you can do to 
solve that particular problem.

There are various ways to get your files smaller, maybe simple settings 
like:

ContourPlot3D[
   r*(1 - u/q) - u/(1 + u^2) == 0, {r, 0, 1}, {q, 0, 10}, {u, 0, 10},
   AxesLabel -> {r, q, u}, MeshFunctions -> {#1 &}, Mesh -> 9,
  PlotPoints -> 5, MaxRecursion -> 2]

will already be sufficient for what you want to achieve, but as another 
extreme you could create very small rasterized "previews" in the file 
and recreate the full 3d vectorgraphic only when the user wants to 
interact with it. That possibility is the real benefit of using CDF 
instead of e.g. PDF. Of course things like that need a little extra 
effort, here is an example:

With[{
   code = Hold@ContourPlot3D[
      r*(1 - u/q) - u/(1 + u^2) == 0, {r, 0, 1}, {q, 0, 10}, {u, 0, 10},
      AxesLabel -> {r, q, u}, MeshFunctions -> {#1 &}, Mesh -> 9
      ]
   },
  DynamicModule[{content =
     Button[Rasterize @@ code, content = ReleaseHold[code],
      Appearance -> None]},
   Dynamic[content]
   ]
  ]

it will create a rasterized graphics as a static preview. If you save 
that file it will be about 50kB for me (that would be about 150kB for 
three such graphics). Only when the user clicks on the graphics it is 
replaced with the interactive 3d graphics. Of course you probably might 
want to improve that so it becomes clearer to potential users/readers 
how to use it and what is going on while the 3d graphics is recreated.

hth,

albert



  • Prev by Date: Fine control of evaluation
  • Next by Date: Re: Speed of Mathematica on AMD machines
  • Previous by thread: File size 5.5MB
  • Next by thread: Re: File size 5.5MB