New answers tagged

1

Changing initial conditions can be accomplished in the same way that parameters are changed. For instance, replace Yb[0] == 0.1 by Yb[0] == Yb0, add the corresponding control, {{Yb0, 0.1}, 0, 1, Appearance -> "Labeled"}, and include Yb0 in the list of TrackedSymbols.


1

If there is a need to preserve initial structure of the code, some condition may be an option: Manipulate[ dom = {-10, 10}; If[Not[NumericQ[f]] || Not[Between[f, dom]], f = 0]; Plot[a Sin[2 Pi f t/12], {t, 0, 12}, PlotRange -> {{0, 12}, {-1, 1}}, AspectRatio -> 0.5, Frame -> True, Axes -> True, ImageSize -> 800], Row[{ ...


1

You can avoid trouble by choosing reasonable values for the range and increment of your controls. The following choices work well. Manipulate[ Plot[a Sin[2 Pi f t/12], {t, 0, 12}, PlotRange -> {{0, 12}, {-1, 1}}, AspectRatio -> 0.5, Frame -> True, ImageSize -> 700], Row[{ Control[{{f, 1, "frequency"}, 0, 10, 0.01, ...


1

To address the issue use some Off[NumberForm::sigz] in Manipulate[...]. It is also better to use simple Epilog with Text[Row[...] (code below): Some code picture:


3

There seem to be three problems with your code. r = {{0, 1}, {0, 0}} is not an acceptable $r$-matrix. I substituted {{0, .5}, {.5, 0}} for the purposes of this answer. This is one of those times when you must use Set rather than SetDelayed when defining a function. You shouldn't use s_ in a function call, as you did in your Manipulate expression I made ...


1

You can control the automatic switching between when a control (e.g. slider) is actively being moved and when it has been releeased with ControlActive. Better rendering takes more time, so it is up to the programmer to balance quality and speed, if the Automatic setting is unsatisfactory. See also PerformanceGoal. sol = DSolve[{D[u[t, x], t] - x*D[u[t, ...


1

The simplest way I thick is to use Dynamic["your function"] instated of 1 in your controller. Control[{{A, 0.1, "Amplitude"}, 0, Dynamic["your function"], 0.01, Appearance -> {"Labeled", "Closed"}}] I think this will give you want you want, (assuming the function of the end is f+1): Manipulate[ Plot[A Sin[2 Pi f t/12], {t, 0, 12}, PlotRange -> ...


1

There is really no need to gather the parameters into a list. You can do it with this simple approach. DynamicModule[{f, g}, f[q_, a_, b_, c_] := q + 2 a + 3 b + 4 c; g[q_, u_, v_, w_] := q - u/2 - v/3 - w/4; Manipulate[ Plot[f[q - 5, a, b, c]^2 + g[q + 5, a, b, c]^2, {q, 0, 10}], {{a, 0}, -1, 1}, {{b, 0}, -1, 1}, {{c, 0}, -1, 1}]] ...


2

One problem you're having is that because Manipulate localizes its variables, while the symbols in par are global (in the "Global`" context), the letters a, b, c inside the Manipulate do not refer to the variables in par. Your workaround seems reasonable. There's also the option LocalizeVariables, which can be set to False to make the Manipulate parameters ...


2

The problem is with the function evaluating at each point of plot instead of being set once and for all. This is due to the misuse of setdelayed (:=). end = 5; delta :=RandomChoice[{0.08, -0.08, 0.16, -0.16}]; f[x_] = Piecewise[ Table[{Sin[x Pi + delta]^100, i <= x < i + 1}, {i, 0, end-1}]]; Plot[f[x], {x, 0, end}, PlotRange -> All, PlotPoints ...


3

r = 2; Manipulate[ Plot[q t E^(Subscript[B, 2] + Subscript[B, 1] t^n), {t, -10, 10}, PlotRange -> All, PlotPoints -> 50], {q, -r, r}, {Subscript[B, 1], -r, r}, {Subscript[B, 2], -r, r}, {n, -r, r} ]


2

I just want to point out the Edmund's fancy version of Manipulate is unnecessarily complicated. The same effects can be gotten with much simpler code. Manipulate[ Plot[Sin[a + b x], {x, 0, 10}], Row[{ Control[{{a, 0, ""}, {0, 1}}], " ", Dynamic @ Switch[a, 0, "Zero", 1, "One"]}], {{b, 1, ""}, 1, 5, Appearance -> "Labeled"}] ...


4

A simple way is to define your Manipulate variable parameters so that they are recognised as the control type you want. Look in the first part of the Details and Options section of Manipulate documentation. Manipulate[ Plot[Sin[a + b x], {x, 0, 10}], {{a, 0}, {0, 1}}, {b, 1, 5}] You can get fancier by specifying the controls and layout directly. ...


3

EDIT: added use of PlotLegends package Use a single Plot with the option Filling Needs["PlotLegends`"]; EffPot[r_, Energy_, AngMom_] := -Energy/r + (AngMom^2 - 1)/(2 r^2) Manipulate[ Plot[{ EffPot[r, Energy, AngMom], (Energy^2 - 1)/2}, {r, 0, 10}, PlotStyle -> { {Thick, RGBColor[0.60, 0.20, 0.40]}, {Thick, RGBColor[0.20, 0.20, ...


3

You have put the plot to the second argument of Manipulate, while there are some examples around with different things there it is really meant only for controllers. So what you have to do is to gather your output in the first argument of Manipulate, with a Grid or something: [...] Column[{ Button["Plot", plot = Plot3D[Sin[x + y^0], {x, -3, 3}, {y, -2, ...


1

You can avoid the Which by dynamically setting PlotRange and FrameStyle as a function of f Manipulate[ Plot[f[x], {x, 0, 10}, PlotRange -> {Automatic, {0, Max[axisStep Quotient[f[1], axisStep], 2]}}, Frame -> True, FrameStyle -> {With[{z = Mod[f[1], axisStep]}, If[flashRange > z \[Or] z > axisStep - flashRange, ...


0

Here is something that works. I am quite certain that there are more efficient ways to accomplish this but at least the code is fairly easy to follow. I tried wrapping the right hand side of AxesStyle in Dynamic but it didn't work so I ended up wrapping the whole plot in Dynamic. The Manipulate variables with ControlType->None is one way of introducing ...


2

Edit TemporalData is one of those functions that accepts property names as arguments for extracting the information it holds. Please read the documentation for TemporalData where will find a list of such properties and examples of their use. Using example data taken from the documentation s = {2, 1, 6, 5, 7, 4}; s2 = {22, 12, 62, 52, 72, 42}; t = {1, 2, ...


4

Use Normal to get the lists out of a TemporalData object Normal[td] returns a list containing time-value pairs for each path. s = {2, 1, 6, 5, 7, 4}; s2 = {22, 12, 62, 52, 72, 42}; t = {1, 2, 5, 10, 12, 15}; td = TemporalData[{s, s2}, {t}]; Normal@td (* {{{1, 2}, {2, 1}, {5, 6}, {10, 5}, {12, 7}, {15, 4}}, {{1, 22}, {2, 12}, {5, 62}, {10, 52}, ...


2

This is a classic case where a good solution is to define a function. sphereCenter = {0, 0, 0}; sphere[sphereRadius_] := Sphere[sphereCenter, sphereRadius]; Manipulate[Graphics3D[sphere[s], PlotRange -> {{-10, 10}, {-10, 10}, {-10, 10}}], {s, 1, 10}] I added the PlotRange, because otherwise you can't see the ball getting larger and smaller due to ...


2

As Sascha has note in a comment, you need to define your queueing process as a function of λ. q[λ_] := QueueingProcess[λ, 4.3, 1] Manipulate[ QueueProperties[q[λ]], {λ, 1, 4, Appearance -> "Labeled"}]


0

emptyImage = Image[Table[0, {i, 1, 300}, {j, 1, 400}]] coordList=RandomInteger[{100,200},300,2]; Manipulate[ReplacePixelValue[emptyImage, coordList[[1 ;; i]] -> 1], {i, 1, Length[coordList], 1}]


1

Legends are heavily affecting the performance in Dynamic so I'd probably go with some hand made legends anyway: Manipulate[ Grid[{{ Dynamic @ Plot[{a Sin[x], a Cos[x]}, {x, 0, 2 Pi}] , LineLegend[ {RGBColor[0.368417, 0.506779, 0.709798], RGBColor[0.880722, 0.611041, 0.142051]}, TraditionalForm /@ {Dynamic[a Defer@Sin[x]], Dynamic[a ...


3

The FrontEnd has the habit of renaming variables, which is usually a good thing, but sometimes can be troublesome. One possibility is to evaluate the argument of Plot, e.g.: Manipulate[ NumberForm[ Plot @@ {{a Sin[x], a Cos[x]}, {x, 0, 2 Pi}, PlotLegends -> "Expressions", PlotRange -> {-2, ...


7

If you leave ContourPlot outside you can get quite nice performance: static = ContourPlot[45 x^2 + 20 y^2 == 45, {x, -2, 2}, {y, -2, 2}, Frame -> False]; dynamic = ContourPlot[8 x^2 + 4 x y + 5 y^2 == 9, {x, -2, 2}, {y, -2, 2}, Frame -> False, ContourStyle -> Orange]; Manipulate[ Graphics[{ First@static, ...


0

Thanks to Dr. Belisarius, Epilog -> {Text[Subscript[Log, b] "(x)", {3, -5}]}]


6

I'm not sure about all the arguments, but maybe this will get you started: Clear[MultiSlider]; MultiSlider[Dynamic[xs_], {st_, end_}] := LocatorPane[Dynamic[xs], Graphics[{LightGray, Thickness[0.015], Line[{{st, 0}, {end, 0}}]}], {{st, 0}, {end, 0}}] Manipulate[ x, {{x, Table[{2 i, 0}, {i, 5}]}, 0, 12, MultiSlider[##] &}] You can constrain ...


2

You can fix this by wrapping the plotting function inside an Evaluate: Manipulate[ Plot[ Evaluate[(f /. x -> (x - h)) + k] , {x, -10, 10} , PlotRange -> {{-10, 10}, {-10, 10}} , Epilog -> Text[(f /. x -> (x - h)) + k, {7, 9}] , GridLines -> {Range[-10, 10], Range[-10, 10]} , GridLinesStyle -> Opacity[.04] ] , {{f, x^2, ...


4

In the post you have: Text["f(x)=" m x + b, {3, b}] which means Times["f(x)=", m x + b] whereas what you need is: Text[f[x] == m x + b, {3,b}] because Text displays expressions in TraditionalForm by default. So Manipulate[ Show[Plot[m x + b, {x, -10, 10}, PlotRange -> {{-10, 10}, {-10, 10}}, PerformanceGoal -> "Quality"], ...


5

Here's a way, with a judicious use of HoldForm, that leaves out empty terms and puts them in (at least) traditional order depending on sign: Manipulate[ Show[Plot[m x + b, {x, -10, 10}, PlotRange -> {{-10, 10}, {-10, 10}}, PerformanceGoal -> "Quality"], Graphics[Text[HoldForm@f[x] == m HoldForm@x + b, {3, b}]], GridLines -> {Range[-10, ...


3

Manipulate[Show[ Plot[m x + b, {x, -10, 10}, PlotRange -> {{-10, 10}, {-10, 10}}, PerformanceGoal -> "Quality"], Graphics[ Text["f(x) = " <> ToString@m <> " x " <> If[b < 0, "", "+ "] <> ToString@b, {3, b}]], GridLines -> {Range[-10, 10, 1], Range[-10, 10, 1]}, GridLinesStyle -> Opacity[.04]], ...



Top 50 recent answers are included