47

I don't think it is possible for FullSimplify to assess how far it is from a meaningful reduction of complexity. At every stage parts of the expression may after some transformation cancel (or not). Sometimes complexity has to be increased before it can be lowered (as I showed in this answer). Simplification is the process of minimizing complexity, where ...


26

Monitor[NDSolve[{eq, bc1, bc2, ic}, z, {t, 0, 100}, {x, -Lx, Lx}, {y, -Ly, Ly}, Method -> mol, StepMonitor :> (time = t)], ProgressIndicator[time/100]] This doesn't appear to slow down the evaluation in any significant way: RepeatedTiming[ NDSolve[{eq, bc1, bc2, ic}, z, {t, 0, 100}, {x, -Lx, Lx}, {y, -Ly, Ly}, Method -> mol], 60] ...


20

Here are a few versions I use: 1) showStatus[status_] := LinkWrite[$ParentLink, SetNotebookStatusLine[FrontEnd`EvaluationNotebook[], ToString[status]]]; clearStatus[] := showStatus[""]; clearStatus[] NDSolve[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, u[t, 0] == Sin[t], u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}, EvaluationMonitor :>...


16

One approach would be to run the evaluation in a second kernel which is controlled from a main kernel through MathLink/WSTP. Then your main kernel can detect if the MathLink connection dies. You can implement this manually (a lot of work), or you can try to do it using the parallel computing tools, where much of the groundwork is already laid down. In ...


16

You should be aware of the fact that using either StepMonitor or EvaluationMonitor could considerably slow down the execution of NDSolve, so the progress indication might come at a price. As there might be several evaluations per step, StepMonitor will be excecuted less often than EvaluationMonitor so might be a better choice in most cases. It also is one of ...


13

This is on our list of planned functionality. For now, you can estimate the run time by training on a smaller set first, and then extrapolating.


13

As a more complete answer to my comment above, Mathematica doesn't necessarily assume a variable is a number upon introduction. Initialize the counter variable equal to zero and then the increment will be handled correctly for the shared variable. monitoredParallelTable[expr_, {x_,xmin_,xmax_,xstep_}]:=Module[{counter = 0,tmp}, SetSharedVariable[counter]; ...


13

Assuming FrontEnd survives, prepare 3 cells: (*init cell, won't be needed later*) state = CurrentValue[EvaluationNotebook[], {"TaggingRules", "state"}] = 0; SetOptions[ #, {CellTags -> {"Procedure"}, ShowCellTags -> True} ]& /@ {NextCell[], NextCell @ NextCell[]}; CurrentValue[$FrontEndSession, "...


11

As a Palette 1) Using ListLinePlot: CreatePalette[{ DynamicModule[{miu, timeStep = 0.1}, Grid[{ {Row[{"Current MemoryInUse [MiB]: ", Dynamic[Style[miu[[-1]], Bold], TrackedSymbols :> {miu}]}], Item[Row[{"time step: ", RadioButtonBar[Dynamic[timeStep], {0.1, 0.5, 1}], Spacer[35]}], Alignment -> Right]}, {Dynamic[...


11

An adaption of this answer for an ActionMenu and to your styling: assnMenuK[slowF_, a_Association, title_: "Choose"] := DynamicModule[{done = False, lastSelection = ""}, Grid[{{ ActionMenu[title, KeyValueMap[#2 :> (lastSelection = #2; done = "working"; slowF[#1]; done = True) &, a], Method -> "Queued"], Dynamic@Style[...


10

Mathematica's Export of animated GIFs isn't perfect. I personally prefer to Export only individual frames from Mathematica, and then use a third-party program for assembling them into an optimized animated GIF. In this case it is easy to monitor the process of Exporting of individual frames: table = Table[ Plot[Sinc[t x], {x, 0, 10}, PlotRange -> 1], {...


10

As I said in my comments, it is hard to implement this correctly if you aim for some advanced Dynamic features that work in the command line. However, you can surely use the carriage-return trick on the command line. The only obstacle here is that Print puts everything on a new line. However, if you write directly to stdout, you don't have this problem. ...


9

In general, it looks like you need to separate the process of execution and monitoring. The only general way I see to do this is to make your function an object (a pair of functions sharing a mutable state), so that one function would execute the code, while the other would report the internal state to the user. Here is one possibility: obj = Module[{n},...


9

With the 10.3 release and introduction of Echo there is neat simple way: Just wrap Echo around w/e you map: Echo[f[#]] & /@ Range[5] And if you want to suppress large outputs, you can do something like MapIndexed[(Echo["", First[#2]]; Sin[#1]) &, Range[5]] which is similar to print but pretty.


9

Here is how I would approach this: Clear[myEcho, myEchoCounter] myEcho::stop = "Further output from `` will be suppressed during evaluation of In[``]."; myEcho[, ] := myEcho[]; myEcho[label_: Null, max_: 3][expr_] /; myEchoCounter[$Line, label] >= max := expr myEcho[label_: Null, max_: 3][expr_] := ( If[Not@NumberQ[myEchoCounter[$Line, label]], ...


8

Expanding a little over rasher's answer: data = Table[{x, Log[3.5 + 2.5 x^2] + RandomReal[{-1, 1}]}, {x, 0, 10}]; r = {}; s = {}; u = {}; Dynamic[ GraphicsGrid[{{ Plot[Log[r[[-1]] + s[[-1]] x^2], {x, Min@data[[All, 1]], Max@data[[All, 1]]}, PlotLabel -> "Fitting", Frame -> True, Epilog :> {Red, PointSize[Medium], Point[data]...


8

Here's a trivial example of the method in my comment. I've used total absolute difference for error (you can use whatever you please), and I put in a Pause so you can observe the effect for this trivial problem that would be blink-of-an-eye fast. In reality, you'd want to use UpdateInterval or equivalent, or Sow if you want the "history" post-run. Doing ...


8

You need to estimate and display that percentage yourself. This estimation must be part of the program you write. There is no way to do it automatically either in Mathematica or any other system. Theoretically, it is not even possible to decide if an arbitrary algorithm will ever finish, let alone how many steps away it is from finishing. If your algorithm ...


7

This might come close to your need; Dynamic[Refresh[MemoryInUse[], UpdateInterval -> 1]] This will update every second the amount of memory used by the kernel.


7

With small modifications of the code provided by m_goldberg you can get the Button and the ProgressIndicator in the same Row. However, it is always there now and will not appear and disappear. DynamicModule[{n = 1}, Row[{Button["Start", n = 1; Do[Pause[0.1]; ++n, {i, 1, 100}], Method -> "Queued"], Spacer[23], Dynamic[ProgressIndicator[n, {1, 100}]]}...


6

Using Graphics directly instead of *Plot should give a better performance. The following code with timeStep set to 0.1 consumes less than 10% CPU on my laptop. Click the graphics to pause, click again to resume, click the "Truncate to ..." button to truncate the record: DynamicModule[{miu, flag = True, timeStep = .1}, Module[{startTime = AbsoluteTime[],...


6

Look at this answer and ProgressIndicator Monitor[Table[Pause[0.1]; Prime[i], {i, 100}], ProgressIndicator[Appearance -> "Necklace"]]


6

Here is a crude progress bar demo script that has been tested in a Gnome terminal under Linux and a Powershell command prompt under Windows 10. Don't expect much because it's only a loop with a print statement: progbar[width_, title_] := Function[{ndx}, Print[ " " <> title<>"\n [" <> StringJoin@ConstantArray["*", ndx] &...


6

Another way to do this: In[1]:= << GeneralUtilities` In[2]:= $MaximumEchoRate = 5; In[3]:= Table[EchoHold@x, {x, 10}] x \[Function] 1 x \[Function] 2 x \[Function] 3 x \[Function] 4 x \[Function] 5 During evaluation of In[3]:= Maximum echo rate exceeded, change $MaximumEchoRate to adjust. Out[3]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}


6

The loss is a more general quantity than accuracy since accuracy is only defined for classification problems. However, you can easily make a custom report function that plots the accuracy as it trains. resource = ResourceObject["MNIST"]; trainingData = ResourceData[resource, "TrainingData"]; testData = ResourceData[resource, "TestData"]; lenet = NetChain[{...


6

I have implemented a relatively bare-bones textual frontend for Mathematica called MathLine. It offers Readline-like text input (uses linenoise), which means command history and emacs-style editing. Symbol completion would be easy to implement and is not affected by the same technical challenges of dynamic monitoring mentioned by others. The ergonomic ...


6

This is my way, based on ParallelSubmit and WaitNext. Here is a task that may take long time to finish and fails 50% of the time. We want to return not only the result, but also metadata that would allow us call the task again, analyze performance and have a decent log of what's happening. task[s_] := Block[ { p = RandomInteger[9], success }, ...


6

Here is one approach, based on @b3m2a1's excellent answer here: Attributes[StaticMonitor] = {HoldAll}; UpdateMonitor[] := Null; StaticMonitor[expr_, mon_] := Block[ {UpdateMonitor, boxID = ToString@Unique[]}, PrintTemporary[RawBoxes@TagBox[ToBoxes@mon, boxID, BoxID -> boxID]]; UpdateMonitor[] := FrontEndExecute@FrontEnd`BoxReferenceReplace[ ...


5

lp = ListPlot[#, PlotRange -> {{0, 50}, {0, 10}}] & /@ RandomReal[10, {10, 50}]; showlp = Show[lp[[#]], PlotLabel -> Style["index = " <> ToString@#, 16, Bold]] &; number = Length[lp]; Update: If you don't have to use Monitor, there are a number of alternatives including Dynamic and Clock combination: Dynamic@With[{c = Clock[{1, number, ...


5

With a single Solve command, I think this is impossible. But you can do something like the following. There are some strange curly brackets in your equation, so I hope I repaired it correctly. (I did not find a solution, and FindInstance did not give a solution either.) Monitor[Table[{p,s, sol=Solve[(n^2 (s-2)-n (s-4))/2==2^p-1 && 2<n<2100, n,...


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