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

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 ...


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 ...


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}, ...


4

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 = ...


4

I think I have it this time: Here's the Manipulate, I removed the Module and cleaned up the Symbols a bit Manipulate[(*Function*) Plot[ctrlVdc + ctrlVac ctrlgFunc[2 Pi ctrlf t + ctrlPhi], {t, 0, 0.4}], {{ctrlgFunc, Sin, ""}, {Sin, Cos, Tan, Cot}}, Delimiter, {{ctrlVac, 1.5, Subscript["V", "ac"]}, -10, 10}, {{ctrlVdc, 0.5, Subscript["V", ...


3

Just to add a bit to the xzczd answer given in a form of a comment above. In earlier Mma versions (that might be your case) it can be done as follows: f[x_, y_] := a y + x^2 ss = DSolve[{D[y[x], x] == f[x, y[x]], y[0] == c}, y, x][[1, 1]] yielding this: (* y -> Function[{x}, (-2 + 2 E^(a x) + a^3 c E^(a x) - 2 a x - a^2 x^2)/ a^3] *) Than ...


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

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

The \[Alpha] used ouside of the Manipulate is not the same as the \[Alpha] inside of the Manipulate (scoping). Parameterize f to make the variables identical. Excessive PlotPoints slows the plotting. Clear[f, \[Alpha]] n = 0; h = 1; H = (x^2 + p^2)/2; f[\[Alpha]_, x_, p_] = (1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h] - (2/3)*\[Alpha]*p^3* ...


2

You just need to put in conditions that test whether the point crosses the curve. You'll need to keep track of the previous position. You'll also need to decide what constitutes a crossing. The simplest is that it changes sides (as indicated by the y coordinate) when the x coordinates of the point and the previous point are within the plot's domain (for ...


2

The following solution may or may not be too complicated to deal with, but it's kind of neat. It uses DynamicModule wormholes to link variables between two DynamicModules. One of the modules has to be created from within a live instance of the other one. That is to say, you instantiate one (the parent) in the Front End, and it has to create the other (the ...


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

Perhaps I'm missing something, but can't this problem be solved without the event handling? Manipulate[ LogPlot[Log[T], {T, 273.16, 647.096}, PlotStyle -> Thick, Epilog -> Inset[Style[Text[If[Exp@Last@l > Log[First@l], "Vapor", "Liquid"]], 16, Bold], l, Scaled[{-.5, 1}]]], {{l, {450, Log[5.6]}}, Locator}] I'll edit to include ...


1

You don't want to pass the full data set into the Manipulate. You just want to pass its name and have it evaluated inside the Manipulate. Try the following. Is it fast enough? SeedRandom[42]; data = RandomReal[{0, 1}, {500, 500, 500}]; SetAttributes[vizData, HoldFirst]; vizData[dataVar_Symbol] := Manipulate[Image[dataVar[[All, All, i]]], {i, 1, 500, 1}] ...


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

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


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, ...



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