# working with notebooks ('looping' a notebook and storing the results of each step in another notebook)

A notebook contains a series of numerical calculations (numerical integrations, numerical solution of systems of equations etc).

Many parameters are involved.

The final result is in the form of a list; let's called Reslst.

Say, that I want for a specific parameter to evaluate ten times this notebook (each evaluation will give different Reslst) and stored the results (i.e. Reslst) in a new notebook automatically, without copy/paste.

Is it possible to do this? If yes, how?

Thanks.

Update

I will try to be more specific. Let's call the original notebook EVALUATIONS.

This notebooks contains values numerical calculations which eventually result in the following

Keff = Km + (cp*(-Km + Kp)*(3*Km + 4*Mm))/(3*Km +
3*(1 - cp)*(-Km + Kp) + 4*Mm);

Meff = Mm + (5*cp*Mm*(3*Km + 4*Mm)*(-Mm + Mp))/(5*Mm*(3*Km + 4*Mm) +
6*(1 - cp)*(Km + 2*Mm)*(-Mm + Mp));

Reslst = {cp, Keff, Meff};


Apart from cp the Km, Kp etc are obtained from the aforementioned numerical calculations.

What I want now is the following.

Starting with cp=0, evaluate 11 times the notebook for 0<=cp<=1 (i.e. with 0.1 steps) and stored the list Reslst in a another notebook called it RESULTS. The whole procedure will be done automatically. No need for Copy/Paste; no need for press SHIFT+ENTER more than one time.

I read the suggestions in the comments, but since I haven't worked with these features (actually I did not know their presence) I would appreciate bigger help.

• take a look at CreateDocument[] et al – Dr. belisarius Nov 20 '14 at 16:14
• If you must loop over a (multiple cell ) notebook see here: mathematica.stackexchange.com/questions/50570/…. – george2079 Nov 20 '14 at 16:18
• Strangely, it appears to be a hard thing?! Even in MathGroup I did not find any answers in relevant queries... – Dimitris Nov 20 '14 at 17:21
• automated evaluation of whole notebooks is not the usual way of working with mathematica. Better to simply use a loop construct. reference.wolfram.com/language/guide/LoopingConstructs.html – george2079 Nov 20 '14 at 17:53
• You should consider converting your notebook into a package (.m, more or less a WL script). Then repeated evaluation will be trivial. – Yves Klett Nov 21 '14 at 7:22

## 1 Answer

elaborating on the answer referenced in my comment, here is a self-evaluating notebook.. • George, great staff! Thanks! – Dimitris Nov 21 '14 at 9:20