# Tag Info

26

You are correct about the behavior of computations done from preemptive links. So-called "preemptive evaluations" have been around since version 6. They are a class of evaluations that all work through the same mechanism. When Mathematica checks to see if a user interrupt has been requested, which it does at a high rate most of the time, it also looks to see ...

22

While trying to debug this issue myself, I stumbled across Todd Gayley's name in the source of one of the documentation .m files and contacted him directly. Todd was super great to work with---and at the end of an hour of screensharing he provided an easy workaround. The workaround essentially short-circuits one tiny feature of a normal documentation ...

17

Yes, I did something like that and it runs very very nicely. What I implemented is a dynamic Newton fractale visualizer where you can manipulate the number and position of the complex roots, the colours and the gamma correction settings from the Mathematica side. These values are sent to a parallel C++ implementation which calculates the fractale into a ...

12

Imagine you are the front end. Once upon a time, you were told to display some DynamicBox So, you need to know what it evaluates to AND the list of tracked symbols that would trigger its next update, and perhaps some upper bound on the update interval. So you ask your friend the kernel to evaluate what is inside. Whatever symbol responsible for a ...

12

I think I have to explain how I look at Dynamic before I can speak about Refresh. Dynamic is the basic element of dynamic updating, and the only one as far as I can tell. Anything that behaves dynamically has Dynamic somewhere inside it, I believe. If you think of an expression as a tree, then Dynamic[code] marks out the branch representing code for ...

12

Preliminaries As Todd has indicated in his answer which has a lot of excellent information, the situation where the described behaviour will actually trigger problems will be very rare. I also read from his answer that WRI doesn't consider this behavior to be a bug and my hopes that this might change in future versions are low or nonexistent. I show ...

12

Here's a V9 solution (CellObject is new in V9). The output is two cells, one with graphics to be edited and another that contains an InputField. The connection between them is maintained by identifying the graphics cell by the tag CellTags -> "DrawOnMe", which needs to be unique, and by the V9 feature CurrentValue[cellobj, CellChangeTimes]. By putting ...

12

Well, Mike Honeychurch and Leonid Shifrin have pretty much covered the ground, but I have one thing to add, which, while based only on observed behavior, I think helps explain what's going on. Set and SetDelayed both create OwnValues is the form HoldPattern[symbol] :> code. The difference is that code is unevaluated in the case of SetDelayed. ...

11

My take: toward[p1_, p2_, v_: .05] := p1 + v Normalize[p2 - p1]; {n, r} = {4, 3}; DynamicModule[{pts, history}, pts = r {Cos[#], Sin[#]} & /@ Range[2 Pi/n, 2 Pi, 2 Pi/n]; history = {pts}; Print[Dynamic[ListPlot[Transpose@history, AspectRatio -> Automatic, Joined -> True, PlotStyle -> Directive[Thick, CapForm["Round"]], ...

11

I am writing this answer for a person who is familiar with Mathematica and has a good understanding of computer programming, but not so familiar with Java programming language. Using GraphStream is not so different from using any other Java library. You need to download the GraphStream core files from here and extract it. gs-core-1.1.2.jar is the only file ...

11

A reliable composition of elements Perhaps something like this? (Edit: Fixed to work with Autorun.) Note that the InputField label is editable, similar to a normal Manipulator. One can also add an additional InputField[Dynamic @ x] if a regular InputField is desired. Manipulate[ x, {{x, 1.}, 1., 100., Row[{Slider[Dynamic[Log10[#], (x = 10^#) &], ...

11

I prefer Bold and Larger in Style: Animate[ Grid[ Partition[ Table[ Style[i, Bold, Larger, If[i > j, Black, If[ PrimeQ @ i, Blue, Gray]]], {i, 100}], 10], Spacings -> {1, 1}], {j, 0, 100}, Paneled -> False] but if you like delete from ...

11

One way is to create a Polygon and transform the vertices under the flow. I used NDSolve to solve the flow for initial points in a square containing the OP's disk. Then I made a listable Function that can be applied to a the vertices of the polygon. Since only the flow depends on the time t, I used a GraphicsComplex so that the vertices come first as a ...

10

Nice answer by Mohsen, +1. I am continually impressed by the quality of the J/Link and .NET/Link expertise on this site. I have a couple remarks and then an example program. The question asked about some general tips for getting started with J/Link. This GraphStream library provides a perfect example for the typical workflow of a J/Link project. The ...

10

Dynamic has this build into it. You can take advantage of the Dynamic second and third arguments. The second argument of evaluate as the dynamic is being updated. The third argument is evaluated when the mouse is released. Which is what you want. To illustrate, here is an example, where f[r] and g[r] are inside the arguments of the slider itself. This is ...

9

While John Fultz gave a depressing answer concerning GUI controls, I doubted that this cannot be done in Mathematica. A bit of exploration and Rojo's extremely useful answer helped me to come up with a workaround to simulate Method -> Queued for GUI controllers other than Button. The function queued accepts any dynamic controller as its first argument ...

9

Thanks to Michael E2's comment, the following approach is successful. The method sets up a scheduled task that (at certain resolution res) monitors the elapsed $time and compares it to the dynamic$max. If $time is more than allowed by$max, it calls the front-end "EvaluatorAbort". Attributes[dynamicTimeConstrained] = {HoldAll}; ...

9

A direct replacement Perhaps your specific example might best be handled with: Array[ (a[##] = f[##]) &, Table[4, {3}] ] { . . . { . . . {f[3, 1, 1], f[3, 1, 2], f[3, 1, 3], f[3, 1, 4]} . . . } . . . } Where 4 is n and 3 is the number of loops. Output it was included above for illustration; it may be suppressed with CompoundExpression: ...

9

Here's a fairly simple way to fix your Manipulate by applying Dynamic to ListPlot. Manipulate[ (* Beep[]; *) data = function @ Range[-Pi*10., Pi*10, Pi/1000]; Dynamic @ ListPlot[data, PlotRange -> {{start, stop}, Automatic}], {function, {Sin, Cos, Tan}}, {start, 1, Length[data]}, {{stop, 300}, 1, Length[data]}, {data, ControlType -> None}] ...

9

I would approach this problem a bit differently. I would provide each such notebook with an initialization button at its top, right under its title, if any. By pressing this button, the dynamic apdating would be enabled. How to do it technically, is already in the comment of belisarius. The further is only a question of a design. The latter should be ...

9

ControlActive is useful for this purpose: DynamicModule[{r = 1, old = 1} , Grid[ { {Slider[Dynamic[r]], SpanFromLeft} , {Dynamic[f[r]], Dynamic[g[ControlActive[r, old = r]; old]]} } ] ] The variable old has been introduced to hold the "old" value of r. The key expression is ControlActive[r, old = r]; old, which always returns the value of ...

8

Here's a start: (* Recording *) vp = OptionValue[Graphics3D, ViewPoint]; vv = OptionValue[Graphics3D, ViewVertical]; vprec = list[]; vvrec = list[]; g = Graphics3D[Cuboid[], ViewPoint -> Dynamic[vp, (vp = #; vprec = list[vprec, #]) &], ViewVertical -> Dynamic[vv, (vv = #; vvrec = list[vvrec, #]) &] ] I used a linked list for O(1) ...

8

You need to identify the graphics object with a (local, dynamic) variable to use in a call to Export[]. It's easy to use a button to export from within the scope of the dynamic block. If you want the button to be external to the block, you can use TaggingRules as explained in your link. I prefer not to play around with extending the scope of variables. ...

8

Artes's answer is just fine. This variation works as follows. When you click on a number, the background of that number turns yellow and that of each of its divisors turns light blue. DynamicModule[{s = 101}, Grid[Partition[Dynamic@Button[Style[#, 16], (s = #), Background -> Which[ # == s, Yellow, Divisible[s, #], LightBlue, True, White], Appearance ...

7

If pre-version-9 (no gauges yet), one has to rely on custom built controllers. Here is a slider implementation using LocatorPane (I prefer lines with rounded caps instead of rectangles because of aspect ratio issues): slider[Dynamic[var_], {min_, max_}] := Module[{x = 0}, LocatorPane[ Dynamic[{x, 0}, (x = First@#; var = Rescale[x, {-1, 1}, {min, ...

7

You could always try a gauge: gf[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := {Black, Rectangle[{xmin, -0.01}, {xmax, 0.01}, RoundingRadius -> .01]} HorizontalGauge[Dynamic[n], {1, 9}, ScaleDivisions -> None, ScaleRanges -> All, ScaleRangeStyle -> None, GaugeFaceElementFunction -> gf, GaugeMarkers -> Placed[ Graphics[{Black, ...

7

You definitely should not rely on this behavior. There is one and only one proper way to get dynamic behavior for the rhs of a front end option, and that is to wrap Dynamic around the entirety of the option. The only exceptions to this rule at present are certain options which will assume the Dynamic if one doesn't exist, such as CellDynamicExpression and ...

7

This is good reason to use the second argument of dynamics. Manipulate[ function; (*just to allow tracking, since not explicity in the command*) ListLinePlot[data, PlotRange -> {{start, stop}, Automatic}, ImageSize -> 300, ImagePadding -> 30, Frame -> True, FrameLabel -> {{None, None}, {"x", function}} ], Grid[ { ...

7

I believe that Mathematica feeds the input string in free-form linguistic input to the function WolframAlpha. Try something like Manipulate[ If[in =!= "", WolframAlpha[in], "Enter input"], {{in, ""}, InputField[Dynamic[in], String] &} ] Response to comment I can't find a definitive statement in the documentation that an internet connection is ...

7

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 ...

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