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?



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.

  • $\begingroup$ take a look at CreateDocument[] et al $\endgroup$ – Dr. belisarius Nov 20 '14 at 16:14
  • $\begingroup$ If you must loop over a (multiple cell ) notebook see here: mathematica.stackexchange.com/questions/50570/…. $\endgroup$ – george2079 Nov 20 '14 at 16:18
  • $\begingroup$ Strangely, it appears to be a hard thing?! Even in MathGroup I did not find any answers in relevant queries... $\endgroup$ – Dimitris Nov 20 '14 at 17:21
  • 1
    $\begingroup$ 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 $\endgroup$ – george2079 Nov 20 '14 at 17:53
  • 1
    $\begingroup$ You should consider converting your notebook into a package (.m, more or less a WL script). Then repeated evaluation will be trivial. $\endgroup$ – Yves Klett Nov 21 '14 at 7:22

elaborating on the answer referenced in my comment, here is a self-evaluating notebook..

enter image description here

  • $\begingroup$ George, great staff! Thanks! $\endgroup$ – Dimitris Nov 21 '14 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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