20
$\begingroup$

I started with File > New > FreeCDF so I can save my work in a format compatible with the CDF Player. I can use Mathematica to make new cells, evaluate input and so in the CDF file. What are the differences between using File > New > FreeCDF and File > New > Notebook? I suppose there are cases when you want to use file.nb instead of file.cdf but what are they?

$\endgroup$

2 Answers 2

17
$\begingroup$

If your goal is to work within Mathematica, FreeCDF and Notebook are functionally equivalent. There might be, I suppose, a bug or two yet remaining such as the one pointed out in another response. But the file formats are identical, and the functionality is completely equivalent.

However, saving a FreeCDF file will be slower. FreeCDF adds a signature to the end of the file which authenticates the file as having been generated by a genuine copy of Mathematica with the ability to enable certain rights and privileges when that file is run inside of Wolfram CDF Player. This signature ends up hashing the file, which can noticeably slow down file saving when working with very large files (especially hundreds of megabytes).

For that reason and others (most notably a concern for compatibility with older versions of Mathematica), Wolfram elected to continue to make .nb the default file format for a while longer.

$\endgroup$
2
  • $\begingroup$ So, that implies that I can still view a CDF using a text editor, but editing is proscribed because of the signature, correct? $\endgroup$
    – rcollyer
    Jun 16, 2012 at 18:07
  • 1
    $\begingroup$ @rcollyer Correct. You can edit it, and it won't prevent the notebook from loading, but if the signature doesn't match up, the CDF will not play correctly (i.e., enable Dynamics) in Player. $\endgroup$
    – John Fultz
    Jul 5, 2012 at 2:53
11
$\begingroup$

Interesting question. I have done some (very limited) testing and up to now did only find one thing that didn't work:

If you set the AutoGeneratePackage option for a notebook to Automatic and save as CDF the resulting package file will be named .cdf.m and not just .m. This can cause problems if you try to load that file. It's not something where using cdf as a format seems to have any potential advantage, though.

As you have mentioned in your comment, such testing can hardly ever be complete and there might very well be other things that don't work or work different.

There is some information that can be concluded from looking at what the files contain (I guess you know that you can do that yourself to find more details as they are just text files which can be looked at with any decent text editor), and I thought that is interesting enough to share.

The differences I've seen so far are:

  1. A cdf does contain a signature, which I believe will be used to check the integrity of the notebook content by the CDF player and to decide whether or not it should "play" the potential dynamic content.
  2. The CDF does contain a license information which makes some restrictions about how the cdf document can be redistributed. The consequences of that are not entirely clear to me, honestly.
  3. A Notebook seems to contain more caching information (image caching) than a cdf, which will make it somewhat larger but could make it load somewhat faster than the corresponding CDF-file.

These differences (and others that I might not have detected) are what could influence your decision on which format to use. The licensing information might be a no go for some use cases, the caching information might make a difference for large notebooks in everyday use. I don't see any disadvantage of having the signature stored within the file. Unfortunately I also don't know an obvious way how you could check the integrity of the file or making other use of that signature -- except for opening it with CDF-Player and see if it complains...

$\endgroup$
2
  • 3
    $\begingroup$ there is more to it than that. WRI could have made it so you can't use the Option Inspector to modify a CDF file. They could have made it so you can't use Drawing Tools in a CDF file. It turns out you can use Mathematica to do these things, but you can't know that from looking at the file with a text editor. I found out that I can do those things because I tried and they worked. The problem is that there are a few hundred other features that may or may not work. $\endgroup$
    – Ted Ersek
    Jun 12, 2012 at 16:09
  • $\begingroup$ @TedErsek: of course you are right, they could have made such restrictions. What WRI has published about CDF documents isn't exhaustive, and leaves us with some guessing. I have reformulated the answer and hope it is now more clear that I neither consider this answer as complete in any sense nor would expect you to accept it anytime soon nor would want to prevent anyone from giving additional answers... $\endgroup$ Jun 12, 2012 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.