Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10028

Re: File size 5.5MB

From A Retey <awnl@gmx-topmail.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: File size 5.5MB
Date 2012-05-11 04:14 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <joi3mn$n4l$1@smc.vnet.net> (permalink)
References <jog02s$g2c$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

File size 5.5MB David <dwarnold45@suddenlink.net> - 2012-05-10 09:00 +0000
  Re: File size 5.5MB A Retey <awnl@gmx-topmail.de> - 2012-05-11 04:14 +0000
  Re: File size 5.5MB Andre Koppel  <akoppel@akso.de> - 2012-05-15 08:52 +0000

csiph-web