Tag Info

New answers tagged

1

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


3

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


1

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:", ...


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


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


7

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


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


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


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


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_] := ...


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


0

fun[list_, f_] := Total[f @@@ Tuples[list]] For example: fun[{Range[3], Range[4], Range[5]}, S] yields: (* S[1, 1, 1] + S[1, 1, 2] + S[1, 1, 3] + S[1, 1, 4] + S[1, 1, 5] + S[1, 2, 1] + S[1, 2, 2] + S[1, 2, 3] + S[1, 2, 4] + S[1, 2, 5] + S[1, 3, 1] + S[1, 3, 2] + S[1, 3, 3] + S[1, 3, 4] + S[1, 3, 5] + S[1, 4, 1] + S[1, 4, 2] + S[1, 4, 3] + S[1, 4, ...


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


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

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


0

Your question puzzled me for a long time. Let us have a look at your first question: Manipulate[ With[{f = Table[c[i], {i, n}], controls = Sequence @@ Table[{{c[i], 0}, -1, 1}, {i, n}]}, Manipulate[f, controls, Button["Random", Do[c[i] = RandomReal[{-1, 1}], {i, n}]]]], {n, {3, 4, 5}}] Why does it not work? You have a sliders that assign to c[1], ...


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


0

I understand that you are looking for sort of a conditional updating: only when the displayed portion of the variable test changes. My feeling is that it is unavoidable that the displayed portion of test has to be recomputed at each change of test. But that can be done outside Dynamic. Here is an smaller example, showing the sort of solution I am thinking ...



Top 50 recent answers are included