Tag Info

Hot answers tagged

4

xp[t_, r_, t0_, x0_] := x[t] /. First[ NDSolve[{x'[t] + r x[t] == 0, x[t0] == x0}, x[t], {t, 0, 10}]]; Manipulate[ ClickPane[ Plot[g, {t, 0, 10}, PlotRange -> 1, Frame -> True, Epilog -> {PointSize[Large], Point[sp]}], (AppendTo[g, xp[t, r, #[[1]], #[[2]]]]; {t0, x0} = #; AppendTo[sp, #]) &], {{r, 1, "r"}, -10, 10, 0.01, ...


4

It's much simpler f[g1_Graph] := DynamicModule[{pts = PropertyValue[{g1, #}, VertexCoordinates] & /@ VertexList@g1, g2 = g1}, {Dynamic@Column@pts, LocatorPane[Dynamic[pts], Dynamic[g2 = SetProperty[g2, VertexCoordinates -> pts]]]}] g = CompleteGraph[5, VertexLabels -> "Name", PlotRange -> {{-5, 5}, {-5, 5}}]; f@g


2

You can use a list of points instead of individual controls and Manipulate will construct a LocatorPane to handle them. Not fussing much with the rest of the code, except to eliminate the global variables gr5 and coords: Manipulate[ With[{gr5 = Graph[el0, EdgeStyle -> LightGray, VertexCoordinates -> v, VertexLabels -> "Name", ImageSize ...


2

Grid According to the documentation, you have to explicitly define the Controls inside Grids, Columns and the like, since Manipulate has no way of figuring it out. Using a simpler example: Manipulate[code, "", Delimiter, "", {x, 0, 1}, {y, 0, 1}, "", Delimiter, "", Grid[Map[Control, {{{x, 0, 1}, {y, 0, 1}}, {{x, 0, 1}, {y, 0, ...


2

For the second part, you have to wrap the string in Dynamic, as in Manipulate[Plot[{1, a + b t}, {t, 0, 1}, PlotRange -> All] , {{a, 0, "a:"}, 0, 1} , {{b, 0.9, Dynamic["b: " <> ToString@b]}, 0, 1}] But, overall, please refer to @Öskå's comment (i.e., use SetDelayed with explicit parameters, and Appearance->"Labeled")!


2

Here's your code with fixes I've suggested in comments: DynamicModule[ {Location = {{0, 0, 0}, {0, 0, 0}}, pos10 = {{}, {}}, pos11 = {{0, 0, 0}, {0, 0, 0}}, pos12 = {{0, 0, 0}, {0, 0, 0}}, pos20, pos21 = {{0, 0, 0}, {0, 0, 0}}, pos22 = {{0, 0, 0}, {0, 0, 0}}, posInt, x, y, z, Chosen = 1}, posInt[] := ...


1

I would solve that problem adding a function with a pattern in the argument. Try: realRegion1a[x_Real] := realRegion1[x] And the try your Manipulate using that new function. It will behave as expected.


1

Here's one way: make the range be a checkbox (to choose the desired range for the x variable). Also, place the xinit and xmax variables inside Dynamic so they react to the changed values. Manipulate[If[range, xinit = 3; xMax = 5;, xinit = 1; xMax = 4;]; x, {{x, Dynamic[xinit]}, 1, Dynamic[xMax], 1}, {range, {False, True}}]


1

The Problem The Manipulate and the first Plot of your code don't work because you use a combination of SetDelayed (:=) and ReplaceAll (/.) that doesn't behave like you expected. When you define g[t_, f0_, f1_, ff1_] := f[t] /. sol[[1]] and now evaluate g[2, 1, 1, 1] you get f0 + 4 (-3 f0 + 3 f1 - ff1) + 8 (2 f0 - 2 f1 + ff1) instead of the ...


1

I use the following construct: Manipulate[ Plot[{1, a + b t}, {t, 0, 1}, PlotRange -> All], {{a, 0, Dynamic[Panel[ Row[{Style["a=", 14, Red, Italic], Style[a, 14, Red, Italic]}], ImageSize -> {80, 40}]]}, 0, 1}, {{b, 0, Dynamic[Panel[ Row[{Style["b=", 14, Blue, Italic], Style[b, 14, Blue, Italic]}], ImageSize ...


1

Here it is. I removed the PlotLegends stuff (that doesn't work in ver 10). vtot[t_][n_] := Sum[Subscript[v, i][t], {i, 1, n}] xtot[t_][n_] := Sum[Subscript[x, i][t], {i, 1, n}] strain[i_, n_] := {D[Subscript[v, i][t], t] == Subscript[v, i][t]*(r - p*Subscript[x, i][t] - q*z[t]), D[Subscript[x, i][t], t] == c*Subscript[v, i][t] - ...


1

This works for me. V 10.01 on windows SetDirectory[NotebookDirectory[]]; m = Manipulate[ Plot[phi[x, t, c], {x, 0, 20}, PlotRange -> {0, 3}], {t, 0, 4}, {c, 0, 5}, AutorunSequencing -> {1, 2}, Initialization :> ( x0 = 0; phi[x_, t_, c_] := (c/2)*(Sech[0.5*Sqrt[c]*(x - x0 - c*t)]^2); ) ] and in new cell, just type ...


1

But I need to also have it expandable so that I could view and enter the numeric value Maybe I am missing something, but why use ControlType for? Is this what you mean? Manipulate[ Plot[Sin[a x], {x, -3, 3}, ImageSize -> 600, AspectRatio -> 0.2], {a, -10, 10, Appearance -> "Labeled", ImageSize -> 600} ]


1

Manipulate[ ClickPane[Plot[g, {t, 0, 10}, PlotRange -> x, Frame -> True], (AppendTo[g, Exp[-(t - #[[1]])]*#[[2]]]) &], {x, 1, 10}, Initialization :> {g = {}}]



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