# Tag Info

13

The problem relates to the granularity of MachinePrecision numbers. The number 70.329862 is represented as an integer times a power of 2: x0 = SetPrecision[70.329862, Infinity] (* 4949024067128413/70368744177664 *) (The denominator is 2^46.) The machine numbers near this number do not allow for the representation of 70.329862 with $MachinePrecision ... 13 Based on Mr.Wizard's answer and Szabolc's comments to it, I now understand that the code I posted does have undesirable side-effects and it should be avoided. Specifically, the scoping constructs Module and Block are meant to completely localize the variables in their first argument (for more information see this question). However, placing their scoped ... 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 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}; ...

10

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

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

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

9

By default, DynamicModule uses SynchronousInitialization -> True. This causes the initialization to be performed on the preemptive link, disabling any updates to the front-end. In particular, print statements, cell creation and dynamic box updates will all be deferred until the initialization completes. If we wish to monitor that initialization within ...

8

Note that you've defined t as a Dynamic expression. A relational operator like GreaterEqual (>=) works with numeric expressions like the result of Clock. You could try something like this to get a displayed output that eventually switches from False to True: step = .1; Dynamic[{t, t = Clock[{0., 5., step}, 5., 1]; t >= 2}]

8

EDIT Input gets different rounding to machine-precision real if it's written in arbitrary precision! RealDigits[70.329862, 2] (* {{1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1}, 7} *) RealDigits[ SetPrecision[70.329862000000000000, ...

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

7

The reason for this behaviour is that as soon as the cursor gets away from a particular vertex marker it leaves the associated EventHandler. Here's a work-around, let's associate the event handler with the whole Graph. We just need to take care of updating the proper pos. DynamicModule[{ind = 1, pos1 = {1, 0}/2, pos2 = {1, 1}/2, pos3 = {-1, 0}/2}, ...

7

This is a very common problem for people who work on data analysis. Here as a solution to the problem using LocatorPane and a few other functions and tricks. TooltipListPlot[data_, tipFunction_, listPlotOptions___] := DynamicModule[ {displayQ = False, yRange , xRange, pt, minX, maxX, minY, maxY, tip, threshold, tipPosition, nf, dataPoints, ...

7

SynchronousInitialization -> True causes dynamic evaluations to occur on the preemptive link. This locks up the notebook front-end for the duration of an evaluation. To avoid locking up the front-end indefinitely, there is a default timeout of six seconds: CurrentValue[EvaluationNotebook[], DynamicEvaluationTimeout] (* 6. *) The values we see for x ...

7

Just a kickstart to get the equations right (yours are wrong) and an idea of the system dynamics: With[{Pr = 10, a = 1.181, b = 0.675, v = 0.77, l = 8/3}, pfun = ParametricNDSolveValue[{ x'[t] == Pr v (y[t] - x[t]), y'[t] == R (b/v) x[t] - a y[t] - (b/v) (R - (a v)/b) x[t] z[t], z'[t] == a l (x[t] y[t] - z[t]), x[0] == y[0] == 0.8, ...

6

You don't have repeat yourself. You can map a pure function defining the button over a list of the background colors and then apply Mouseover Like so: Mouseover @@ (Button[Panel["Print", FrameMargins -> {{4, 4}, {4, 4}}, Background -> #], Print["Print"], Appearance -> None] & /@ {Red, Green})

6

Here's one solution that meets the criterions. I'll walk through the main ideas step by step. First I started by creating a list of circles and a list of lines. Then I formed a region from those elements, which I called grid. I also added the gridlines that were used originally and so recreated the plot: circles = Table[Circle[{0, 0}, r], {r, 1, 14}]; ...

6

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

6

Perhaps something like this? text = ""; EventHandler[ InputField[Dynamic@text, String, ContinuousAction -> True], {"ReturnKeyDown" :> Paste["\n"]} ]

6

The problem seems to be that a TagBox that is generated is handled incorrectly by the front end. The TagBox has the form TagBox[bigExpr, Deploy, DefaultBaseStyle -> "Deploy"]. In this expression the second argument Deploy is quite meaningless. I couldn't trace any further than this TagBox as I cannot see how the front end handles it. How the kernel ...

6

In your example the resolution of image is going to zero with number of points and you will see the scattered field after addition of some dozens of thousands of points.. What is the sense of such drawing and moreover the sense of dynamic updates of such graphics? May be it is better to use something like this, with pre-defined size: data = Table[0, {i, ...

6

This appears to be a front-end bug involving the evaluation of arrays and built-in functions within a DynamicBox. The original example can be made to work by defining max = Max; and using the user function max in place of the built-in functionMax: max = Max; DynamicModule[{s = 1, q = {{False}}}, {Checkbox[Dynamic[q[[1, 2 - max[s, 0]]]]], Dynamic[q[[1, 2 ...

6

I believe that highlighting is there specifically to encourage you to use DynamicModule rather than Module: DynamicModule[{A = 1}, Manipulate[Plot[A Sin[k x], {x, 0, 20}], {k, 1, 10}]] One reference: http://forums.wolfram.com/mathgroup/archive/2011/Sep/msg00198.html Also related: Table function with Part[] call misbehaving, but only after initial ...

6

An alternative approach using CurrentValue["MouseOver"]: Button[Panel["Print", FrameMargins -> {{4, 4}, {4, 4}}, Background -> Dynamic@If[CurrentValue["MouseOver"], Green, Red]], Print["Print"], Appearance -> None] or, without the Panel, Button["Print", Print["Print"], Background -> ...

6

Try this: Solve[c == 0.0625 + 0.0008*X - 0.0232*Y - 0.0157*Z + 0.0059*X^2 + 0.0112*Y^2 + 0.0160*Z^2 - 0.0063*X*Y - 0.0243*X*Z + 0.0211*Y*Z // Rationalize, Z] (* {{Z -> 1/320 (157 + 243 X - 211 Y - \[Sqrt](-375351 + 6400000 c + 71182 X + 21289 X^2 + 82226 Y - 62226 X Y - 27159 Y^2))}, {Z -> 1/320 (157 + 243 X - ...

5

Where exactly do you run into problems? Maybe I don't understand your question, but you can 1. just substitute the expression DynamicModule[{c = 11}, Grid[Map[Button[ToString@#, c = #, Background -> Dynamic[If[Mod[#, c] == 0, Green, White]], ImageSize -> {32, 32}, Appearance -> "Frameless"] &, ...

5

If you can use a Manipulate, it would avoid some of the Dynamic complexity: Manipulate[ Show[ ParametricPlot[BezierPoint[t, pts], {t, 0, 1}, PlotRange -> {{0, 400}, {0, 400}}], Graphics[ { Red, Thick, BezierCurve[pts], Gray, Line[{pts[[1]], pts[[2]]}], Line[{pts[[-1]], pts[[-2]]}], Table[ { Gray, ...

5

Done! Table[DynamicModule[{x = 0}, Button[i + 10 j, x = Mod[x + .5, 1], Background -> Dynamic[Hue[x]]]], {j, 0, 9}, {i, 1, 10}] // Grid

5

Interestingly, the Dynamic has to wrap the whole chart, it won't work inside the chart sector as e.g. Button[Style[.7, Dynamic@c], ...]: c = Yellow; Dynamic@PieChart[{ {Labeled[.5, f@"AAA"], Labeled[.5, f@"BBB"]}, {Labeled[.3, f@"CCC"], Button[Style[.7, c], c = c /. {Red -> Blue, Blue -> Green, Green -> Yellow, Yellow -> Red}]} ...

5

According to my rough test, the DynamicUpdating option used at the Notebook level can override the global setting. To demonstrate that, here is a simple test. Start a fresh new Mathematica, and goto Evaluation menu, uncheck the Dynamic Updating Enabled term. Or goto the Option Inspector, select Global Preference, then set Cell Options -> Evaluation ...

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