# Tag Info

1

This is a comment turned into an answer as per request. Also note that I changed == into ===, which seems to be crucial. In case you think an abort may happen at an unpredicted moment, you can set $Post = Function[If[# ===$Aborted, Null, #]];

24

The behaviour you see is quite reasonable, given what we can expect from computer algebra systems. It will be very similar in other systems too (and exactly the same in all of Mathematica versions 8, 9 and 10 -- I do not see a difference in v9). Here's Maple's output for example: Here's MuPad: Here's Sage: I assume that you would expect a/a to ...

1

As stated on the Evaluate help page (Possible Issues section): Evaluate works only on the first level, directly inside a held function: Your first version -when used with Hold- looks like this: Evaluate[#[t] /. sol] & /@ vec // Hold // FullForm Hold[Map[Function[Evaluate[ReplaceAll[Slot[1][t],sol]]],vec]] The second function: ...

1

This is a bit subtle. I assume that your sol is something like sol={{x->3}} Evaluate is used to overrule an Hold attribute (not for evaluating expressions). The command Function has attribute HoldAll. So in your first situation you map Function[ Evaluate[#[t] /. sol]] (* {#1[t]}& *) In the second situation, Evaluate is in a Times expression, ...

1

This is not actually an explanation, just some insights. In order to see whats going here I modified your code in the following way: Remove[f]; SetAttributes[f, {Flat, OneIdentity}]; f[0, i_] := i /; (Print[{0, i}]; True) f[i_, 0] := i /; (Print[{i, 0}]; True) f[i_, i_] := 0 /; (Print[{i, i}]; True) f[i_, j_] := 6 - i - j /; (Print[{i, j}]; True) For ...

0

Just to strengthen the idea that Plot does not evaluate the expression even with simplest operations Plot[0 + {Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, Filling -> Axis]

3

Here is a method that is not exactly to your specification but which may serve you anyway. It uses a Symbol argument. Because a Symbol is passed it is automatically modified by Module and does not need the guesswork of $ModuleNumber etc. but it does need string conversion and cleanup. SetAttributes[printVal, HoldFirst]; printVal[s_Symbol] := Print @ ... 12 The term pure function used in Mathematica is not being used in the same sense as the cited Wikipedia article. In Mathematica it refers to an anonymous function. In the Wikipedia article it is a term extracted by analogy from the increasingly popular term "purely functional" which refers (mainly) to deterministic programming free of side-effects. The ... 3 These are the conditions necessary for the expression to be Positive Assuming[0 < q < 1 && 0 < y < x < 1, FullSimplify@ Reduce[Positive[ 1/2 - (2 q (2 q + x^2 - y^2))/(2 q (q - 2) - x^2 + y^2)^2]]] Sqrt[2] + q == 2 || [...] and other more complicated solutions. If you need to know if that's always true then Resolve[ ... 1 To get a numeric result you would need to assign numeric values to m, w, and h int = Assuming[{Element[{m, w , h}, Reals], m w h > 0}, Integrate[Exp[-p^2/(m w h)], {p, -Infinity, Sqrt[h m w]}] // Simplify] 1/2 Sqrt[[Pi]] Sqrt[h m w] (1 + Erf[1]) For example, int /. {m -> 1., w -> 2. , h -> 2.} 3.2661 0 I understand that you are looking for sort of a conditional updating: only when the displayed portion of the variable test changes. My feeling is that it is unavoidable that the displayed portion of test has to be recomputed at each change of test. But that can be done outside Dynamic. Here is an smaller example, showing the sort of solution I am thinking ... 2 Let's use WReach's method to examine Manipulate: x = "global"; f[] := x Manipulate[{x, f[], Hold[x]}, {x, {"local"}}] {"local", "global", Hold[FE`x$\$69]} This is akin to the output of Module. (See the WReach's post.) The value of x is not temporarily changed as with Block, nor are explicit x expressions directly replaced with the local value of x ...

1

Your first example code actually is wrong, logically speaking. You are not supposed to make assignments to control variables (unless control type is set to None). The control variable is supposed to be modified only using the controls (sliders, buttons etc...), and read only in the Manipulate expression. Otherwise, you can get into an infinite loop. When ...

Top 50 recent answers are included