Tag Info

Hot answers tagged

6

You can do this with Inactive like this temp = Array[Inactive[Part][a, #1, #2] &, {3, 2}]; you can then set an a at a later stage and Activate that: a = RandomReal[{-1, 1}, {4, 4}]; Activate[temp]


5

Perhaps this? Manipulate[ {names, slide, setter, cases}, Dynamic@Switch[cases, "custom", Control[{{names, True}, {True, False}}], "a", Control[{{slide, 0}, 0, 1}], "b", Control[{{setter, "das"}, {"das", "der", "die"}}]], {{cases, "custom"}, {"custom", "a", "b"}}] The variables seem to get localized properly even though the syntax ...


5

If you are using version 10 you can make use of the new Indexed function: expr1 = Array[Indexed[a, {##}] &, {3, 2}] If you are on an older version you can Quiet the error messages and use: expr2 = Quiet @ Array[a[[##]] &, {3, 2}] {{a[[1, 1]], a[[1, 2]]}, {a[[2, 1]], a[[2, 2]]}, {a[[3, 1]], a[[3, 2]]}} With either expression, if a is ...


4

EDIT As Mr Wizard observed my original code is not self contained. For reasons that I fail to understand this seemed to work with what seemed a fresh session. The code works if you move the gauge marker but to post correct code (I leave the animated gif as it is the same outcome): DynamicModule[{s = 0}, Framed[Row[{VerticalGauge[Dynamic[s], {0, 1}, ...


3

For the first question the problem is only in the radius of the small circle. it should be like this: Circle[center[{R, r}, θ], r]


3

Something like that? list = Range[0, 9]; DynamicModule[{nr, val}, Column[{ Dynamic@list, Dynamic@list[[ nr]], Slider[Dynamic@nr, {1, 10, 1}], Slider[Dynamic[list[[ nr]]], {0, 10, 1}] }] ] Manipulate version: list = Range[0, 9]; Manipulate[ Column[{list, list[[nr]]}], Column[{ Control[{{nr, 1}, 1, 10, 1}], ...


2

Edit In response to OP providing code used in demonstration Here are the steps I have followed to generate the HTML file with embedded CDF Where you have {395,430},Alignment->Left] change your code to have {500, 500}, Alignment -> {Center, Top}. The alignment could stay the same but the dimensions need to be increased. Execute the notebook in a ...


2

This is a rough idea you can build up on. Manipulate[ Graphics[{Text[Text1, {-4, 1}], Text[Text2, {-4, 3}], Text[Text3, {-4, 5}], Text["10^-6", {4, 2}], {Line[{{1.5, 2}, {3.4, 2}}]}, {Line[{{2.5, 4}, {3.4, 4}}]}, Text["10^-3", {4, 4}], {Green, Polygon[{{{0, 0}, {-1, 2}, {1, 2}}}]}, {Orange, Polygon[{{-1, 2}, {-2, 4}, {2, 4}, {1, ...


2

Why don't you use a lokal variable? Define a local variable first, then do your plot: In[1]:= startingA = 0; In[2]:= Manipulate[ startingA = a; Plot[Sin[a x^2], {x, 0, 2 Pi}] , {{a, startingA}, 0, 3}] (Note: The vaiable has NOT to be in the same evaluation cell as Manipulate[]!) The first time a starts at the defined ...


2

In Mathematica 10, we can use Graph3D: Graph3D@RandomGraph[{20, 50}]


2

Is this what you want? graphComponents = {{"blood", "pressur"}, {"harvard", "oxford"}, {"help", "lower"}, {"oxford", "benefit"}, {"harvard", "benefit"}, {"lower", "level"}, {"faceoff", "benefit"}, {"oxford", "faceoff"}, {"harvard", "faceoff"}, {"over", "benefit"}, {"faceoff", "over"}, {"oxford", "over"}, {"harvard", "over"}, {"benefit", ...


2

Here is one way: Tuples@Outer[List, {USD, EUR, JPY}, {UP, DOWN}] (* {{{USD, UP}, {EUR, UP}, {JPY, UP}}, {{USD, UP}, {EUR, UP}, {JPY, DOWN}}, {{USD, UP}, {EUR, DOWN}, {JPY, UP}}, {{USD, UP}, {EUR, DOWN}, {JPY, DOWN}}, {{USD, DOWN}, {EUR, UP}, {JPY, UP}}, {{USD, DOWN}, {EUR, UP}, {JPY, DOWN}}, {{USD, DOWN}, {EUR, DOWN}, {JPY, UP}}, ...


2

shape1 := Graphics[{#, Circle[{0, 0}, 1.5], Disk[]}, ImageSize -> 10] &; shape2 := Graphics[{Lighter@#, Disk[]}, ImageSize -> 10] &; ClearAll[lOF]; lOF[nOfOverlays_, colors_List, opts : OptionsPattern[]] := DynamicModule[{layer = 1, pts = ConstantArray[{{100, 100}, {700, 700}}, nOfOverlays], col = ...


1

I used 3 rather than 6 functions for each plot and used a Frame rather than Axes to reduce the clutter. f := RandomReal[]; h := Floor[f*20]; When the Table is inside of the Plot use Evaluate Manipulate[ Plot[ Evaluate[ Table[f Sin[h x + h t], {3}]], {x, -5, 5}, PlotRange -> {-1.1, 1.1}, Frame -> True, Axes -> False], {{t, 5}, 0, ...


1

Use value -> label in the list of values: Manipulate[ plot[[n]], {plot, {rawplots -> "foo", weightplots -> "bar", linearizedplots -> "baz"}, PopupMenu} ]


1

I believe the jump in value of asd happens because you're dragging the indicator with the mouse when the range is reset. Here is a way that does what you want, I think. It interrupts the mouse-dragging by creating a new Slider when the boundary is reached. {Dynamic@asd, Dynamic@Slider[Dynamic[asd], Which[asd < 10, {1, 10}, asd >= 10, {9, 50, ...


1

This functions: params[a] = 5; params[b] = 6; Manipulate[params[a] = n, {n, 10, 100, 1}] In contrast: c = 1; Manipulate[c, {c, 10, 100, 1}] Here, the Manipulate displays the change of the local c. It doesn't change the global c which still has value 1.


1

Using the logManipulator from my answer to Logarithmic slider, you can also achieve your objective via Manipulate[ f[x, y], {x, 10.^-10, 10^-1, 10, logManipulator[##] &}, {y, 0.01, 1, 0.01}] Code for logManipulator: ClearAll[logManipulator]; With[{smallerRule = {Large -> Medium, Medium -> Small, Small -> Tiny}}, ...


1

f[x_, y_] = x*y; Manipulate[ f[x, y] // ScientificForm, {{x, 10.^-6}, 10.^Range[-1, -10, -1]}, {{y, .5}, 0.01, 1, 0.01, Appearance -> "Labeled"}]


1

A few alternatives: Using SmoothHistogram: Manipulate[ Module[{data = RandomVariate[BinomialDistribution[n, p], 500]}, Show[Plot[PDF[BinomialDistribution[n, p], x], {x, 0, 20}, PlotRange -> {{-.5, 21.5}, {-.1, 1}}, Evaluated -> True, PlotStyle -> Directive[Thick, Blue], Epilog -> {PointSize[0.03], ...


1

It looks like you're trying to overlay some plots (up to 500). Are you sure this is what you want to do? Regardless, this code works fine in Mathematica 10.0. somegraphs = Table[Plot[x^ii, {x, 0, ii}], {ii, 1, 100}]; Manipulate[Timing[Show[somegraphs[[1 ;; ii]]]], {ii, 1, 100, 1}] Perhaps you'll need to show more code.


1

You could use Dynamic to update i: graphComponents = {{"blood", "pressur"}, {"harvard", "oxford"}, {"help", "lower"}, {"oxford", "benefit"}, {"harvard", "benefit"}, {"lower", "level"}, {"faceoff", "benefit"}, {"oxford", "faceoff"}, {"harvard", "faceoff"}, {"over", "benefit"}, {"faceoff", "over"}, {"oxford", "over"}, {"harvard", ...


1

Here is an answer that pretty much sums up the advice you got in the comments made to your question. Manipulate[ Dynamic @ Show[ Plot[f[x], {x, 0, 2}], ListPlot[{{0, 0}, {1, 1}, {2, 2}}, PlotStyle -> Red, PlotMarkers -> {Automatic, Small}], PlotRange -> {Automatic, {-3, 7}}, AxesOrigin -> {0, 0}], {{a, 0}, -1, 1}, ...


1

It depends on what you mean by size. PlotRange will "zoom", ImageSize produces larger graphic. For illustration: Manipulate[ ContourPlot[ x^4 + y^4 + 2*x^2*y^2 - x^2 + y^2 == n, {x, -r, r}, {y, -r, r}, ImageSize -> imagesize], {n, -.2, 3}, {r, Range[2, 5]}, {imagesize, Range[200, 500, 100]}]


1

Manipulate[ Plot[{Sin@x, Normal@Series[Sin@u, {u, x0, n}] /. u -> x}, {x, -2 Pi, 2 Pi}, PlotRange -> {Automatic, {-2, 2}}, Epilog -> {PointSize[Medium], Point@{x0, Sin@x0}}], {n, 0, 10, 1}, {x0, -Pi, Pi}]


1

If you are just asking how to reproduce your code more compactly/parametrically, you can use RandomInteger to produce a list of integers then rearrange. For now let's just use n = 5. We can generate the rules by creating two long lists and then threading them together. Here's the list of left-hand sides (of the rules): nodes = Sort@Flatten@Table[Range@8, ...


1

ddata = First@ToExpression@Import[ "http://pastebin.com/raw.php?i=KwJSvA2r", "Data"]; ddata = ddata /. {a_, b_} -> {a + 1.5, b}; backgraound = ListPlot[ddata, PlotRange -> {{-2, 5}, {0, 500}}, AxesOrigin -> {-2, 0}] Manipulate[ Show[{backgraound, Plot[r (c k (x - a)^(-1 + c) (1 + (x - a)^c)^-j), {x, 0, 5}]}, PlotRange -> ...


1

Like this? ddata = First@ToExpression@Import["http://pastebin.com/raw.php?i=KwJSvA2r", "Data"]; points = ListPlot[ddata, PlotRange -> {{-5, 5}, {0, 100}}, Axes -> True]; Manipulate[ Show[points, Plot[c*k*(x^(c - 1))/((1 + x^c)^(j)), {x, 0, 50}, PlotStyle -> Red, PlotRange -> {{0, 5}, {0, 100}}]], {c, 0, 10}, {k, 0, 10}, {j, 0, 5}]


1

Something along these lines? Just want to make sure. Hard to put in the comment. If not will delete. Manipulate[ Graphics3D[{Green, Cuboid[{t, 0, Sin[t]}]}, Axes -> True, PlotRange -> {{-2 Pi , 2 Pi}, {-1, 1}, {-2, 2}} ], {t, -2 Pi, 2 Pi, .1}]


1

Try this: Manipulate[ Show[plot1, Graphics[{PointSize[0.02], Purple, Point[{a, Sin[2 a]}]}]], {a, 0, 10}] some thing else may be helpful. LocatorPane[Dynamic[pt], Show[plot1, Graphics[{PointSize[Large], Point[Dynamic[{First[pt], Sin[2 First[pt]]}]]}]], Appearance -> None]



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