# Tag Info

38

I feel that once you start with Moire patterns, there's no ending. The way I would replicate these is by making a grid into a function (like @JasonB) but also parametrise the angle of rotation into it: lines[t_, n_] := Line /@ ({RotationMatrix[t].# & /@ {{-1, #}, {1, #}}, RotationMatrix[t].# & /@ {{#, -1}, {#, 1}}} & /@ Range[-...

28

Since you want the animation to have explanatory content, I thought it might be best to incorporate the explanatory 2D diagram into the 3D scene. So I imagine the 2D plot as a "sticker" that can be put onto the cylinder, like a label on a bottle. That way, you can see the explanatory diagram itself wrap around the cylinder and become identical to the ...

26

What the first part of the variable declaration does Manipulate initializes complexparts to {Re[#], Im[#]} & when it executes. (In general, a declaration of the form {{var, expr},...} in a Manipulate results in the local variable var being initialized to expr.) To use complexparts outside of the Manipulate, do this: complexparts = {Re[#], Im[#]} &...

24

Something like this: nlines = 30; Table[ Overlay[ Rotate[ Graphics[{ Table[{ Line[{{0, n}, {nlines, n}}], Line[{{n, 0}, {n, nlines}}]}, {n, 0, nlines}], Text[Style[#1, 18], {0, 0}, {-1, -1}, Background -> White] }, AspectRatio -> 1, PlotRangePadding -> None, ImageSize -> ...

24

This question is too interesting to resist, so I'll talk about how to analyze the problem. Take a look at sketch above. It describes an arbitrary moment during the rolling. From the kinematics view, $P$ is the "instant center of rotation". From the energy view, the square's center of mass $O$ keeps its height, thus the potential of the square doesn't change,...

23

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^#) &], ...

20

The general issue, as mentioned by xzczd, is that Manipulate only "notices" explicit visible parameters. This is because when you evaluate something like Manipulate[x, {x, 0, 1}] and start waggling the slider, you are not changing the value of the global symbol x, but instead a temporary symbol called something like x15. You can see this like so: ...

20

The separation-of-variables solution you quoted has two indices appearing in it: n and j (the subscripts of the coefficient $A_{nj}$). Here, n is azimuthal mode order, i.e. it counts the number of nodes along the direction in which the polar-angle $\theta$ varies (divided by 2). The index j is needed because the wave is supposed to satisfy the boundary ...

20

Quick&Dirty: pt = {0, 0}; full = MandelbrotSetPlot[]; r = 0.2; Column[{ Row[{"Zoom: ", Slider[Dynamic[r], {0.01, 1}]}], Row[ { LocatorPane[Dynamic[pt], Dynamic[Show[full, Graphics[{EdgeForm[Red], Transparent, Rectangle[pt + r, pt - r]}], ImageSize -> Scaled[.45]]]], Dynamic[ MandelbrotSetPlot[{pt + r, ...

19

To prevent shaking, try to add ImagePadding and for the other issue, you can fix the vertical plot range. mpl = Table[ Plot3D[myfun[x, y, t], {x, 0, L}, {y, 0, L}, PlotRange -> {Automatic, Automatic, {0, 6}}, PlotPoints -> 40, ImageSize -> 400, PlotLabel -> Style["t = " <> ToString[t], Bold, 18], ImagePadding -> ...

18

You can use FoldList to generate evolution of your system. You need a function that propagates your particles in time. Every time you apply your function to state at time $t$ you obtain your state at time $t+dt$. Let's make such function for one particle in 1D. Tr1D[{x_, v_}, dt_, L_] := Module[{u, w}, u = x + v dt; {u, w} = If[u < L, {u, v}, {L - (...

18

Block[ { graph = RandomGraph[{20, 100}] , start , path }, start = RandomChoice[VertexList[graph]]; path = NestList[RandomChoice[AdjacencyList[graph, #]] &, start, 5]; ListAnimate[ Table[ Graph[graph , VertexStyle -> {v -> Red} , VertexSize -> Large ] , {v, path} ]]] Block[ { graph = GridGraph[{6, 6}] , ...

17

Your average Manipulate has the "Inital settings" button (which is just another bookmark): Another straightforward way would be a simple button to set certain values: Manipulate[x, {{x, 5}, 0, 10}, Button["Reset", x = 5]] which (as pointed out in the comments) allows for unlimited styling, for good or bad: Manipulate[x, {{x, 5}, 0, 10}, Button[...

17

Since you already have an answer for the resizable part I will use a fixed chess board. In fact I replicated the graphics in the Wikipedia article for the eight queens problem a while back, and solved it, so I'll just share my solution. I guess the task left is to 1) Replace my solution with yours and 2) adapt the graphics to the n-queens problems. dark = ...

16

As I understand it, you'd like to dynamically illustrate how the chaos game works by showing how the points arise randomly. Here are two approaches, with enough code in common that we can practically do them both at once. Using Dynamic First, I think it's quite natural to do this with Dynamic. To do so, we set up an image called dynamicPic that we'll ...

16

There are various viewers available that could used to switch between different arrangements of controls. For a seamless look, one might use PaneSelector. If type is to have its own control, putting it inside each of the panes ensures Manipulate will align them. Manipulate[ {x, yyy}, {{x, a}, {a, b, c, d}, None}, {{yyy, 0.5}, 0, 1, None}, {{type, 1}, ...

16

Manipulate[u, {u, 0, 1}, FrameLabel -> "FrameLabel"] or Manipulate[u, {u, 0, 1}, FrameLabel -> {{"FrameLabel 1", "FrameLabel 2"}, {"FrameLabel 3", "FrameLabel 4"}}] or Labeled[Manipulate[u, {u, 0, 1}], "Label"] or Manipulate[u, Style["Label", 12, Bold], {u, 0, 1}] or Panel[Manipulate[ Panel[u, "Label 1", FrameMargins -> ...

15

It seems to me that this works: Manipulate[1/(x - 0.25), {x, 0, 1, Exclusions -> {0.25}}] (Exclusions is from Slider, I just tried it here and seems to do the job) or slightly more clear: Manipulate[1/(x - 0.25), {x, 0, 1, 0.25, Exclusions -> {0.25}}]

15

Just another way, using built-in functionality ResetButton: Manipulate[x, {{x, 5}, 0, 10}, AppearanceElements -> "ResetButton"]

15

I was hesitating but it seems some people find this information useful. SetOptions[Manipulator, Appearance -> "Labeled"]; Manipulate[{a, b, c}, {a, 1, 10}, {b, 1, 10}, {c, 1, 10}] But, still, I do not consider it the full answer. Like it is stated, it affects only Manipulator, the default control used by Manipulate for domains that are suited ...

15

Here's a starting point for you: With[{n = 6}, Graphics[MapIndexed[{ColorData[103] @@ #2, #1} &, NestList[MapAt[Composition[ TranslationTransform[AngleVector[2 π/5]/ GoldenRatio], ...

14

Update 2: Using DynamicSetting to turn Manipulate into an input expression to print snapshots: manipulate = Manipulate[Module[{a = {{2, 3}, {3, 2}}, vp}, vp = VectorPlot[a.{x, y}, {x, -4, 4}, {y, -4, 4}, VectorScale -> {0.045, 0.9, None}, VectorPoints -> 16]; z = NDSolveValue[Thread[{x'[t], y'[t], x[0], y[0]} == Join[a.{x@t, ...

14

You can do this outside of the manipulate box and show the variable's value as a legend. Also by using fixed image sizes and aspect ratios you can minimize the occurrence of black bars as the variables change. First Step: Make a table of your desired Plots, I think the code here is relatively easy to understand: Anim = Table[ Plot[Sin[x], {x, 0, t}, ...

14

After playing with the variables in a Manipulate I came up with these numbers for the arguments of the AffineMap functions. They aren't perfect. I recommend tuning them yourself: (* Activate Roman Maeder's Code first!* ) (fract2[x_, n_] := Show[Graphics[Nest[IFS[{ AffineMap[0 °, 0 °, 0, 0, 0.18, 0], AffineMap[-2.5 °, -2.5 °, 0.90, 0....

14

Related: 14556 and 7547 Using Locator to give you the control you are seeking : Manipulate[ Plot[Sin[a*x] - .3, {x, -3, 3}, Epilog -> {Dynamic[If[t, Locator[Dynamic[pt], Framed[Pane[ "I want the user to have the abilty to move this box \ anywhere inside this white area so the user can see what's behind \ it.", 70], ...

13

The problem is that exporting Manipulate/Animate/DynamicModule only saves definitions of scoped symbols (green). Specifically, it doesn't know your definition of spherePoint and, in CDF Player, you don't have the option to execute that command. You can get around this using the SaveDefinitions -> True or by putting those "external" definitions in the ...

13

One way to do this is to add TrackedSymbols option to Manipulate - so it will update only when "tracked" variables are changed. Manipulate[ <above code>, {x,1,12,Slider}, TrackedSymbols :> {x} ] This is the way when you'd like to specify specific controls. Another way to do the same thing for all variables that are listed in controls is ...

13

A simple straightforward way of doing this is to use With to inject the literal expression into the Manipulate. func = Sin[a x + b]; With[{fun = func}, Manipulate[Plot[fun, {x, 0, 6}], {a, 1, 4}, {b, 0, 10}] ] You'd need to use Dynamic@With... if you want the manipulate to update when func changes.

13

This seems to be a very easy way to bite yourself in the foot (non-flexible programmers this is not for you). I also have the habit of doing those blocked set-based definitions. It's probably time to change the habit now. It seems to me that SaveDefinition extracts the definitions of the symbols required by the Manipulate, as you entered them. If you used :=...

13

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

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