Tag Info

Hot answers tagged

5

It seems to me that this double evaluation is simply part of the mechanism of Manipulate. When the slider is dragged one expression is displayed, and when it is released another is displayed. I described this a bit in PolarPlot render oddities but here is another example. I use ControlActive to make the behavior explicit but same action is implicit ...


3

I think this approach is an overreaction. Maybe something like this will be ok? f[l_, x_] := g[##, x] & @@ l


3

Edit This is the workaround I've found : data = RandomReal[100, {10000, 10}]; Manipulate[ Block[{$PerformanceGoal = "Quality", a}, a = Log[i]; Grid[{{RandomReal[100]}, {ListPlot[a data[[;; , i]], PlotLabel -> RandomReal[100], ImageSize -> 400, PlotStyle -> Hue[RandomReal[1]], PerformanceGoal -> "Quality"]}}]], {i, 2, ...


2

I agree with this comment, so let me put here a wiki: I'm reasonably certain this is designed behavior - the variable coloring is only supposed to apply to the Global` context. As an indication, in Preferences>Appearance>Syntax Coloring>Other the typical blue color is assigned to "Global symbols that have no value assigned". I'm not aware ...


2

In version 10 have you looked at Inactivate and Activate? (* ClearAll["Global`*"] *) f[x_, y_] := x + y expr = Inactivate[f[x, y]]; Now have a look at expr and see that f is inactivated. You can also activate f to see the result of the operation. expr Activate[expr] Now set y and look at expr, then activate it. y = 3; expr Activate[expr] I hope ...


2

Trivially, in this case you can use Re[x] ^= x. However, you can't use upvalues with expressions like Sqrt[Pi^2] (which evaluates to Pi). You could use $Post and Refine, but it's sort of a hack. $Post = Refine[#, x \[Element] Reals] & Re[x] (* x *) Sqrt[x^2] (* Abs[x] *) Note that this system isn't very flexible. If you want to add another ...


2

N@PolyLog[3,e] or N[PolyLog[3,e]] Also if by e you mean Exp[1](Mathematicas notation), then you'll have to change that.


2

As you note yourself the difference between b^0 (1/b)^(3/2) and b^0 (1/b)^(5/2) is that the second form results in transformation into Sqrt[1/b]/b^2. This in turn is transformed into (1/b)^(5/2) b^0 causing an infinite loop. You can see some more detail of the process with this: b /: NumericQ[b] = True; $IterationLimit = 20; Trace[Sqrt[1/b]/b^2, ...


2

While Kuba's answer is simpler, what you asked for can be accomplished also rather easily with the help of the nested injector pattern: variables /. {vars__} :> (Map[Pattern[#, Blank[]] &, {vars}] /. {patts__} :> (f[{patts}, x_] := g[vars, x]))


1

First of all correcting the sign in the exponential we get f2 = Integrate[ Exp[r^2/(2 M^2)] (b^2 - 3 r^2)^2 (Abs[b^2 + r^2] - (b^2 - r^2))/( r (r^2 - b^2)), {r, 0, I \[Infinity]}, Assumptions -> {M > 0, b > 0] (* Out[278]= 18 b^2 M^2 + 4 b^4 E^(b^2/(2 M^2)) ExpIntegralEi[-(b^2/(2 M^2))] *) Taking the pricipal value has no influence as ...


1

The Gamma function has a property that $ \Gamma(x+1)=x*\Gamma(x) $ So in the result that Mathematica returns $ \sqrt{\frac{\Gamma(n-m+1)\Gamma(n+m+2)}{\Gamma(n-m)\Gamma(n+m+1)}} = \sqrt{\frac{\Gamma(n-m+1)}{\Gamma(n-m)}}\times\sqrt{\frac{\Gamma(n+m+2)}{\Gamma(n+m+1)}} = \sqrt{(n-m)(n+m+1)}$ which is exactly the result shown in the website.


1

From my perspective, the best way to interrupt a computation is with the menu command Evaluation/Abort Evaluation, or from the keyboard, as described here. However, if using Button is desirable for other reasons, delete Method -> "Queued" so that the "Stop" code is executed immediately. Be aware, though, that Quit[] terminates the Kernel, losing ...



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