Tag Info

Hot answers tagged

12

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])]


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


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


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


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


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


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


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

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


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


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}]


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


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


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

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


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

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


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

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

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.


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



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