New answers tagged

0

Although syntactically correct, your Manipulate expression is somewhat strange. Normally, one does not initialize a control in the first argument of a Manipulate expression, but I know of nothing in the literature of dynamic constructs that forbids it. On the other hand, because the order in which control variables are initialized is not clearly documented ...


0

This doesn't answer the question of "why does this bug out" but this answer is a DynamicModule that is equivalent to your Manipulate that you could add your Initialization function to. DynamicModule[ {a = 2, b = 1}, Panel[ Column[{ Manipulator[Dynamic[b], {1, a, 1}, Appearance -> "Open"], Framed[Dynamic[a], Background -> White, ...


2

I cannot reproduce the OP's problem, and despite that the variations on David G. Stork's and Chris Degnan fixes are limited and trivial, I will make some comments on potential issues in the code. These issues may in fact be a problem in the OP's notebook (but not in the code per se), which I will explain. The body of a Manipulate is wrapped in Dynamic[] ...


1

Try this: Manipulate[ If[set == True, (upper = hig; lower = low), upper = lower = 0)]; tepsr = {1, 2, 3, 4, 5, 6, 7, 8, 9}[[1 + low ;; 9 - hig]]; tepsi = {9, 8, 7, 6, 5, 4, 3, 2, 1}[[1 + low ;; 9 - hig]]; ListLogLinearPlot[{tepsr, tepsi}], {{low, 0}, 0, 3, 1}, {{hig, 0}, 0, 3, 1}, {{set, False}, {False, True}}] Your problem may be due, ...


1

Not really clear what you're trying to do. Maybe this will help though. Manipulate[ tepsr = {1, 2, 3, 4, 5, 6, 7, 8, 9}[[1 + low ;; 9 - hig]]; tepsi = {9, 8, 7, 6, 5, 4, 3, 2, 1}[[1 + low ;; 9 - hig]]; Row[{ListLogLinearPlot[{tepsr, tepsi, epsi}, ImageSize -> 400] , Button["Set", upper = hig; lower = low; epsi = Interpolation[tepsi]]}],...


1

I think a little discussion on how to solve the OP's problem is in order, because in this case a little preliminary work can make things much simpler. f[x] == f[x - 1] + 2 r*b (f[x - 1]) - a (f[x - 1]) f[0] == 100000 is a very simple recursion relation which obviously has the solution 100000 (1 - a + 2 b r)^x Since we have a close form solution, why ...


3

Steph, the problem is that Manipulate does not "see" the explicit dependence of f on the parameters you are trying to manipulate. In other words, those parameters must appear explicitly in the expression to be manipulated. You can change the definition of your function to accomplish that: ClearAll[f] f[x_, a_, r_, b_] := f[x - 1, a, r, b] + 2 r*b (f[x - 1, ...


0

The problem you are feeding Solve has a unique solution and it would be most efficient to solve it once and then feed the result into Manipulate. Solve[ { (p1 a1 + p2/5) (1 + r) + w == p1, (p1/10 + 2 p2/5) (1 + r) + 30 w == p2}, {p1, p2} ] To simplify the code a bit it is proposed that functions representing p1 and p2 should be defined. f1[w_, ...


4

You haven't defined w, so I give it an arbitrary value: w = 1; Manipulate[ sol = {p1, p2} /. Solve[{(p1 a1 + p2 .2) (1 + r) + w 1 == p1, (p1 .1 + p2 .4) (1 + r) + w 30 == p2}, {p1, p2}]; Plot[sol, {r, 0, 045}], {a1, 0, .6} ]


2

As pointed out by Mr.Wizard, AnimationRate is not an option of Manipulate but of the particular controller. Namely, the correct syntax is: Manipulate[ (*do stuff*) , {x, 0, 1, AnimationRate-> value}, {y, 0, 1}] If one aims to control the rate of the slider for x (analogous code for y).


2

TabView[ {"Linear: a x + b" -> Manipulate[Plot[a x + b, {x, -5, 6}], {a, -5, 5}, {b, -5, 5}], "Exponential: a \!\(\*SuperscriptBox[\(b\), \(x\)]\) + c" -> Manipulate[ Plot[a b^x + c, {x, -5, 6}], {a, -5, 5}, {b, 1, 5}, {c, -5, 5}]} ] Do you really want b to take on negative values in the Exponential function? You can also try ...


2

Using the command ControlType -> and then listing the type of control you want, such as SetterBar, Manipulator, or Slider at the end of your Manipulate function allows you to customize the controls. Mathematica will also automatically change the control based on the data put in (i.e., if you put in code like this {frame, {True, False}} it will give a ...


3

Works with Mathematica 10.4. Manipulate[ ParametricPlot3D[{u, v, -2}, {u, -7, 7}, {v, -7, 7}, PlotPoints -> 200, MaxRecursion -> 2, Mesh -> None, Axes -> False, Boxed -> False, PlotStyle -> {Black, Specularity[10]}, Lighting -> {{"Spot", RGBColor[RGB[[1]], 0, 0], {{0, r, 5}, {0, r, 0}}, Pi/8}, {"Spot", RGBColor[0, ...


3

The problem is with Animator. When it is passed a list, the +/- buttons increment the index of the setting by about 5-10%. It seems to pick a "nice" increment that is 1, 2 or 5 times a power of 10. When the length of the list is less than 10, it does not behave well. It seems that an increment of 0 is what is sometimes calculated. (Personally, I would ...


4

Based on the documentation, Slider is the only control object used in your code that supports a list of expression as its settings. Here is a custom alternative. DynamicModule[{list = {0.001, 0.0025, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01}, l}, Row[{ Slider[Dynamic@l, {list}], Spacer[5], InputField[Dynamic[l, If[MemberQ[list, #], l = #] &], ...


6

Example DynamicModule[ {value = 10}, Panel @ Row @ { Slider[Dynamic @ value, {1, 100, 1}, ImageSize -> Small], InputField[Dynamic @ value, Enabled -> False, ImageSize -> {36, 18}], Button["-", value--], Button["+", value++] } ] Output EDIT In order to restrict Slider to a set of pre-defined values, please see ...


5

SetOptions[Manipulator, Appearance -> "Open"]; Manipulate[Plot[Sin[a x + b], {x, 0, 6}], {a, 1, 4}, {b, 0, 10}]


1

A version with buttons. First thing to note: I don't know how to subscribe to the Alt + click event and do appropriate things when it triggers. This is why mixing point adding by Alt + click and right-click is error-prone. If one sticks to adding points merely by right-click (via {"MouseDown", 2} event in LocatorPane), code could be bug-free ... You start ...


3

I guess you could do everything you wanted but you will have to abandon the general Manipulate and program your own LocatorPane. Here's a try. First I modified your input data slightly to debugging taste. With[{width = 400}, original = Import[ "http://www.clipartqueen.com/image-files/elephant-silhouette.png"]; img = ImageResize[original, width] // ...


1

In order to perform the Manipulate that you are looking for we really only need three functions (see Feyre's comment). My interpretation is that you could use: kbA[θ_] := 6.80414/((θ/10 - 0.119974) Sqrt[-1.19974 + θ]) kbM[θ_] := 37037/(20.468 + 22.4478 θ + 8.2063 θ^2 + θ^3) cfun[kA_, kM_] := kA^(1/3) + kM^(2/3) - 8 (kA + kM)/100 Now we can define your ...


4

Body of Manipulate is effectively wrapped with Dynamic so we can just put it there: Manipulate[ c = If[k == 0, {0, 0}, If[k == 1, {0, 1}, {0, 2}]]; Graphics[{}, PlotRange -> 2, Frame -> True], {{c, {0, 0}}, Locator, Appearance -> Graphics[{Disk[{0, 0}]}, ImageSize -> 10]}, {{k, 0}, {0, 1, 2}}]


4

Example Code DynamicModule[ {k = 0}, Column[{ (*Control*) SetterBar[Dynamic @ k, {0, 1}], (*Visual*) Dynamic @ Graphics[ Switch[k, 0, Locator[{0, 0}], 1, Locator[{0, 1}]], (*Graphics Options*) Axes -> True, PlotRange -> 2 ] }, (*Column Options*) Alignment -> Center] ] Output


4

This is dummy data that I hope is illustrative. data = Flatten[ Table[{i, j, Sin[m i] Cos[m j ], m}, {i, 0, 2 Pi, 0.1}, {j, 0, 2 Pi, 0.1}, {m , 0, 1, 0.01}], 2]; g = #[[All, 1 ;; 3]] & /@ GatherBy[data, #[[4]] &]; lp = ListPlot3D[##, Mesh -> None, Boxed -> False, Background -> Black,Axes -> False, PlotRange -> {-1, 1}] &...


2

It's difficult to tell what your data actually look like e.g. are z values unique etc. But here's a crack at it: (*Generate some fake data based on a function of x,y,z*) f[x_, y_, z_] := {Re@Exp[I*z]*Sin[x]*Cos[y]*100, x, y, z*100}; d = f[##] & @@@ RandomReal[{-1, 1}, {10, 3}]; (*Export it to a CSV file with a header.*) Export[ FileNameJoin@{$...


2

I can't help you with the list picker control because I can't figure out what you are trying to do with it. However, I can help you with the scrolling data display. The approach is two-fold. Remove all definitions of static items from the Manipulate expression to prevent unnecessary dynamic evaluation. Build the data display with two panes, the first for ...


2

One way to put the whole thing into the Manipulate is to define f as having two parameters, x and a. f[x_, a_] := a x (1 - x); Manipulate[ ListPlot[NestList[f[#, a] &, x, n]], {x, 0, 1}, {n, 0, 1000, 1}, {a, 1, 4}]


2

Manipulate[Plot[Piecewise[{{ξ x^2, x <= 1/(2 ξ - 1)}, {x, x > 1/(2 ξ - 1)}}], {x, 0, 5}, GridLines -> {{{1/(2 ξ - 1), Directive[Thick, Red]}}, {}}, Epilog -> Text[Framed[ToString@Round[1/(2 ξ - 1), .1], Background -> Orange], {1/(2 ξ - 1), -.5}], PlotRangePadding -> .9], {{ξ, .7}, ...


2

I differ from xslittlegrass on what you want the label to be. I would modify your code like so: Manipulate[ With[{threshold = 1/(2 ξ - 1)}, Show[ Plot[ Piecewise[{{ξ x^2, x <= threshold}, {x, x > threshold}}], {x, 0, 5}], Graphics[ {HalfLine[{threshold, 0}, {0, 1}], Text[Round[threshold, .01], {threshold, -2....


3

One way is to add a text element in the graphics object: Manipulate[ Show[Plot[ Piecewise[{{ξ x^2, x <= 1/(2 ξ - 1)}, {x, x > 1/(2 ξ - 1)}}], {x, 0, 5}], Graphics[{Line[{{1/(2 ξ - 1), 0}, {1/(2 ξ - 1), 25}}], Text["label", {1/(2 ξ - 1), 0}]}]], {ξ, 0, 1, Appearance -> "Labeled"}]



Top 50 recent answers are included