Questions tagged [dynamic]
Questions relating to the dynamic family of functions in Mathematica, such as Dynamic, DynamicModule and Manipulate.
403
questions
32
votes
6
answers
4k
views
How are parameters evaluated for a Plot in Manipulate
I am trying to get my head around how Manipulate evaluates functions in a Plot. I have read the introduction to Manipulate, and introduction to Dynamic, but I still ...
10
votes
2
answers
1k
views
Programming with Dynamic
I don't understand the following:
f[a_, b_] := a + b
ls = {1, 2, 3};
MapThread[f, {ls, {10, 20, 30}}]
This yields ( as expected ) {11,22,33}
If I change ...
145
votes
3
answers
22k
views
How to manipulate 2D plots?
When it comes to visual analysis, large datasets or data with intricate internal details often makes plotting in 2D useless, as the outcome is either just a fraction of the full dataset, or no details ...
23
votes
3
answers
1k
views
Button action monitored with progress bar
Let's say you have a palette with a button that has to do some time-consuming task when clicked:
...
7
votes
5
answers
4k
views
sliding a tangent line along a curve
I am confused by Dynamic. I am trying to slide a tangent line along a curve, without using DynamicModule, so that I can include ...
40
votes
4
answers
1k
views
What is the difference between Dynamic[x] and Dynamic[ h[x] ] for DynamicModule variables?
Bug introduced in 9.0 or earlier and persisting through 12.0
In 11.3 it is even worse. An example from the accepted answer with a Slider is now broken too:
...
55
votes
3
answers
14k
views
How to create a progress bar?
I would like to create a progress bar tool that allows me to see how my computations are going.
I found answers to this question on many sites, I even found a package for it ( http://www.physics.ohio-...
13
votes
3
answers
922
views
Why do buttons with ChoiceDialog freeze the front end?
Pressing the button below will freeze my front end. An unpainted white dialog box comes up, then it completely freezes, and I need to forcibly kill the front end. CPU usage stays at zero during this....
25
votes
4
answers
886
views
What is the point of Refresh if Dynamic has an UpdateInterval option?
I haven't found an example where I can't get rid of Refresh[]:
...
38
votes
5
answers
4k
views
Generating graphs interactively (GUI)
I want to create graphs interactively using a GUI. I thought of using a ClickPane[] environment. The code I have (in part borrowed from the Documentation) works ...
57
votes
2
answers
2k
views
How safe is the use of Block and Internal`InheritedBlock
For many questions on this site answers are given which suggest to use Block and, especially for more advanced topics, ...
42
votes
3
answers
2k
views
How can I set up a versioning system within a notebook?
Since the Frontend crashes a lot, for important work it would be nice to have the notebook automatically branch and save itself every so many minutes.
For instance, commands like StartSavingCopies[5]...
18
votes
1
answer
667
views
Is it possible to use Begin and End inside a Manipulate?
May be someone can explain why I can't use Begin["context`"] and End[] inside a Manipulate ...
16
votes
2
answers
842
views
Avoiding slow evaluations in Manipulate when combining graphics with Show
I want to figure out how to combine several graphics in manipulate such that only the ones that change are recomputed.
I looked into the tutorials on Advanced Manipulate, but couldn't figure out how ...
6
votes
1
answer
295
views
Working with Dynamic: Synchronization with EventActions ( and other preemptive evaluations)
I would like to make a simple "game": Display a dialog with a random letter, if the same letter is pressed on the keyboard, the display changes into a string ...
4
votes
3
answers
727
views
How can I compare a dynamic variable with a literal in Mathematica?
I'm doing a Mathematica Notebook and I want to make an alarm clock. Something like this:
...
3
votes
1
answer
777
views
Initializing Manipulator value within DialogInput (version 10.1 only)
Bug introduced in 10.1.0 and fixed in 10.2.0
I've confirmed, with WRI, that an issue was introduced in version 10.1 with regard to initializing Manipulator Dynamic ...
36
votes
4
answers
2k
views
What are the most common (usual) ways to make palettes with non-trivial functionality?
What are the best (most robust and most convenient) ways to create palettes that can be installed permanently (using Palettes -> Install Palette...) and are safe ...
19
votes
1
answer
893
views
How can I include functions from a package into a CDF file?
I am building an application which I would like to deploy as a CDF file, and I am struggling to make the CDF exports work correctly with functions pulled from a .m package file. What are good/best ...
18
votes
3
answers
2k
views
How can locators be added to the points on a 3D grid?
Here is a pared down example of some 3D data that I want to make dynamic and add locators to each set of points. Is that possible?
...
18
votes
2
answers
1k
views
Syntax highlighter shows error for Manipulate when it's inside a Block or a Module
I'm putting my new copy of Mathematica 10 through its paces and I noticed a weird change in the colouring scheme that I find very annoying, and I'd like to get some insight into why it's happening.
...
13
votes
2
answers
393
views
Working with DynamicModule: Tracking the progress of Initialization
How to track Initialization step by step? Any tricky solution is ok. One condition, x should be ...
42
votes
9
answers
18k
views
How to create animated snowfall?
Well, the title is self-explanatory. What sorts of snowfall can we generate using Mathematica? There are two options I suggest to consider:
1) Continuous GIF animations with smallest possible number ...
23
votes
6
answers
2k
views
How can I make an InputField with a proper newline/carriage return?
The return key does not work as expected in an InputField, how can I overcome this?
18
votes
3
answers
448
views
How to track part of symbol or how to symbolize parts of symbol without copying data?
Let's create simple function:
SetAttributes[h, HoldFirst];
h[data_] := Dynamic[Grid[data], TrackedSymbols :> {data}]
test = RandomReal[1, {2, 2}];
h[test]
...
18
votes
2
answers
3k
views
How to extract the numerical value of a dynamical variable
I want to inspect interactively an image by selecting points by the mouse pointer. This is easily done by LocatorPane - here is a simplified example:
...
15
votes
4
answers
1k
views
Button evaluation inside DynamicModule
Someone know why this Button works when clicked:
...
12
votes
7
answers
2k
views
How to dynamically toggle curves on/off in a crowded Plot?
When multiple curves appear in a single plot, it is useful to interactively turn certain curves on or off to visually compare smaller numbers of curves. It is trivial to put a quick dynamic together, ...
12
votes
2
answers
940
views
How to draw the image of a circle under the action of a transformation of the phase flow?
How to draw the image of a circle $x^2+(y-1)^2<1/4$ under the action of a transformation of the phase flow for the equation $\dot{x}=y,\ \dot{y}=-\sin x$? Here $\dot{x}$ means $dx/dt$. Any help or ...
10
votes
4
answers
510
views
Working with DynamicModule: ScheduledTasks with local variables
I have a question - is it possible to run ScheduleTask[] inside DynamicModule[]?
What I have tried so far:
...
4
votes
1
answer
554
views
Evaluation inside Button stops after some seconds
I would like to trigger a long calculation inside a dynamic module with a Button. It seems that the evaluation stops without an error-message after some seconds.
I made a test outside the a dynamic ...
25
votes
4
answers
1k
views
How to Initiate a queued evaluation from a Dynamic GUI without using a Button
I have a Dynamic-based GUI, and one part of it will kick off a calculation that could take longer than the default 5-second dynamic timeout.
I know that ...
22
votes
3
answers
1k
views
Using Refresh[..] with TrackedSymbols
This is a very basic question, but I don't understand the following behavior. The usage to Refresh reads
represents an object whose value in a Dynamic should be ...
18
votes
2
answers
752
views
Allow multiple GUI elements to react dynamically to interaction with a single element
I was looking at how to reproduce the interactivity in this visualization (the layout can be done like this). Hovering a node with the mouse highlights all edges that are connected to it. How can we ...
18
votes
1
answer
684
views
How to create interrelated sliders?
Say I want a slider that controls the value of $x$ and another slider that controls the value of $2x$, how would I go about it?
16
votes
4
answers
621
views
In InputField, how to prevent Shift-Return from generating a new cell?
When running the following in a notebook (not a deployed CDF file), it can sometimes be annoying that accidentally pressing Shift-Return breaks out of the user ...
13
votes
3
answers
904
views
How to anchor a Pane's scroll position to the bottom?
Suppose I have a Pane containing some dynamic text, for example that is being updated by a logging function.
...
12
votes
3
answers
562
views
Problem with UpdateInterval
I want to monitor current results with Dynamic
...
8
votes
2
answers
736
views
How to dynamically update Locator[] constraints?
I need to visualize Menelaus' theorem for a triangle with moving locators for each of six points. So the vertexes of the triangle can move in any possible way, and the three points on the sides of the ...
5
votes
1
answer
413
views
Basic question about Dynamic
Please consider the following:
...
39
votes
2
answers
2k
views
How do I find all the possible events that work with EventHandler?
The EventHandler documentation, More Information section, lists 5 mouse events:
...
23
votes
1
answer
1k
views
What is the proper method to load a Mathematica package inside a DynamicModule
I have a DynamicModule that requires loading of Mathematica packages. The usual methods do not seem to apply (...
16
votes
1
answer
894
views
How to make a dynamic nested menu?
There is no dynamic controller that can represent a hierarchical menu structure: ActionMenu can only handle flat action lists. Thanks to Kuba, we know a lot about <...
16
votes
3
answers
499
views
How to create a notebook element that can replace itself?
I would like to create a notebook element that can replace itself.
Here's an example to illustrate:
...
15
votes
2
answers
1k
views
How can I create an interactive ColorFunction using Manipulate?
I am trying to specify my own colors and scaling for the ColorFunction in ListDensityPlot. I have several lists of 2D values ...
12
votes
2
answers
2k
views
How To interactively create a Polygon in a Graphic?
Background: suppose I start with the following (working) snippet.
Manipulate[Graphics[Line[{{0, 0}, p}], PlotRange -> 2], {{p, {1, 1}}, Locator}]
Ideally, I ...
12
votes
4
answers
3k
views
Dynamic Epicycles
Thanks to all the thorough answers and comments, I've written the following code for an arbitrary number of epicycles. However, when I apply the formula $\gamma(t)=e^{it}+\frac{1}{2}e^{7it}+\frac{i}{3}...
12
votes
1
answer
349
views
Notebook's WindowSize interference with contents' Dynamic ImageSizes
Bug introduced in 8 or earlier and persists through 11.3
Consider the following MWE:
...
10
votes
1
answer
194
views
9
votes
2
answers
1k
views
Click in a vector plot to plot several solutions of a system of differential equations
I am aware of the Locator button and I am aware of the Equation Trekker package, but they are not what I want to use. Here is what I specifically want to know how to do, if possible. Consider the ...