From: slawek on
I have got a medium size .nb notebook, but the "evaluate notebook" command
take about half a hour.

The "save" command save only input cells (and comments etc.) - but the
context (the values of variables) are not saved. Therefore after "open" I
must "evaluate" to restore the state of computations from a previous
session.

An example:

after loading saved notebook with

In[1] := x = Simplify(1+1+1)
Out[2] = 3

I have two lines in the Mathematica front-end, but: a. no kernel is loaded;
b. the value of x is not 3, because x is not defined.

Is it a way to save the notebook with all results, variables etc. to avoid
re-calculation of formulas? I.e. a save .nb with a dump the state of kernel?

slawek





From: David Park on
Why not add two Sections to your notebook.

1) Long Calculations would contain the calculations that take a long time.
Presumably this would be evaluated only once, but sometimes you might want
to go back, modify and recalculate. If you have x = longCalculation[...]
then immediately redefine x to be the output, perhaps by writing x = and
using Shift+Ctrl+L to get the previous output. The cells in this Section
would not be Initialization cells.

2) Copy the redefinitions from the Long Calculations section into a Restart
Section and make these Initialization cells. (Do not save as an auto
generated package.) Again, presumably the redefinitions will evaluate
quickly.

Then when you open your notebook and start to evaluate in some third section
the symbols will all be quickly initialized and you won't have to go through
the long calculations each time.


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/




From: slawek [mailto:slawek(a)host.pl]

I have got a medium size .nb notebook, but the "evaluate notebook" command
take about half a hour.

The "save" command save only input cells (and comments etc.) - but the
context (the values of variables) are not saved. Therefore after "open" I
must "evaluate" to restore the state of computations from a previous
session.

An example:

after loading saved notebook with

In[1] := x = Simplify(1+1+1)
Out[2] = 3

I have two lines in the Mathematica front-end, but: a. no kernel is loaded;
b. the value of x is not 3, because x is not defined.

Is it a way to save the notebook with all results, variables etc. to avoid
re-calculation of formulas? I.e. a save .nb with a dump the state of kernel?

slawek







From: Roger Wilson on
On 4 Aug, 12:55, "slawek" <sla...(a)host.pl> wrote:
> I have got a medium size .nb notebook, but the "evaluate notebook" command
> take about half a hour.
>
> The "save" command save only input cells (and comments etc.) - but the
> context (the values of variables) are not saved. Therefore after "open" I
> must "evaluate" to restore the state of computations from a previous
> session.
>
> An example:
>
> after loading saved notebook with
>
> In[1] := x = Simplify(1+1+1)
> Out[2] = 3
>
> I have two lines in the Mathematica front-end, but: a. no kernel is loaded;
> b. the value of x is not 3, because x is not defined.
>
> Is it a way to save the notebook with all results, variables etc. to avoid
> re-calculation of formulas? I.e. a save .nb with a dump the state of kernel?
>
> slawek

DumpSave[filename] will save the state of your kernel to a file.
Get[filename] will load this back. It doesn't save the notebook as
well as you can have the kernel in various different states for the
same notebook. DumpSave can take some time, Get is usually fairly
fast.

So, first time round do...

LongCalcs...
DumpSave...
Get...
ShortCalcs...

Next time start at Get.

From: David Bailey on
On 04/08/10 12:55, slawek wrote:
> I have got a medium size .nb notebook, but the "evaluate notebook" command
> take about half a hour.
>
> The "save" command save only input cells (and comments etc.) - but the
> context (the values of variables) are not saved. Therefore after "open" I
> must "evaluate" to restore the state of computations from a previous
> session.
>
> An example:
>
> after loading saved notebook with
>
> In[1] := x = Simplify(1+1+1)
> Out[2] = 3
>
> I have two lines in the Mathematica front-end, but: a. no kernel is loaded;
> b. the value of x is not 3, because x is not defined.
>
> Is it a way to save the notebook with all results, variables etc. to avoid
> re-calculation of formulas? I.e. a save .nb with a dump the state of kernel?
>
> slawek
>
>
>
>
>
DumpSave is very useful in that it is very fast, and creates a binary
file (with suffix .mx) that can be read back with Get. The read back is
also very efficient.

However, you will need to specify what exactly needs saving (see the
help for this function), but if your notebook is reasonably well
organised, this may not be hard.

David Bailey

http://www.dbaileyconsultancy.co.uk

From: slawek on

U=BFytkownik "David Park" <djmpark(a)comcast.net> napisa=B3 w wiadomo=B6cigrup
dyskusyjnych:i3e5hm$h9a$1(a)smc.vnet.net...
> Why not add two Sections to your notebook.
>
> 1) Long Calculations would contain the calculations that take a long time.
> Presumably this would be evaluated only once, but sometimes you might want
> to go back, modify and recalculate. If you have x = longCalculation[...]
> then immediately redefine x to be the output, perhaps by writing x = and
> using Shift+Ctrl+L to get the previous output. The cells in this Section
> would not be Initialization cells.

DumpSave["NotebookName.mx","Global`"]

and

<< "NotebookName.mx"

do the job. All variables (except maybe %, %13, Out[13] etc.) are restored.

Thanks for help, anyway.

slawek



 | 
Pages: 1
Prev: Deleting entries with zero in a table
Next: Format