Tag Info

New answers tagged

1

Here's my attempt at achieving what you describes. 1) I define a display function that takes n as the number of randomly generated locators (initLoc). It also takes a list of speeds v between those locators. The rest of the function is figuring out at what time a particle will reach a particular locator (locatorTimes) given its average speed and the locator ...


6

I got an answer from Wolfram Technical Support today. They had the following to say so far: "...It does appear that Manipulate is not behaving properly, and I have forwarded an incident report to our developers with the information you provided. [...] We hope this will be resolved in our future release of Mathematica."


4

This can be done more cleanly by localizing curve to the manipulate, which in turn is done by making curve an invisible control. This also obviates the need for the Initialization option, because controls take optional initializers. Manipulate[ Graphics[{ {Red, PointSize @ .02, Point@pt}, Line @ AppendTo[curve, pt]}, Axes -> True, ...


2

Replacing the Set in Initialization by a SetDelayed solved the problem, TrackedSymbols should be set also. Conjecture: It seems Clear before Manipulate produces problems, I can't believe it. It can be used in a separate cell, but not in the same cell. Experiences? Manipulate[ curve = Append[curve, pt]; Graphics[{{Red, PointSize@.02, Point@pt}, ...


1

There are lots of ways to do what you want. I would not use Module. Here are three, all of which use methods other than Module to localize variables: SeedRandom @ 42; With[{rand = RandomInteger[10, {5, 5, 2}]}, Manipulate[ ListPlot[rand[[i]], PlotRange -> {{-1, 11}, {-1, 11}}], {i, 1, Length[rand], 1, Appearance -> "Labeled"}]] SeedRandom @ ...


1

if you need to keep the definition of l inside manipulate, I think you can try this Manipulate[l = RandomInteger[10, {3, 5, 2}]; ListPlot[l[[i]], PlotRange -> {{-1, 11}, {-1, 11}}], {i, 1, Dynamic@Length@l, 1}] you need to know that for every i, l will be computed again and again. if you want to do 3 plot per each l then you can do it like this ...


1

A memory consumption demonstration Manipulate[{Plot3D[Sin[x a] - Cos[y], {x, -10, 10}, {y, -10, 10}, ColorFunction -> "TemperatureMap", PlotRange -> 11], MemoryInUse[]} // Column, {a, -2, 2, 0.1, Appearance -> "Open"}, TrackedSymbols :> a] After testing this code you should restart MMA, to guarantee full memory available.


4

Update: same thing happens in versions 8.0.4 and 9.0.1. I'm on OS X 10.9.4, Mathematica 10.0.0. I did not wait for 10 minutes, but I do notice that the memory usage of the front end process (Mathematica) is increasing without bound. After a relatively short time it has reached 1.5 GB, so in 4 minutes it is certain to exceed 16 GB. This might be the ...


2

Here is what I understood, I might be mistaken because it's quite unclear to me. Module[{source, target, weight, tree, g}, source = {"aaa", "aaa", "BBB", "ccc", "ddd", "aaa", "aaa", "aaa", "aaa", "aaa"}; target = {"ddd", "eee", "aaa", "aaa", "aaa", "fff", "ggg", "hhh", "iii", "jjj"}; weight = {4.8, 4.4, 4.2, 4.1, 3.6, 3.3, 3.2, 3, 2.7, 2.6}; tree = ...


13

The separation-of-variables solution you quoted has two indices appearing in it: n and j (the subscripts of the coefficient $A_{nj}$). Here, n is azimuthal mode order, i.e. it counts the number of nodes along the direction in which the polar-angle $\theta$ varies (divided by 2). The index j is needed because the wave is supposed to satisfy the boundary ...


7

Your code is redefining the function f every time the Manipulate updates its contents pane, which causing Mathematica to go hyper. You should use the option Initialization so the function is defined just once. Manipulate[ Column @ {Plot[f[x], {x, 0, a}], f[a]}, {a, 1, 50}, Initialization :> (f[x_] = Sin[x])]


2

It seems the definition of f inside the Manipulate is causing the problem (I'm not sure on the exact details, perhaps someone else can elaborate). Besides eldo's solution with TrackedSymbols, you might opt to define f outside: f[x_] := Sin[x] Manipulate[{Plot[f[x], {x, 0, a}], f[a]}, {a, 1, 50}] But why define f at all? It can also be done without ...


4

Manipulate[f[x_] := Sin[x]; {Plot[f[x], {x, 0, a}], f[a]}, {a, 1, 50}, TrackedSymbols :> {a}] solved the problem for me (I got the same flickering). The Documentation doesn't say too much about TrackedSymbols. In your case not only a but also x is continiously updateted. But Manipulate should update x only in case a changes, i.e., the slider is moved. ...


1

The example below shows the effects of forcing a unitary step size in the manipulator in the application you created. The table is filled as expected but there is an uncomfortable lag in the manipulator. I created this example to support the following statements. I think that Manipulator really doesn't need a new option but that programmers need to adjust ...


2

In Mathematica 10 there is a new way to constrain locators that is short and simple. First define your region: circles = Table[Circle[{0, 0}, r], {r, 1, 15, 2}]; lines = Table[Line[{{-15 Cos[the], -15 Sin[the]}, {15 Cos[the], 15 Sin[the]}}], {the, 0, Pi, Pi/6}]; grid = RegionUnion[circles, lines]; And then use the second argument of Dynamic like in ...


2

Another way using the built-in coordinate transforms : define a rule to perform the transformation : rule = Rule[x^2 + y^2 + z^2, Simplify[TransformedField["Cartesian" -> "Spherical", x^2 + y^2 + z^2, {x, y, z} -> {\[Rho], \[Theta], \[Phi]}], Assumptions -> {\[Rho] > 0}]] expr = D[D[E^(I (-k r ...


2

Use rules to do both the forwards and the backwards substitutions. Step 1: deriv = D[D[E^(I*((-k)*r + t \[Omega]))/r /. r -> Sqrt[x^2 + y^2 + z^2], x], y] Step 2: PowerExpand[deriv /. {x^2 + y^2 + z^2 -> r^2}]


4

This will produce a simplified form: Simplify[ D[D[E^(I (-k r + t \[Omega]))/r, x], y] /. Power[x^2 + y^2 + z^2, n_] :> Power[HoldForm[r], 2 n]]


5

You've got a lot going on in your graphic that is possibly causing the slowdown. I have not done an exhaustive refactoring of your code, but hopefully considering this approach might help you. First, I pulled apart your graphic and tried to find what was slowing things down. The ParametricPlot3D has a greater effect on the performance than does the ...


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


5

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


1

What you are seeing is not due to ContourPlot being slow per se. It is because when controls are active, ContourPlot produces a poorer quality plot by default. The plot commands are designed to interact with the dynamic system. But ultimately, I think ContourPlot will be too slow to do what you seek. The way to get nice detailed plot is to use the option ...


0

You should set the step for you parameters for Manipulate. In this case it will work much faster. So instead of Manipulate[ ContourPlot[f[k, θ, ϕ], {x, 0, 50}, {y, 0, 50}, PlotLegends -> Automatic], {k, 0, 10}, {θ, 0, 2*Pi}, {ϕ,0, 2*Pi}] use for example: Manipulate[ ContourPlot[f[k, θ, ϕ], {x, 0, 50}, {y, 0, 50}, PlotLegends -> Automatic], {k, ...


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



Top 50 recent answers are included