Tag Info

Hot answers tagged

10

So you guys know - quasicrystals are cool structures that can consist of finite number of parts which can be arranged in never repeating - aperiodic - pattern. Thing here is called projection method from a regular lattice. http://www.nature.com/nmat/journal/v3/n11/fig_tab/nmat1244_F3.html Interestingly if you know Fibonacci rabbits problem - that is also ...


5

It turns out, after lots of poking around, that the fact that the cell is inline is not really the relevant thing. What is relevant is that each stylesheet has a property, LimitsPositioningTokens, that specifies which symbols should use the off-to-the-side limits positioning by default. For the Text style, that list includes all the usual things, including ...


5

You might use Row. For example: Manipulate[{u, v}, Row[{Control[{u, 0, 6}], Control[{v, 10, 20}]}, Spacer[10]]]


4

Here you are with the bands -- note also an (I think) improvement over the brute force fine discretization of the line: (I'm Not sure if that improved performance, but it didn't hurt and it looks cleaner) caveat I think my little trick thinning down the lndat list is not guaranteed to find all of the strictly nearest points. It seems to work for the ...


4

It is because ResetButton refers to Manipulate`s initial state while pt is outer DynamicModule variable here. You can scope variables in Manipulate with a cool trick, which I've learned here: {{pt, {0.5, 0.5}}, None} Manipulate[ ArcTan @@ pt, {{pt, {0.5, 0.5}}, None}, DynamicModule[{}, LocatorPane[ Dynamic[pt], ...


4

Like noted in the comments the problem is that Manipulate[ListLinePlot[{OutputResponse[discLowPass[T, τ], dataNoise]}], {{T, .1}, .005, 25}, {{τ, .005}, .001, .025}] doesn't work while the following works: Manipulate[ListLinePlot[OutputResponse[discLowPass[T, τ], dataNoise]], {{T, .1}, .005, 25}, {{τ, .005}, .001, .025}] ...


3

This is different but you may find it useful. The second line will be evaluated in place code with panel, just Ctrl+9 to create an inline cell and type: select this and evaluate in place with Ctrl+Shift+Enter


3

This measures frame rate using simple Manipulate that does very little computation other than calculating FPS and then display an image. It finds fps as number of refreshes made so far divided by number of seconds elapsed. I did not use a moving average here, just kept a record of the number of times Manipulate is called and the time since start. This ...


3

Control doesn't have that broad an option space, so it's difficult to control the appearance of VerticalSlider within Manipulate. I would recommend switching to using DynamicModule, as in this minimal example. If you need more examples add a comment and I'll edit. Updated with embedded Manipulate per request. DynamicModule[{h1, h2, h3, h4, h5, h6, h7, h8, ...


3

You may try: Manipulate[If[a == a, ToExpression[ToString@u <> s <> ToString@v]], Row[{Control[{u, 0., 1., VerticalSlider}], Control[{v, 0., 1., VerticalSlider}], Column[{Control[{s, {"+", "-", "*", "/"}, Setter}], Button["Calc", a = ! a]}]}], Initialization -> (a ...


3

As kguler points out, this question appears to have be treated previously here. However, jVincent's answer only treats the case of adding additional locators. Here is an example that where locators can be both added and deleted. SetAttributes[canDelete, HoldFirst] canDelete[locatorGroup_Symbol] := Switch[locatorGroup, {}, False, {_}, ...


3

Use functions like Row, Column and Grid rather than Print. For example: Manipulate[ Row[{ TableForm[ Table[{z, z^2, z^3}, {z, 1, zmax}], TableHeadings -> {None, {"Number", "Square", "Cube"}}], PieChart[Table[i^3, {i, 1, zmax}], ChartLabels -> Range[zmax], ImageSize -> 200] }], {zmax, Range[16]}]


2

It's always a good idea to read the error messages. Your first one says Piecewise::pairs : The first argument {0.002, Ta < 18} of Piecewise is not a list of pairs. This is fairly self-explanatory. Checking the documentation for Piecewise we find that the first argument should indeed be a list of pairs, so use this: Piecewise[{{0.002, Ta < 18}}, ...


2

Better to use Lists, for your A and B e.g. something like: a = {1, 1}; b = {4, 2}; Then use Part, [[i]], to extract the elements. Manipulate[ Plot[fun[f, x[[1]], x[[2]]], {f, 0, 10}], {{x, a}, {a -> "A", b -> "B"}}] Sequence should not be used to group items. Most functions automatically splice in Sequence objects, e.g. Head[A] gives an error ...


2

I would approach the overall goal of the program in a different way that avoids the limitations* of Manipulate. I would store a list of all the locators in one variable, with the permanent locator(s) at the beginning of the list. The transient locators can be added and removed with ALT+click. The permanent locators are maintained by the option of the form ...


2

I think your requirement is not correct for the user. What should display on the screen should match the current x+y value based on what is currently selected for x and y and not what was there before. If you keep the old value displayed, then the new selection do not match what is on the screen and that can be confusing. But I made two versions, and you ...


2

Alternate answer, this is an exact analytic approach to the nearest point problem: (not i think precisely what @martin was after, but its an interesting problem and others may find it useful) lb = -1;ub = 1; pts0 = Select[Flatten[ Table[ {i, j}, {i, 2 lb, 2 ub , .2}, {j, 2 lb , 2 ub , .2}], 1] ,Norm[#] < 1 &]; intv[ p_, pn_] := If[(pn[[1]] != ...


2

ContinuousAction will prevent evaluation. Here is an example: Manipulate[ Row[{u, ( f /. lst), v, "=", f[u, v]}, BaseStyle -> {20, FontFamily -> "Kartika"}], {{f, Plus}, lst}, Row[{Control[{u, 0, 1}], Control[{v, 0, 1}]}], ControlType -> {SetterBar, VerticalSlider, VerticalSlider}, ControlPlacement -> Up, LabelStyle -> {Blue, 25}, ...


2

Try this: Manipulate[ h = {h1, h2, h3}; Column[{Row[{TableForm[Table[h^z, {z, 1, zmax}], TableHeadings -> {None, {"Number", "Square", "Cube"}}]}], Row[{PieChart[Table[i^2, {i, 1, zmax}], ChartLabels -> Range[zmax], ImageSize -> 200], PieChart[Table[i^3, {i, 1, zmax}], ChartLabels -> Range[zmax], ImageSize ...


2

The problem is with the Mesh->True Removing it works: h = 1000; p = 0.59; Block[{a, $RecursionLimit = 25000, w = h}, per[{i_, j_}] := If[1 <= i <= w && 1 <= j <= h && a[[i, j]] == 1, a[[i, j]] = 2; per[{i, j} + #] & /@ {{1, 0}, {0, 1}, {-1, 0}, {0, -1}} ]; SeedRandom[2424]; a = Map[Boole[# < p] &, ...


1

I present this for illustrative purposes. Here is a toy data set: samp = RandomReal[{23, 32}, 365 8 ]; This is just 365 days of 8 samples per day. You can get daily mean using: Mean /@ Partition[samp, 8]; You can visualize by just wrapping in ListPlot and with option Joined->True: You can also use TemporalData: td = TemporalData[samp]; td2 = ...


1

Try this: Manipulate[ lst = Table[{z, z^2, z^3}, {z, 1, zmax, 1}]; Column[{ Grid[Prepend[lst, {"Number...", "Square...", "Cube...."}]], PieChart[Table[i^3, {i, 1, zmax}], ChartLabels -> Range[zmax]] }], {zmax, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}}]


1

Just to get it working: you need to read and fully grok the documentation for Manipulate... it explains in detail why constructs like this are used, and the changes in "expected" behaviors within Manipulate. f[dL1_List, dL2_List] := Module[{dL1SymList, dL2SymList}, dL1SymList = (Symbol["dL1" <> ToString[#]] &) /@ dL1; dL2SymList = ...


1

Is something like this what you seek? fun[f_, a_, b_] := Sin[a f] + Cos[b f]; Manipulate[ Plot[fun[f, params[[1]], params[[2]]], {f, 0, 10}], {{params, {1, 1}}, {{1, 1} -> "A", {4, 2} -> "B"}}] There are probably more elegant ways to do this, but it sounds like you want a finite set of parameter pairs. You could have a single variable represent ...


1

Initialization for CheckboxBar works pretty much as for any type of control. {{checkBoxes, initial-checked-values, ""}, value-list, ControlType -> CheckboxBar}] For example, Manipulate[Row[{"Boxes checked: ", Length@checkBoxes}], {{checkBoxes, {1, 3}, ""}, {1, 2, 3, 4}, ControlType -> CheckboxBar}] will produce the following initial state when ...


1

Maybe I've misunderstood the requirement, but why not simply apply a constraint to both controls? Manipulate[10/(time2 - time1), {{time1, 0}, Select[Range[0, 6], # < time2 &], ControlType -> PopupMenu}, {{time2, 1}, Select[Range[0, 6], # > time1 &], ControlType -> PopupMenu}]



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