Tag Info

New answers tagged

3

Using only Manipulate and no Dynamic f[x_] := Sin[x] Manipulate[ Show[Plot[f[x], {x, 0, 2 Pi}, Axes -> False, Frame -> True], Graphics[{Locator[{First@p, f[First@p]}]}]], {{p, {0, 0}}, Locator, Appearance -> None}] If the position of the displayed Locator is needed in several parts of the code inside Manipulate, the following ...


0

Ok, sorry, misunderstood the question, this should (more or less) work. Manipulate[ LocatorPane[Dynamic[pt], Plot[Sin[x], {x, 0, 20}, Epilog -> {Point[ Dynamic[{First[pt] + y, Sin[First[pt]] - Sin[y + \[Pi]/5] + 0.55}]]}], Appearance -> None], {y, -10, 10}] You may wish to specify the initial locator position for a slightly ...


4

You must use a Dynamic[] in your Manipulate[]. It is documented in the "Advanced Manipulate Tutorial" (chapter "Using Dynamic inside Manipulate") : solveDiffEq[a_] := { sol = NDSolve[ {f''[t] == a*f[t], f[0] == 1, f'[0] == 1}, f, {t, 0, 1}]; {AbsoluteTime[], f[t] /. sol[[1]]} }; Manipulate[ s = solveDiffEq[a0]; Dynamic[s /. t ...


3

Managing Manipulate and other Dynamic functionality is tricky. It takes some time reading the tutorials and experimenting to sort it all out. Even then you might still get surprised now and then. The trick is to separate the code segments that need updating using Dynamic, Refresh, and sometimes DynamicWrapper; further, one needs to control which symbols ...


3

Apart from szabolcs' dirty trick, a generic way to resolve this would be to precalculate one plot g=ContourPlot[f==0,{x,-5,5},{y,-5,5}]; And then use manipulate with the precalculated plot Manipulate[Show[g,Plot[m*x,{x,-5,5}]],{m,-5,5}]


2

Both styles are possible Row[{ Manipulate[ ContourPlot[ a[x, y] == 0, {x, -5, 5}, {y, -5, 5}], {{a, #1 - #2 &}}], Manipulate[ ContourPlot[ a == 0, {x, -5, 5}, {y, -5, 5}], {{a, x - y}}]} ] Edit Answering your comment below, you may use the function in many ways. Here I numerically solve a differential equation involving it: ...


4

Here's the basic idea, where you can adjust the function, limits, and Piecewise arguments for your specific case. Manipulate[ Plot[{120 - 50 x^2, 120 - 50 Sqrt[x]}, {x, 0, 1}, PlotRange -> {70, 120}, Filling -> {1 -> {2}}, PlotStyle -> {Green, Blue}, FillingStyle -> LightGray, Epilog -> {Red, PointSize[0.03], Point[{.5, ...


2

One can make c and a stepsize with an If statement interdependent controls of the Manipulate without showing stepsize. However, this only works after making the If statement Dynamic. f[x_] = Piecewise[{{-x, x < 0}, {x^2, x >= 0}}]; g[x_] = Piecewise[{{-1, x < 0}, {2 x, x > 0}}]; Manipulate[ Plot[{f[x], f[c] + g[c] (x - c)}, {x, -3, 3}, Epilog ...


6

You can do this: Modify the If statement in the second argument of dynamics as you like. I set it now to jump by 0.2 if c<0 and jump by 0.01 if c>0 but you can change this. f[x_] = Piecewise[{{-x, x < 0}, {x^2, x >= 0}}]; g[x_] = Piecewise[{{-1, x < 0}, {2 x, x > 0}}]; Manipulate[ Plot[{f[x], f[c] + g[c] (x - c)}, {x, -3, 3}, Epilog ...


1

I received an answer from support that it's a Manipulate bug. The following code is stable(it's working on Mathematica 10, Windows 7): co = 2.0*^8; ω = 2 Pi \[ScriptF] 10^6; τ = \[ScriptCapitalT] 10^-9; t = ts*10^-9; sol = Solve[{a + b == 1, (a E^(-I ω τ) + b E^(I ω τ)) == (a E^(-I ω τ) - b E^(I ω τ))*RL/Z0}, {a, b}]; Vi[ts_, x_, ...


2

It is always a pain to adjust everything in complex Manipulate but if you insist :) Manipulate[ {filter, list} , {{filter, 1, "Filter:"}, {1, 2, 3, 4, 5, 6}, ControlType -> PopupMenu} , {list, None} , Grid[{{"List:", PopupMenu[ Dynamic[list, If[# < filter, , list = #] &], # -> Dynamic[Style[#, If[# < filter, Gray, ...


1

It's a DynamicModule not a Manipulate, but it works (Mma V10.1 on Mac and Windows) DynamicModule[{filter, list = 1}, Column[{ PopupMenu[Dynamic[filter], Range[6]], PopupMenu[Dynamic[list], Table[With[{i = i}, (If[i < filter, list = list, list = i]) -> i], {i, 6}]], {"filter", Dynamic[filter]}, {"list", Dynamic[list]} }]] ...


1

Not sure if I understood your question correct, but I think this is what you would get from a standard import of your files: setterDefinitions = {{"a", 10}, {"a", 50}, {"a", 90}, {"b", 1}, {"b", 2}} With such a list of variable names and values, you could do the following to get a working Manipulate: Manipulate[ Plot[Sin[x (b + a*x)], {x, 0, 6}], {a, ...


1

Quick fix is to use LocalizeVariables -> False but then you will have all a etc in Global context. Other way is ugly, but works, we can use any existing variable to extract current context in DynamicModule: SetAttributes[fullName, HoldFirst]; fullName[anyVariable_, stringName_] := Module[{varFullName}, varFullName = StringReplace[ SymbolName[ ...


1

Update: Base on your updated question I guess you want something like Manipulate[{a, b}, {a, 1, 10}, {b, 1, 10}, Button["export", Export[SystemDialogInput["FileSave",".txt"], {{"a", a}, {"b", b}}, "Table"], Method -> "Queued"], Button["import", {a, b} = Import[SystemDialogInput["FileOpen", ".txt"], "Table"][[All, 2]], Method -> "Queued"]] ...


2

Manipulate[Grid[{{ Plot[Sin[x + a], {x, -3, 3}], Plot[BesselJ[x + a, 2], {x, -3, 3}] },{ Plot[Cos[x + a], {x, -3, 3}], Plot[BesselJ[x + a, 4], {x, -3, 3}] }}], {a, -3, 1}]


1

Just to put an answer here, following up on @belisarius's apt suggestion to use Animate instead, and in particular to use the AnimationDirection and AnimationRepetitions options: Animate[ ParametricPlot[{-Cos[t], Sin[t]}, {t, 0, tmax}, ColorFunction -> (ColorData["VisibleSpectrum"][(650 - 350) #3 + 400] &), PlotStyle -> ...


2

Probably cleaner: f[x_, y_] := 2 E^(-x^2 - y^2); pos[t_] := {##, f@##} & @@ (t/8 {Cos[t], Sin[t]}) Manipulate[ Show[ Plot3D[f[x, y], {x, -Pi, Pi}, {y, -Pi, Pi}, PlotRange -> All, Mesh -> None, PlotStyle -> Opacity@.5, Boxed -> False], ParametricPlot3D[pos@t, {t, 0, 6 Pi}], Graphics3D@{Red, PointSize -> .05, ...


3

That won't work because Epilog yields 2D graphics primitives, so you can't have plot a moving 3D point using Epilog. Instead, make a separate Graphics3D object and Show both of them. So, for instance defining parPlot = ParametricPlot3D[ {x[t], y[t], f[x[t], y[t]]} , {t, 0, 6 Pi} , PlotRange -> All , PerformanceGoal -> "Quality" ]; we can ...


3

You can use IntervalSlider in version 10.0 and above. However, you need to explicitly tell Manipulate to use it. Manipulate[ fShowInterval[Sequence @@ probRange], {probRange, 2000, 4000, IntervalSlider, Method -> "Push", MinIntervalSize -> 1}, Initialization :> (probRange = {2500, 3500};)] Method -> "Push"will keep the interval ...


5

With the arbitrary datasets datasets = {dataset1, dataset2, dataset3} = RandomReal[#, 100] & /@ {1, 2, 3}; one can pre-render the plots and add an empty plot for the case when no dataset is selected plots = Append[ MapThread[ListPlot[#1, Joined -> True, PlotStyle -> #2] &, {datasets, ColorData[97] /@ Range[3]}], ...


3

I was pinging Vitaliy Kaurov about this issue some time ago. Lucky for us, our site seems to have quite some members from the WRI development team. Some time later I got a response from Ilian Gachevski saying @halirutan fixed in the development version (chatlog) This means we just have to wait for the next release.


4

EDIT: Pulled definition of f outside of Manipulate to avoid update issue pointed out by @MichaelE2 To keep the Flow from dominating the scale of the Plot and making it difficult to see the other two curves, I multiplied the Flow by Ro f[t_, Caorta_, Rsystemic_, x_, \[Omega]_, k_, Ro_] := Paorta[t] /. NDSolve[ {Paorta'[t] == 1/Caorta ((1/2*k*(1 + ...


4

Perhaps cleaner w[k_, ω_, t_] := 1/2*k*(1 + Cos[ω t]) + 10; pnd = ParametricNDSolve[{ Paorta'[t] == 1/Caorta ((w[k,ω,t] - Paorta@t)/ Piecewise[{{ρ, w[k,ω,t] - Paorta@t >0}}, x*ρ]- Paorta@t/Rsystemic), Paorta[0] == 90}, {Paorta}, {t, 0, 10}, {Caorta, k, ω, ρ, x, Rsystemic}] Manipulate[ Plot[ {#, w[k,ω,t], (w[k,ω,t] - ...


4

You've got Evaluate in the wrong place. It has to be of the form Plot[Evaluate[stuff to plot...],...] So this seems to work: Manipulate[ Plot[Evaluate@{ (ReplaceAll[Paorta[t], NDSolve[{Paorta'[t] == 1/Caorta ((1/2*k*(1 + Cos[ω t]) + 10 - Paorta[t])/ Piecewise[{{Ro, 1/2*k*(1 + Cos[ω t]) + 10 - Paorta[t] ...


2

It seems your Sector returns a region for which RegionMember can calculate its formula. RegionPlot is quite a bit faster on this fairly simple formula than on the region. Further, you don't run into the symbolic-numeric problem of reducing the RegionIntersection in whatever way Mathematica does under the hood. (I suspect it is using a algebraic/symbolic ...


3

Manipulate typically changes the default value of the $PerformanceGoal control to "Speed" instead of "Quality", in order to speed up evaluation of dynamic content (see the first "basic example" in its documentation page). Typically this doesn't matter much, but in some cases this can influence the outcome of some algorithms that are sensitive to the working ...


2

I'm pretty sure there ought to be something cleaner. While we wait for a better answer, you may use this to return the minimum and maximum number of arguments allowed for each wavelet: nArgs[fun_] := StringCases[ToString@DownValues@fun, Shortest["ArgumentCountQ"~~__~~(n1:NumberString)~~__~~ (n2:NumberString)] :> ...


1

Using With and CloudDeploy (and an extra Column somehow) will do it: man = With[{data = (* Import[ ... ] *) { {0, 1, 0, 0, 0, 5}, {1, 1, 1, 1, 1, 295}, {1, 2, 0, 1, 1, 5}}}, Manipulate[ Column[{"", ListLinePlot[{Select[ data[[All, {1, 2, 3}]], #[[1]] == Round[bonbedrag] &][[All, {2, 3}]], ...


1

To flesh out the comment, you need to add Control to each of the variables, and a Row[ ] to get them in a row. Row[{Control[{phi}], Control[{s1}], Control[{s2}]}] will put your first three in a single row. As a simple example: Manipulate[phi*s1*s2, Row[{Control[{phi}], Control[{s1}], Control[{s2}]}]] Notice that the answer contains Nulls until you ...


2

use ImageSize on the slider. For example Manipulate[{a, b, c}, {{a, 1, "a"}, .1, 1, .1, ImageSize -> Large}, {{b, 1, "b"}, .1, 1, .1, ImageSize -> Tiny}, {{c, 1, "c"}, .1, 1, .1, ImageSize -> Small} ]


8

use ImagePadding as in f[x_, a_, b_] := a x - b x^3 Manipulate[ { Plot[f[x, a, b], {x, -2, 2}, ImagePadding -> 5], n = -Integrate[f[x, a, b] , x]; Plot[n, {x, -2, 2}, PlotRange -> Automatic, ImagePadding -> 5] }, {{a, 1/2, "control parameter"}, -1, 2, 0.1}, {{b, 1/4, "control parameter 2"}, -1, 2, 0.01} ]


4

The second argument to Dynamic is the key. The code does not keep track of ViewVertical, which will change as the graphics are rotated by the mouse. See the references at the end for some of the answers where I used this technique. Manipulate[ Framed[Graphics3D[{PolyhedronData["Dodecahedron", "Faces"]}, ViewPoint -> Dynamic[3.0 {Cos[θ] ...



Top 50 recent answers are included