Tag Info

Hot answers tagged

10

My defined function next find {nextpoint, nextdirection} value from {startpoint, startdirection} using NSolve. next[{sp_, sd_}][δ_] := Module[{φ, sol, fp, fd}, sol = NSolve[{{x[φ, δ], y[φ, δ]} == sp + t sd, Abs[t] > 10^(-9), 0 <= φ < 2 π}, {t, φ}, Reals]// Quiet; sol = If[Length[sol] > 0, sol[[1]]]; fp = {x[φ, δ], y[φ, δ]} /. sol; ...


7

Here's a walkaround: Manipulate[ x, Row @ List @ EventHandler[ Checkbox[Dynamic[x]], {"MouseDown" :> (x = True), "MouseUp" :> (x = False)}] ]


4

It's much simpler f[g1_Graph] := DynamicModule[{pts = PropertyValue[{g1, #}, VertexCoordinates] & /@ VertexList@g1, g2 = g1}, {Dynamic@Column@pts, LocatorPane[Dynamic[pts], Dynamic[g2 = SetProperty[g2, VertexCoordinates -> pts]]]}] g = CompleteGraph[5, VertexLabels -> "Name", PlotRange -> {{-5, 5}, {-5, 5}}]; f@g


4

You can try something like: RemoveScheduledTask @ ScheduledTasks[]; RunScheduledTask[c = Round[ControllerState["Y Axis"], .1], .1] Dynamic[{RandomReal[], c}] (*RandomReal tells us when c triggers updating*) Plot[{Sin[x]}, {x, 0, 2}, GridLines -> Dynamic[{{1}, {c}}]] So the Dynamic is not triggered by controller itself but by the value of it. It will ...


3

I'm no Manipulate master, but from previous nasty experiences, I have a few tips: Read the related tutorials, not only the direct documentation. They explain a great deal of the internal "mechanics", and have some examples that make for some great A-ha moments. - https://reference.wolfram.com/language/tutorial/IntroductionToDynamic.html - ...


3

Let me add a simple explanation of one of your concerns. Without those context references. Also, I don't think that FE's and Kernel's ownership of variables matters here. According to the first section of AdvancedManipulateFunctionality: The subject of when exactly a given dynamic expression will be updated is complex, and is addressed in "Introduction ...


2

You can use a list of points instead of individual controls and Manipulate will construct a LocatorPane to handle them. Not fussing much with the rest of the code, except to eliminate the global variables gr5 and coords: Manipulate[ With[{gr5 = Graph[el0, EdgeStyle -> LightGray, VertexCoordinates -> v, VertexLabels -> "Name", ImageSize ...


2

My intuition is that the problem is with the front end and not the kernel. The front end will need to render the combined 3D graphics, even if only one changes (unless GPUs have gotten so sophisticated they can manage and compose multiple 3D images -- but on my computer the CPU is heavily engaged). Speedier rendering The trick to building a speedier ...


2

In the mean time fortunately I started understanding the background of the problem in question 63982. I added another answer there, essentially stating that as soon as the second argument of the button does not contain the symbol c, the construction will work. The solution of @belisarius satisfies this condition. So in the sequel I will not discuss any more ...


2

Too many Dynamics and in the wrong place: DynamicModule[{tv, r, pt = {1., 0.}, sup}, LocatorPane[Dynamic[pt], Dynamic[ tv = TranslationTransform[pt][Vertices[Hexagon]]; r = RegionIntersection[{MeshRegion[Vertices[Hexagon], Polygon[{1, 2, 3, 4, 5, 6}]], MeshRegion[tv, Polygon[{1, 2, 3, 4, 5, 6}]]}]; sup = Chop[N@RegionMeasure[r, ...


2

It might be that this is due to dispatch, list and doStuff being completely owned by the frontend, since you wrapped them in a DynamicModule. Frontend variables cannot be shared between kernels. When you localize them in a Module, and therefore keep them as kernel variables, it works: Module[{dispatch, list, doStuff}, list = Range[8]; doStuff[a_] := ...


2

For a start I think you may need to use SetDelayed (:=) instead of Set (=). Then be careful with the spaces, a b c (the product of three different variables) is not the same as abc (a single variable). Then porbably you want something like this: ClearAll[a, b, c, d, e, f, g, h, i, j, k] Panel[Grid[{{Style["Inputs", Bold], SpanFromLeft}, {"a:", ...


2

How about this? {Slider[Dynamic[a], {0, 10, 1}], Dynamic[a]} Dynamic[u = {a, a + 1}] Dynamic[u[[1]] + u[[2]]]


1

Manipulate[ ClickPane[Plot[g, {t, 0, 10}, PlotRange -> x, Frame -> True], (AppendTo[g, Exp[-(t - #[[1]])]*#[[2]]]) &], {x, 1, 10}, Initialization :> {g = {}}]


1

I don't know how to fix it, but the issue seems to be with wrapping Dynamic around any kind of CurrentValue information: u = 0; Dynamic[Refresh[u++, TrackedSymbols :> {}, UpdateInterval -> 1]] (* Correctly updates: 1....2....3.. *) Dynamic[Refresh[ControllerState[4, "X1"], TrackedSymbols :> {}, UpdateInterval -> 1]] Dynamic[ControllerState[4, ...


1

You were almost there ... If ind = First/@iterator; (*{k[1], k[2], k[3]} *) then if S is a function S[...] Sum[S[Sequence @@ ind], Evaluate[Sequence @@ iterator]] or the equivalent but more elegant and compact form Sum[S @@ ind, ##] & @@ iterator Sum[S @@ First /@ {##}, ##] & @@ iterator give If S is an array, S[[...]] just replace ...


1

Manipulate[Plot[Sin[a x], {x, -2 Pi, 2 Pi}, PlotLabel -> Row[{"a=", a}]], {a, 0, 5}] For exporting, there are many posts on exporting Manipulate to animations/movies. Please see this for example Export animation of a Manipulate autorun sequence? If the above still does not answer you, then you can follow up. ps. You can always just export like this ...



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