55

I like to use the docked cells for this purpose. I create two buttons in my "heavy processing" notebooks: the first is a bell that rings thrice when the computation is finished — used to alert me when I'm at my computer, but doing something else. the second is to send an email to myself when the processing is finished – used when I'm away from my computer, ...


39

Here is a package which does what you want: https://github.com/arnoudbuzing/webunit Clone the repository from github, and place the WebUnit folder under $UserBaseDirectory/Applications To use it: Needs["WebUnit`"] InstallWebUnit[] (* launches chromedriver.exe *) StartWebSession[] (* launches Chrome web browser, assuming you have that installed *) ...


24

To export a sequence of plots, you don't need to do the sequential numbering by hand (or by using ToString). Instead, there is the Export option "VideoFrames" that does the numbering automatically: plots = Table[Plot[Sin[x + a], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1.1, 1.1}}], {a, 0, Pi, .1}]; Quiet[CreateDirectory["output"]]; SetDirectory["...


23

As stated in this answer you can do the following to send an email form Mathematica. Because of the nature of how email servers are set up you will have to have some server that sends the email. SendMail[ "To" -> "YYY...@me.com", "Subject" -> "Example Message", "Body" -> "My text", "From" -> "xxx...@gmail.com", "Server" -> "smtp.gmail....


20

You could launch a different kernel and use that to run the computation. You will be controlling this "slave kernel" from another Mathematica session. This will allow you to script even quitting and restarting the slave kernel. Using parallel tools This is simpler and I recommend trying this approach first. Launch a single kernel: kernel = ...


16

Reference If you want results emailed then why not combine that with scheduling of the job? So in other words if you have computations that take awhile or you run regularly why hang around or why even be there to get them started? More efficient use of time is to schedule the job and go and do something else. Have the job run while you are sleeping and get ...


12

Not a full answer, but a little too long for a comment. You may need to pay a close attention to licensing. If the results of your computation are used on a single machine (e.g. somehow saved to a database or used further in the computation), you may only need a professional single-machine license. If they are going to be used by other employees / machines ...


10

webMathematica is probably the most secure solution. Unless someone hacks your sever there is no way to get to the source of your program. Using webMathematica you could easily use standard Web services. Check out the documentation So e.g., you can create a macro in Excel and then it looks like In this way you use standard web technology and keep all your ...


9

How about an alternative: write a Mathematica script. Then calling it is as easy as MathKernel -script file.m (* MacOSX specific kernel name *) Or, more interestingly, you could make the script itself executable in a manner similar to a bash script by placing the following line as the first line in your script #!/absolute/path/to/MathematicaScript -...


9

You can programatically change DynamicEvaluationTimeout like this: SetOptions[$FrontEnd, "DynamicEvaluationTimeout" -> 30] On my machine it was set to 6 by default. Similary for DynamicUpdating where the options are True, False and Automatic SetOptions[$FrontEnd, "DynamicUpdating" -> True] I think that just changing DynamicEvaluationTimeout to ...


9

On Windows you can run your cycles in a batch file like this: @echo off setlocal PATH = C:\Program Files\Wolfram Research\Mathematica\7.0\;%PATH% echo Launching MathKernel %TIME% break > "C:\Temp\Incomplete" start MathKernel -noprompt -initfile "C:\Temp\Cycle1.m" :Label1 ping localhost -n 5 > nul if exist "C:\Temp\Incomplete" goto Label1 ping ...


8

Here is a minimal example on how to run a mathematica script on a raspberry pi. Create a simple script (I used my bash terminal to do it): echo "sum=1+1; Print[sum]" > test.wl Excecute the script: wolfram -script test.wl 2


8

The "folding in" of the reduced zone scheme is achieved by translating the center of the energy function, placing one center on each brillouin zone edge: Plot[ {x^2, (x - Pi)^2, (x + Pi)^2, (x - 2 Pi)^2, (x + 2 Pi)^2}, {x, -Pi/2, Pi/2}, AspectRatio -> GoldenRatio, PlotStyle -> Black ] I plotted here a function proportional to $x^2$ as would be ...


7

a = {{{1}}, {{2}}}; q = {"one", "two"}; Export["c:\\test.xlsx", Rule @@@ Transpose@{q, a}]


7

Let's suppose that these are your imported data (three sets of random numbers): importedData = Table[RandomReal[{0, 1}, {10, 2}], {3}]; Now we can directly produce and export the PNG files: Table[ Export[ "plot_" <> ToString[i] <> ".png", ListPlot[importedData[[i]]], "PNG" ], {i, Length[importedData]} ] {"plot_1.png", "...


7

Here is one way to do it, using WebUnit: Needs["WebUnit`"]; InstallWebUnit[]; StartWebSession[]; OpenWebPage["http://suggestions.livejournal.com/825341.html"]; Then, use JavascriptExecute to get all the links in the document and select only the ones that have the text EXPAND in them: expandLinks = Flatten @ JavascriptExecute[" var links = document....


7

You can start a fresh extra kernel programmatically from your current notebook using MathLink. You can then load packages in that kernel, perform necessary calculations, get the result back to your main notebook, and close the extra kernel. Here is a function which automates this process (based on freshKernelEvaluate from this answer by @jkuczm) ClearAll[...


6

Implementing for example $\prod_{j>i}^Nf(a_i-a_j)$: nup = 4; Times @@ Flatten@Table[f[a[i] - a[j]], {i, 1, nup - 1}, {j, i + 1, nup}] where nup is $N$.


6

An idea on how to use osascript (as also suggested by sebhofer in a comment to the question): with Mathematica running, execute osascript -e 'tell application "Mathematica" to quit' in a shell. It quits Mathematica completely. If there are unsaved notebooks, Mathematica pops up a dialog, so make sure everything is saved before doing that. To be able to ...


6

Update: The original post below computes the commonest color in the NeighborhoodGraph of a vertex v including the vertex v itself. To exclude a vertex in counting the colors in its neighborhood, we can use the following helper function: ClearAll[newClrF]; newClrF = Module[{nc=#, oc=First@#, c1= Commonest[Rest@#][[1]], c2= Quiet@Commonest[Rest@#, 2]}, ...


6

You can use the default vertex shape (Disk) and use the option VertexLabels (that is, no need to use VertexShapeFunction): edges = {1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> 6, 6 -> 7, 7 -> 8, 8 -> 1, 1 -> 9, 2 -> 9, 3 -> 10, 4 -> 10, 6 -> 11, 5 -> 11, 7 -> 12, 8 -> 12}; LayeredGraphPlot[edges, Left, ...


5

If you want to get a text message on your cellphone when the calculation is done, you need a little bit more structure than what Mathematica has built in, but it's not too hard to do. I use IFTTT - "if this, then that", pronounced ift as in 'gift'. It's a free service which can do all sorts of things, to turn one sort of 'trigger' into an action on some ...


5

f = {# &, 3*# - 5 &, 0.1*#^2 &}; xvalues = Range[0, 500, 2.5]; t1 = Through[f[xvalues]] /. x_ /; x < 0 -> 0; ListPlot[t1, DataRange -> {0, 500}]


5

Evaluating the following will not produce the print statement: NotebookEvaluate[nb, InsertResults -> True, EvaluationElements -> {"Tags" -> {"blabla"}}]; And will only evaluate cells with tag "blabla". Another example: nb = CreateDocument[{ExpressionCell[Defer[Print["Text 1"]], "Input", CellTags -> {"Print"}], ExpressionCell[Defer[...


5

This will do what you want, without having to resort to SelectionMove or something silly like that. Of course, it does not use CellAutoOverwrite, so possibly this is not the "yes" you would have hoped for. The same can probably be achieved using CellID, but I'm not sure how that works. NotebookDelete[Cells[CellTags -> "@#$kill me"]] CellPrint[ ...


5

This post addresses the problem of saving graphics output in an automated session: https://stackoverflow.com/questions/7626491/uncaught-throw-generated-by-jlink-or-usefrontend E.g. with a file called test.m containing this: Needs["JLink`"]; $FrontEndLaunchCommand="Mathematica.exe"; UseFrontEnd[ nb = NotebookOpen["C:\\Temp\\run.nb"]; SelectionMove[nb, Next,...


5

First, let's whip up a random graph: n = RandomInteger[{10, 15}]; m = RandomInteger[{Floor[n^2/20], n (n - 1)/2}]; G = RandomGraph[{n, m}]; For[i = 1, i <= n, i++, chi[0, i] = {Red, Blue}[[RandomInteger[] + 1]] ]; Graph[G, VertexStyle -> Table[i -> chi[0, i], {i, 1, n}]] The coloring at step k will be denoted chi[k,i], where i indicates a ...


5

UsingFrontEnd achieves the same result, although the notebook execution is no longer visible. runProcess.m UsingFrontEnd[ file = "C:\\myPath\\Process.nb"; targetnotebook = NotebookOpen[file, Visible -> True]; SelectionMove[targetnotebook, All, Notebook]; SelectionEvaluate[targetnotebook]; ]; Pause[5]; CloseFrontEnd[]; Problem solved ...


5

With an input auto replacement like "fss", you need to have some way of telling Mathematica that "fss" is a complete token. That is, "fss" only gets replaced when the next character is not a letter. The usual input auto replacements typically get replaced when you type a letter, e.g., a->b only becomes $a\to b$ after you type the letter "b". So, to make ...


4

Contrary to what most people say (including people working at Wolfram), you do not need Mathematica to run Wolfram Language scripts. What you need is a MathKernel and the wolframscript interface. You install the former by installing the freely available Wolfram CDF Player, the latter is also freely available from Wolfram website. Once you have installed ...


Only top voted, non community-wiki answers of a minimum length are eligible