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

33

The problem is that inside the Manipulate, m1 and m2 are replaced with localized versions (as in Module) rather than assigned (as in Block). Since the m1 and m2 from bigA are outside the Manipulate, and bigA[t] is evaluated only after the replacement of m1 and m2 inside the Manipulate, they are not affected by the manipulation. The best solution is to give ...

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

25

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

23

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

22

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

19

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

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

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

17

As David Slater comments you can specify this with the Appearance option: Manipulate[x, {{x, 0}, 0, 1, Appearance -> {"Open"}}] From the documentation on Manipulate:

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

17

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

16

I am not sure why you can't just use Grid? Manipulate[Plot[Sin[x], {x, -lim, lim}], Grid[{ {Control[{{lim, Pi, "limit"}, Pi/10, 2 Pi, Pi/10, ImageSize -> Tiny}], Button["A", ImageSize -> 100]}, {Button["B", ImageSize -> 100], Button["C", ImageSize -> 100]}, {Button["D", ImageSize -> 100], Button["E", ImageSize -> 100]} }...

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

In your notebook, do the following: Separate the examples into cell groups. You can use, e.g., Section or Subsection cells to do this. Choose the menu item Evaluation->Notebook's Default Context->Unique to Each Cell Group. Re-evaluate your notebook. You'll now get the code isolation you're looking for. By using the menu item I point out, you're ...

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

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

A couple of tips: Make sure you evaluate the function - best way is to put it in Initialization :> ... Rather keep parameters m1, m2 as arguments Fix PlotRange to see function change, not the axes scale Use SaveDefinitions -> True so interface will remember your defined function when you reopen notebook I updated the code below to encompass your ...

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

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